]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: selftests: Print (previous) last_page on dirty page value mismatch
authorSean Christopherson <seanjc@google.com>
Sat, 11 Jan 2025 00:29:57 +0000 (16:29 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 12 Feb 2025 17:00:56 +0000 (09:00 -0800)
Print out the last dirty pages from the current and previous iteration on
verification failures.  In many cases, bugs (especially test bugs) occur
on the edges, i.e. on or near the last pages, and being able to correlate
failures with the last pages can aid in debug.

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

index d7cf1840bd806e98f52e8fc857a8623fd347cc91..fe8cc7f77e2252525b242f23d13fd5f7217adbe3 100644 (file)
@@ -566,8 +566,10 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long *bmap)
                                }
                        }
 
-                       TEST_FAIL("Dirty page %lu value (%lu) != iteration (%lu)",
-                                 page, val, iteration);
+                       TEST_FAIL("Dirty page %lu value (%lu) != iteration (%lu) "
+                                 "(last = %lu, prev_last = %lu)",
+                                 page, val, iteration, dirty_ring_last_page,
+                                 dirty_ring_prev_iteration_last_page);
                } else {
                        nr_clean_pages++;
                        /*
@@ -590,9 +592,10 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long *bmap)
                         *     value "iteration-1".
                         */
                        TEST_ASSERT(val <= iteration,
-                                   "Clear page %"PRIu64" value %"PRIu64
-                                   " incorrect (iteration=%"PRIu64")",
-                                   page, val, iteration);
+                                   "Clear page %lu value (%lu) > iteration (%lu) "
+                                   "(last = %lu, prev_last = %lu)",
+                                   page, val, iteration, dirty_ring_last_page,
+                                   dirty_ring_prev_iteration_last_page);
                        if (val == iteration) {
                                /*
                                 * This page is _just_ modified; it