KVM: selftests: Fix inverted "warning" in access tracking perf test
authorSean Christopherson <seanjc@google.com>
Tue, 29 Nov 2022 17:52:59 +0000 (17:52 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 1 Dec 2022 23:31:32 +0000 (15:31 -0800)
Warn if the number of idle pages is greater than or equal to 10% of the
total number of pages, not if the percentage of idle pages is less than
10%.  The original code asserted that less than 10% of pages were still
idle, but the check got inverted when the assert was converted to a
warning.

Opportunistically clean up the warning; selftests are 64-bit only, there
is no need to use "%PRIu64" instead of "%lu".

Fixes: 6336a810db5c ("KVM: selftests: replace assertion with warning in access_tracking_perf_test")
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20221129175300.4052283-2-seanjc@google.com
tools/testing/selftests/kvm/access_tracking_perf_test.c

index 02d3587cab0a3549c3de4918f2db528d9e724d9a..d45ef319a68f3ff066b2281500c50b0dce50eab4 100644 (file)
@@ -185,10 +185,9 @@ static void mark_vcpu_memory_idle(struct kvm_vm *vm,
         * happens, much more pages are cached there and guest won't see the
         * "idle" bit cleared.
         */
-       if (still_idle < pages / 10)
-               printf("WARNING: vCPU%d: Too many pages still idle (%" PRIu64
-                      "out of %" PRIu64 "), this will affect performance results"
-                      ".\n",
+       if (still_idle >= pages / 10)
+               printf("WARNING: vCPU%d: Too many pages still idle (%lu out of %lu), "
+                      "this will affect performance results.\n",
                       vcpu_idx, still_idle, pages);
 
        close(page_idle_fd);