[PATCH 1/3] KVM: selftests: Add unit to dirty_log_test
Wu Fei
atwufei at 163.com
Wed May 13 05:27:49 PDT 2026
On 5/13/26 08:03, Sean Christopherson wrote:
> On Mon, May 11, 2026, wu.fei9 at sanechips.com.cn wrote:
>> Currently dirty_log_test hardcodes usleep 1ms in each interval, which
>> could be too short for guest to write and fault in enough pages, then
>> there is less chance to test the write protection mechanism, especially
>> in the case of (log_mode != LOG_MODE_DIRTY_RING).
>
> But when log_mode != LOG_MODE_DIRTY_RING, the individual sleep time is largely
> meaningless, because the test won't reap the bitmaps for iterations > 0.
>
> if (i && host_log_mode != LOG_MODE_DIRTY_RING)
> continue;
>
The first usleep matters in the case of KVM_DIRTY_LOG_INITIALLY_SET.
The dirty bitmap is not precise in the first get_dirty_log, all pages
are marked as dirty but most of them are not populated in page table,
this creates the situation I mentioned in the cover letter.
"when the range to wp is
[0xfffff01fc000, 0xfffff023c000) , if found_leaf of 0xfffff01fc000
returns false and page_size is 2MB, it skips the whole range, but it's
possible to have valid entries in [0xfffff0200000, 0xfffff023c000), so
only [0xfffff01fc000, 0xfffff0200000) can be skipped safely."
>>
>> Unit is introduced to replace the default 1ms if specified in command
>> line. The following test can't trigger failure on my riscv vm:
>
> Failure of what? And does the failure really not reproduce with a higher interval?
On riscv, it fails to write protect some pages with valid page table
entry then loses track of dirty pages. Higher interval doesn't help
because only the first usleep matters, after the first
collect_dirty_pages, all dirty pages are tracked precisely then there is
no such problem.
>
>>
>> # ./dirty_log_test -m 21 -M clear-log
>>
>> By enlarging unit, it fails every time:
>
> "unit" is way too vague. Even looking at the code, it's not clear to me what
> you intended a "unit" to be. I'm not entirely opposed to providing the user with
> more control over the innards of the test, but the interface needs to be somewhat
> intuitive.
Basically, a unit is the time of one usleep(), any suggestions?
Thanks,
Fei.
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
More information about the linux-riscv
mailing list