Skip to contentSkip to conversation

x86/pmu: Make "ref cycles" test to pass on the latest cpu

PATCH RESEND In review Like Xu 3 participants 5 messages Mar 2, 2022 KVM

lore
Share & tools
lore

Like Xu

author
#0 lore raw

PATCH RESEND 1/2 x86/pmu: Make "ref cycles" test to pass on the latest cpu

From: Like Xu <[email protected]>

Expand the boundary for "ref cycles" event test as it has been observed that the results do not fit on some CPUs [1]:

FAIL: full-width writes: ref cycles-N
100000 >= 87765 <= 30000000
100000 >= 87926 <= 30000000
100000 >= 87790 <= 30000000
100000 >= 87687 <= 30000000
100000 >= 87875 <= 30000000
100000 >= 88043 <= 30000000
100000 >= 88161 <= 30000000
100000 >= 88052 <= 30000000

[1] Intel(R) Xeon(R) Platinum 8374C CPU @ 2.70GHz

Opportunistically fix cc1 warnings for commented print statement.

---
 x86/pmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
x86/pmu.c +2 -2
index 92206ad..3d05384 100644
@@ -86,7 +86,7 @@ struct pmu_event {
 } gp_events[] = {
 	{"core cycles", 0x003c, 1*N, 50*N},
 	{"instructions", 0x00c0, 10*N, 10.2*N},
-	{"ref cycles", 0x013c, 0.1*N, 30*N},
+       {"ref cycles", 0x013c, 0.08*N, 30*N},
 	{"llc refference", 0x4f2e, 1, 2*N},
 	{"llc misses", 0x412e, 1, 1*N},
 	{"branches", 0x00c4, 1*N, 1.1*N},
@@ -223,7 +223,7 @@ static void measure(pmu_counter_t *evt, int count)
 
 static bool verify_event(uint64_t count, struct pmu_event *e)
 {
-	// printf("%lld >= %lld <= %lld\n", e->min, count, e->max);
+	// printf("%d >= %ld <= %d\n", e->min, count, e->max);
 	return count >= e->min  && count <= e->max;
 
 }
Signature · 1 line
2.35.1
author
#1 lore raw

PATCH RESEND 2/2 x86/pmu: Fix a comment about full-width counter writes support

From: Like Xu <[email protected]>

From: Like Xu <[email protected]>

Remove two Unicode characters 'ZERO WIDTH SPACE' (U+200B).

Fixes 22f2901a0e ("x86: pmu: Test full-width counter writes support")
---
 x86/pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
x86/pmu.c +1 -1
index 3d05384..052c2b7 100644
@@ -587,7 +587,7 @@ static void  check_gp_counters_write_width(void)
 	}
 
 	/*
-	 * MSR_IA32_PMCn supports writing values ​​up to GP counter width,
+        * MSR_IA32_PMCn supports writing values up to GP counter width,
 	 * and only the lowest bits of GP counter width are valid.
 	 */
 	for (i = 0; i < num_counters; i++) {
Signature · 1 line
2.35.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [kvm-unit-tests PATCH RESEND 2/2] x86/pmu: Fix a comment about full-width counter writes support

Quoted 10 lines · Like Xu

From: Like Xu <[email protected]>

From: Like Xu <[email protected]>

Remove two Unicode characters 'ZERO WIDTH SPACE' (U+200B).

Fixes 22f2901a0e ("x86: pmu: Test full-width counter writes support")
#3 lore raw
In reply to Like Xu
Quoted 16 lines · Like Xu

From: Like Xu <[email protected]>

Expand the boundary for "ref cycles" event test as it has been observed that the results do not fit on some CPUs [1]:

FAIL: full-width writes: ref cycles-N
100000 >= 87765 <= 30000000
100000 >= 87926 <= 30000000
100000 >= 87790 <= 30000000
100000 >= 87687 <= 30000000
100000 >= 87875 <= 30000000
100000 >= 88043 <= 30000000
100000 >= 88161 <= 30000000
100000 >= 88052 <= 30000000

Quoted 5 lines

[1] Intel(R) Xeon(R) Platinum 8374C CPU @ 2.70GHz

Opportunistically fix cc1 warnings for commented print statement.

This fix doesn't address the root cause of the problem, which is that the general purpose reference cycles event is, in many cases, decoupled from CPI. My proposed fix,
https://lore.kernel.org/kvm/[email protected]/,
does.

maintainer
#4 lore raw
Quoted 21 lines · Jim Mattson
Quoted 20 lines · Like Xu

From: Like Xu <[email protected]>

Expand the boundary for "ref cycles" event test as it has been observed that the results do not fit on some CPUs [1]:

FAIL: full-width writes: ref cycles-N
100000 >= 87765 <= 30000000
100000 >= 87926 <= 30000000
100000 >= 87790 <= 30000000
100000 >= 87687 <= 30000000
100000 >= 87875 <= 30000000
100000 >= 88043 <= 30000000
100000 >= 88161 <= 30000000
100000 >= 88052 <= 30000000

[1] Intel(R) Xeon(R) Platinum 8374C CPU @ 2.70GHz

Opportunistically fix cc1 warnings for commented print statement.

Quoted 8 lines
Quoted 1 line

This fix doesn't address the root cause of the problem, which is that the general purpose reference cycles event is, in many cases, decoupled from CPI. My proposed fix,
https://lore.kernel.org/kvm/[email protected]/,
does.

Queued yours, together with Like's patch 2.

Paolo