diff mbox series

[kvm-unit-tests,RESEND,1/2] x86/pmu: Make "ref cycles" test to pass on the latest cpu

Message ID 20220302112634.15024-1-likexu@tencent.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests,RESEND,1/2] x86/pmu: Make "ref cycles" test to pass on the latest cpu | expand

Commit Message

Like Xu March 2, 2022, 11:26 a.m. UTC
From: Like Xu <likexu@tencent.com>

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.

Signed-off-by: Like Xu <likexu@tencent.com>
---
 x86/pmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jim Mattson March 2, 2022, 5:39 p.m. UTC | #1
On Wed, Mar 2, 2022 at 3:26 AM Like Xu <like.xu.linux@gmail.com> wrote:
>
> From: Like Xu <likexu@tencent.com>
>
> 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.
>
> Signed-off-by: Like Xu <likexu@tencent.com>

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/20220213082714.636061-1-jmattson@google.com/,
does.
Paolo Bonzini March 2, 2022, 8:34 p.m. UTC | #2
On 3/2/22 18:39, Jim Mattson wrote:
> On Wed, Mar 2, 2022 at 3:26 AM Like Xu <like.xu.linux@gmail.com> wrote:
>>
>> From: Like Xu <likexu@tencent.com>
>>
>> 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.
>>
>> Signed-off-by: Like Xu <likexu@tencent.com>
> 
> 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/20220213082714.636061-1-jmattson@google.com/,
> does.
> 

Queued yours, together with Like's patch 2.

Paolo
diff mbox series

Patch

diff --git a/x86/pmu.c b/x86/pmu.c
index 92206ad..3d05384 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -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;
 
 }