kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] KVM: selftests: Fixes and cleanups for dirty_log_test
@ 2024-12-14  1:07 Sean Christopherson
  2024-12-14  1:07 ` [PATCH 01/20] KVM: selftests: Support multiple write retires in dirty_log_test Sean Christopherson
                   ` (19 more replies)
  0 siblings, 20 replies; 49+ messages in thread
From: Sean Christopherson @ 2024-12-14  1:07 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm, linux-kernel, Peter Xu, Maxim Levitsky, Sean Christopherson

Fix a variety of flaws and false failures/passes in dirty_log_test, and
drop code/behavior that adds complexity while adding little-to-no benefit.

Lots of details in the changelogs, and a partial list of complaints[1] in
Maxim's original thread[2].

E.g. while not a particular interesting bug, hacking KVM like so doesn't
elicit a test failure.

---
 include/linux/kvm_host.h | 2 ++
 virt/kvm/kvm_main.c      | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 401439bb21e3..bf7797ae2cdc 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -389,6 +389,8 @@ struct kvm_vcpu {
 	 */
 	struct kvm_memory_slot *last_used_slot;
 	u64 last_used_slot_gen;
+
+	bool extra_dirty;
 };
 
 /*
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index de2c11dae231..9981f1cc2780 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3444,6 +3444,11 @@ void mark_page_dirty_in_slot(struct kvm *kvm,
 		unsigned long rel_gfn = gfn - memslot->base_gfn;
 		u32 slot = (memslot->as_id << 16) | memslot->id;
 
+		if (!vcpu->extra_dirty &&
+		    gfn_to_memslot(kvm, gfn + 1) == gfn) {
+			vcpu->extra_dirty = true;
+			mark_page_dirty_in_slot(kvm, memslot, gfn + 1);
+		}
 		if (kvm->dirty_ring_size && vcpu)
 			kvm_dirty_ring_push(vcpu, slot, rel_gfn);
 		else if (memslot->dirty_bitmap)
-- 

[1] https://lore.kernel.org/all/Z1vR25ylN5m_DRSy@google.com
[2] https://lore.kernel.org/all/20241211193706.469817-1-mlevitsk@redhat.com

Maxim Levitsky (2):
  KVM: selftests: Support multiple write retires in dirty_log_test
  KVM: selftests: Limit dirty_log_test's s390x workaround to s390x

Sean Christopherson (18):
  KVM: selftests: Sync dirty_log_test iteration to guest *before*
    resuming
  KVM: selftests: Drop signal/kick from dirty ring testcase
  KVM: selftests: Drop stale srandom() initialization from
    dirty_log_test
  KVM: selftests: Precisely track number of dirty/clear pages for each
    iteration
  KVM: selftests: Read per-page value into local var when verifying
    dirty_log_test
  KVM: selftests: Continuously reap dirty ring while vCPU is running
  KVM: selftests: Honor "stop" request in dirty ring test
  KVM: selftests: Keep dirty_log_test vCPU in guest until it needs to
    stop
  KVM: selftests: Post to sem_vcpu_stop if and only if vcpu_stop is true
  KVM: selftests: Use continue to handle all "pass" scenarios in
    dirty_log_test
  KVM: selftests: Print (previous) last_page on dirty page value
    mismatch
  KVM: selftests: Collect *all* dirty entries in each dirty_log_test
    iteration
  KVM: sefltests: Verify value of dirty_log_test last page isn't bogus
  KVM: selftests: Ensure guest writes min number of pages in
    dirty_log_test
  KVM: selftests: Tighten checks around prev iter's last dirty page in
    ring
  KVM: selftests: Set per-iteration variables at the start of each
    iteration
  KVM: selftests: Fix an off-by-one in the number of dirty_log_test
    iterations
  KVM: selftests: Allow running a single iteration of dirty_log_test

 tools/testing/selftests/kvm/dirty_log_test.c | 515 +++++++++----------
 1 file changed, 240 insertions(+), 275 deletions(-)


base-commit: fac04efc5c793dccbd07e2d59af9f90b7fc0dca4
-- 
2.47.1.613.gc27f4b7a9f-goog


^ permalink raw reply related	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2024-12-19 15:59 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-14  1:07 [PATCH 00/20] KVM: selftests: Fixes and cleanups for dirty_log_test Sean Christopherson
2024-12-14  1:07 ` [PATCH 01/20] KVM: selftests: Support multiple write retires in dirty_log_test Sean Christopherson
2024-12-14  1:07 ` [PATCH 02/20] KVM: selftests: Sync dirty_log_test iteration to guest *before* resuming Sean Christopherson
2024-12-17 23:58   ` Maxim Levitsky
2024-12-18 21:36     ` Sean Christopherson
2024-12-19 15:11       ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 03/20] KVM: selftests: Drop signal/kick from dirty ring testcase Sean Christopherson
2024-12-14  1:07 ` [PATCH 04/20] KVM: selftests: Drop stale srandom() initialization from dirty_log_test Sean Christopherson
2024-12-17 23:59   ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 05/20] KVM: selftests: Precisely track number of dirty/clear pages for each iteration Sean Christopherson
2024-12-17 23:59   ` Maxim Levitsky
2024-12-18 21:37     ` Sean Christopherson
2024-12-14  1:07 ` [PATCH 06/20] KVM: selftests: Read per-page value into local var when verifying dirty_log_test Sean Christopherson
2024-12-17 23:59   ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 07/20] KVM: selftests: Continuously reap dirty ring while vCPU is running Sean Christopherson
2024-12-18  0:00   ` Maxim Levitsky
2024-12-19  1:50     ` Sean Christopherson
2024-12-14  1:07 ` [PATCH 08/20] KVM: selftests: Limit dirty_log_test's s390x workaround to s390x Sean Christopherson
2024-12-14  1:07 ` [PATCH 09/20] KVM: selftests: Honor "stop" request in dirty ring test Sean Christopherson
2024-12-18  0:00   ` Maxim Levitsky
2024-12-19  2:00     ` Sean Christopherson
2024-12-19 15:07       ` Maxim Levitsky
2024-12-19 15:23         ` Sean Christopherson
2024-12-19 15:57           ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 10/20] KVM: selftests: Keep dirty_log_test vCPU in guest until it needs to stop Sean Christopherson
2024-12-18  0:01   ` Maxim Levitsky
2024-12-19 15:59     ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 11/20] KVM: selftests: Post to sem_vcpu_stop if and only if vcpu_stop is true Sean Christopherson
2024-12-18  0:01   ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 12/20] KVM: selftests: Use continue to handle all "pass" scenarios in dirty_log_test Sean Christopherson
2024-12-18  0:01   ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 13/20] KVM: selftests: Print (previous) last_page on dirty page value mismatch Sean Christopherson
2024-12-18  0:01   ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 14/20] KVM: selftests: Collect *all* dirty entries in each dirty_log_test iteration Sean Christopherson
2024-12-18  0:02   ` Maxim Levitsky
2024-12-19  2:13     ` Sean Christopherson
2024-12-19 12:55       ` Paolo Bonzini
2024-12-19 15:01         ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 15/20] KVM: sefltests: Verify value of dirty_log_test last page isn't bogus Sean Christopherson
2024-12-18  0:02   ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 16/20] KVM: selftests: Ensure guest writes min number of pages in dirty_log_test Sean Christopherson
2024-12-18  0:02   ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 17/20] KVM: selftests: Tighten checks around prev iter's last dirty page in ring Sean Christopherson
2024-12-18  0:03   ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 18/20] KVM: selftests: Set per-iteration variables at the start of each iteration Sean Christopherson
2024-12-14  1:07 ` [PATCH 19/20] KVM: selftests: Fix an off-by-one in the number of dirty_log_test iterations Sean Christopherson
2024-12-18  0:03   ` Maxim Levitsky
2024-12-14  1:07 ` [PATCH 20/20] KVM: selftests: Allow running a single iteration of dirty_log_test Sean Christopherson
2024-12-18  0:03   ` Maxim Levitsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).