]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: selftests: Continuously reap dirty ring while vCPU is running
authorSean Christopherson <seanjc@google.com>
Sat, 11 Jan 2025 00:29:51 +0000 (16:29 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 12 Feb 2025 17:00:55 +0000 (09:00 -0800)
commit9b1feec83e1ab1cbab37232b8aab16301066336d
treefb67978d08509bc39806a7f15bb0e4c8ad293445
parentf2228aa083240f44794c3617d4a22134ab26217c
KVM: selftests: Continuously reap dirty ring while vCPU is running

Continue collecting entries from the dirty ring for the entire time the
vCPU is running.  Collecting exactly once all but guarantees the vCPU will
encounter a "ring full" event and stop.  While testing ring full is
interesting, stopping and doing nothing is not, especially for larger
intervals as the test effectively does nothing for a much longer time.

To balance continuous collection with letting the guest make forward
progress, chunk the interval waiting into 1ms loops (which also makes
the math dead simple).

To maintain coverage for "ring full", collect entries on subsequent
iterations if and only if the ring has been filled at least once.  I.e.
let the ring fill up (if the interval allows), but after that contiuously
empty it so that the vCPU can keep running.

Opportunistically drop unnecessary zero-initialization of "count".

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20250111003004.1235645-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/dirty_log_test.c