Skip to content

Commit 24b9a2a

Browse files
committed
KVM: selftests: Print (previous) last_page on dirty page value mismatch
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent c616f36 commit 24b9a2a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/testing/selftests/kvm/dirty_log_test.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,10 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long *bmap)
566566
}
567567
}
568568

569-
TEST_FAIL("Dirty page %lu value (%lu) != iteration (%lu)",
570-
page, val, iteration);
569+
TEST_FAIL("Dirty page %lu value (%lu) != iteration (%lu) "
570+
"(last = %lu, prev_last = %lu)",
571+
page, val, iteration, dirty_ring_last_page,
572+
dirty_ring_prev_iteration_last_page);
571573
} else {
572574
nr_clean_pages++;
573575
/*
@@ -590,9 +592,10 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long *bmap)
590592
* value "iteration-1".
591593
*/
592594
TEST_ASSERT(val <= iteration,
593-
"Clear page %"PRIu64" value %"PRIu64
594-
" incorrect (iteration=%"PRIu64")",
595-
page, val, iteration);
595+
"Clear page %lu value (%lu) > iteration (%lu) "
596+
"(last = %lu, prev_last = %lu)",
597+
page, val, iteration, dirty_ring_last_page,
598+
dirty_ring_prev_iteration_last_page);
596599
if (val == iteration) {
597600
/*
598601
* This page is _just_ modified; it

0 commit comments

Comments
 (0)