]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: selftests: Post to sem_vcpu_stop if and only if vcpu_stop is true
authorSean Christopherson <seanjc@google.com>
Sat, 11 Jan 2025 00:29:55 +0000 (16:29 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 12 Feb 2025 17:00:55 +0000 (09:00 -0800)
commit9a91f6542435ad94cbb8e5b64ca3d4cc31d3c12a
tree4d8f5b422db9f3397fadad87585c97a964df99ca
parent0a818b3541af09ddaf412d125dc7315fc448851e
KVM: selftests: Post to sem_vcpu_stop if and only if vcpu_stop is true

When running dirty_log_test using the dirty ring, post to sem_vcpu_stop
only when the main thread has explicitly requested that the vCPU stop.
Synchronizing the vCPU and main thread whenever the dirty ring happens to
be full is unnecessary, as KVM's ABI is to actively prevent the vCPU from
running until the ring is no longer full.  I.e. attempting to run the vCPU
will simply result in KVM_EXIT_DIRTY_RING_FULL without ever entering the
guest.  And if KVM doesn't exit, e.g. let's the vCPU dirty more pages,
then that's a KVM bug worth finding.

Posting to sem_vcpu_stop on ring full also makes it difficult to get the
test logic right, e.g. it's easy to let the vCPU keep running when it
shouldn't, as a ring full can essentially happen at any given time.

Opportunistically rework the handling of dirty_ring_vcpu_ring_full to
leave it set for the remainder of the iteration in order to simplify the
surrounding logic.

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