]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: selftests: Print out the actual Top-Down Slots count on failure
authorSean Christopherson <seanjc@google.com>
Fri, 17 Jan 2025 23:42:03 +0000 (15:42 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 12 Feb 2025 16:34:56 +0000 (08:34 -0800)
Print out the expected vs. actual count of the Top-Down Slots event on
failure in the Intel PMU counters test.  GUEST_ASSERT() only expands
constants/macros, i.e. only prints the value of the expected count, which
makes it difficult to debug and triage failures.

Link: https://lore.kernel.org/r/20250117234204.2600624-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/x86/pmu_counters_test.c

index ea1485a08c785d20ba935198bd864deac93cad59..8aaaf25b6111d21be654ce125a5d470f68d00d2a 100644 (file)
@@ -174,7 +174,9 @@ static void guest_assert_event_count(uint8_t idx, uint32_t pmc, uint32_t pmc_msr
                GUEST_ASSERT_NE(count, 0);
                break;
        case INTEL_ARCH_TOPDOWN_SLOTS_INDEX:
-               GUEST_ASSERT(count >= NUM_INSNS_RETIRED);
+               __GUEST_ASSERT(count >= NUM_INSNS_RETIRED,
+                              "Expected top-down slots >= %u, got count = %lu",
+                              NUM_INSNS_RETIRED, count);
                break;
        default:
                break;