2022-11-29 18:05:47

by Sean Christopherson

[permalink] [raw]
Subject: [PATCH 0/2] KVM: selftests: Fixes for access tracking perf test

Fix an inverted check in the access tracking perf test, and restore the
assert that there aren't too many dangling idle pages when running the
test on x86-64 bare metal.

Sean Christopherson (2):
KVM: selftests: Fix inverted "warning" in access tracking perf test
KVM: selftests: Restore assert for non-nested VMs in access tracking
test

.../selftests/kvm/access_tracking_perf_test.c | 22 ++++++++++++-------
.../selftests/kvm/include/x86_64/processor.h | 1 +
2 files changed, 15 insertions(+), 8 deletions(-)


base-commit: 3e04435fe60590a1c79ec94d60e9897c3ff7d73b
--
2.38.1.584.g0f3c55d4c2-goog


2022-11-29 18:23:51

by Sean Christopherson

[permalink] [raw]
Subject: [PATCH 1/2] KVM: selftests: Fix inverted "warning" in access tracking perf test

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")
Cc: Emanuele Giuseppe Esposito <[email protected]>
Signed-off-by: Sean Christopherson <[email protected]>
---
tools/testing/selftests/kvm/access_tracking_perf_test.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/kvm/access_tracking_perf_test.c b/tools/testing/selftests/kvm/access_tracking_perf_test.c
index 02d3587cab0a..d45ef319a68f 100644
--- a/tools/testing/selftests/kvm/access_tracking_perf_test.c
+++ b/tools/testing/selftests/kvm/access_tracking_perf_test.c
@@ -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);
--
2.38.1.584.g0f3c55d4c2-goog

Subject: Re: [PATCH 0/2] KVM: selftests: Fixes for access tracking perf test



Am 29/11/2022 um 18:52 schrieb Sean Christopherson:
> Fix an inverted check in the access tracking perf test, and restore the
> assert that there aren't too many dangling idle pages when running the
> test on x86-64 bare metal.
>
> Sean Christopherson (2):
> KVM: selftests: Fix inverted "warning" in access tracking perf test
> KVM: selftests: Restore assert for non-nested VMs in access tracking
> test
>
> .../selftests/kvm/access_tracking_perf_test.c | 22 ++++++++++++-------
> .../selftests/kvm/include/x86_64/processor.h | 1 +
> 2 files changed, 15 insertions(+), 8 deletions(-)
>
>
> base-commit: 3e04435fe60590a1c79ec94d60e9897c3ff7d73b
>

Makes sense, apologies for inverting the check.

Reviewed-by: Emanuele Giuseppe Esposito <[email protected]>