* [PATCH v2 v2] perf/x86/zhaoxin: Fix instructions error by missing fixedctr member
2025-06-19 14:33 ` Liang, Kan
@ 2025-06-20 1:51 ` tanze
2025-06-20 2:10 ` [PATCH 0/1] CANCELLED: [PATCH " tanze
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: tanze @ 2025-06-20 1:51 UTC (permalink / raw)
To: peterz, kan.liang; +Cc: linux-perf-users, linux-kernel, x86, tanze
Perf's instructions event tests on Zhaoxin CPUs may exhibit:
$perf stat -e instructions,cycles ls -l
......
Performance counter stats for 'ls -l':
0 instructions # 0.00 insn per cycle
9,488,278 cycles
0.004365407 seconds time elapsed
0.003303000 seconds user
0.001099000 seconds sys
The absence of the fixedctr member leads to an incorrect hwc->event_base
value on Zhaoxin CPUs, causing a discrepancy in the instruction count
reported by perf stat. This commit resolves the instruction count issue
by properly initializing the fixedctr member.
Fixes: 149fd4712bcd ("perf/x86/intel: Support Perfmon MSRs aliasing")
Signed-off-by: tanze <tanze@kylinos.cn>
---
arch/x86/events/zhaoxin/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/events/zhaoxin/core.c b/arch/x86/events/zhaoxin/core.c
index 4bdfcf091200..3fc3f9abece9 100644
--- a/arch/x86/events/zhaoxin/core.c
+++ b/arch/x86/events/zhaoxin/core.c
@@ -467,6 +467,7 @@ static const struct x86_pmu zhaoxin_pmu __initconst = {
.schedule_events = x86_schedule_events,
.eventsel = MSR_ARCH_PERFMON_EVENTSEL0,
.perfctr = MSR_ARCH_PERFMON_PERFCTR0,
+ .fixedctr = MSR_ARCH_PERFMON_FIXED_CTR0,
.event_map = zhaoxin_pmu_event_map,
.max_events = ARRAY_SIZE(zx_pmon_event_map),
.apic = 1,
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 0/1] CANCELLED: [PATCH v2] perf/x86/zhaoxin: Fix instructions error by missing fixedctr member
2025-06-19 14:33 ` Liang, Kan
2025-06-20 1:51 ` [PATCH v2 v2] " tanze
@ 2025-06-20 2:10 ` tanze
2025-06-20 2:19 ` tanze
2025-06-20 2:37 ` [PATCH v3] " tanze
3 siblings, 0 replies; 9+ messages in thread
From: tanze @ 2025-06-20 2:10 UTC (permalink / raw)
To: peterz, kan.liang; +Cc: linux-perf-users, linux-kernel, x86, tanze
Hi all,
Please **disregard** my previous patch ([PATCH v2 perf/x86/zhaoxin: Fix instructions…]). I will resend a corrected version asap.
Sorry for the noise.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] perf/x86/zhaoxin: Fix instructions error by missing fixedctr member
2025-06-19 14:33 ` Liang, Kan
2025-06-20 1:51 ` [PATCH v2 v2] " tanze
2025-06-20 2:10 ` [PATCH 0/1] CANCELLED: [PATCH " tanze
@ 2025-06-20 2:19 ` tanze
2025-06-20 2:37 ` [PATCH v3] " tanze
3 siblings, 0 replies; 9+ messages in thread
From: tanze @ 2025-06-20 2:19 UTC (permalink / raw)
To: peterz, kan.liang; +Cc: linux-perf-users, linux-kernel, x86, tanze
Perf's instructions event tests on Zhaoxin CPUs may exhibit:
$perf stat -e instructions,cycles ls -l
......
Performance counter stats for 'ls -l':
0 instructions # 0.00 insn per cycle
9,488,278 cycles
0.004365407 seconds time elapsed
0.003303000 seconds user
0.001099000 seconds sys
The absence of the fixedctr member leads to an incorrect hwc->event_base
value on Zhaoxin CPUs, causing a discrepancy in the instruction count
reported by perf stat. This commit resolves the instruction count issue
by properly initializing the fixedctr member.
Fixes: 149fd4712bcd ("perf/x86/intel: Support Perfmon MSRs aliasing")
Signed-off-by: tanze <tanze@kylinos.cn>
---
arch/x86/events/zhaoxin/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/events/zhaoxin/core.c b/arch/x86/events/zhaoxin/core.c
index 4bdfcf091200..3fc3f9abece9 100644
--- a/arch/x86/events/zhaoxin/core.c
+++ b/arch/x86/events/zhaoxin/core.c
@@ -467,6 +467,7 @@ static const struct x86_pmu zhaoxin_pmu __initconst = {
.schedule_events = x86_schedule_events,
.eventsel = MSR_ARCH_PERFMON_EVENTSEL0,
.perfctr = MSR_ARCH_PERFMON_PERFCTR0,
+ .fixedctr = MSR_ARCH_PERFMON_FIXED_CTR0,
.event_map = zhaoxin_pmu_event_map,
.max_events = ARRAY_SIZE(zx_pmon_event_map),
.apic = 1,
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v3] perf/x86/zhaoxin: Fix instructions error by missing fixedctr member
2025-06-19 14:33 ` Liang, Kan
` (2 preceding siblings ...)
2025-06-20 2:19 ` tanze
@ 2025-06-20 2:37 ` tanze
2025-09-30 2:49 ` Mi, Dapeng
3 siblings, 1 reply; 9+ messages in thread
From: tanze @ 2025-06-20 2:37 UTC (permalink / raw)
To: peterz, kan.liang; +Cc: linux-perf-users, linux-kernel, x86, tanze
Perf's instructions event tests on Zhaoxin CPUs may exhibit:
$perf stat -e instructions,cycles ls -l
......
Performance counter stats for 'ls -l':
0 instructions # 0.00 insn per cycle
9,488,278 cycles
0.004365407 seconds time elapsed
0.003303000 seconds user
0.001099000 seconds sys
The absence of the fixedctr member leads to an incorrect hwc->event_base
value on Zhaoxin CPUs, causing a discrepancy in the instruction count
reported by perf stat. This commit resolves the instruction count issue
by properly initializing the fixedctr member.
Fixes: 149fd4712bcd ("perf/x86/intel: Support Perfmon MSRs aliasing")
Signed-off-by: tanze <tanze@kylinos.cn>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
---
arch/x86/events/zhaoxin/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/events/zhaoxin/core.c b/arch/x86/events/zhaoxin/core.c
index 4bdfcf091200..3fc3f9abece9 100644
--- a/arch/x86/events/zhaoxin/core.c
+++ b/arch/x86/events/zhaoxin/core.c
@@ -467,6 +467,7 @@ static const struct x86_pmu zhaoxin_pmu __initconst = {
.schedule_events = x86_schedule_events,
.eventsel = MSR_ARCH_PERFMON_EVENTSEL0,
.perfctr = MSR_ARCH_PERFMON_PERFCTR0,
+ .fixedctr = MSR_ARCH_PERFMON_FIXED_CTR0,
.event_map = zhaoxin_pmu_event_map,
.max_events = ARRAY_SIZE(zx_pmon_event_map),
.apic = 1,
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v3] perf/x86/zhaoxin: Fix instructions error by missing fixedctr member
2025-06-20 2:37 ` [PATCH v3] " tanze
@ 2025-09-30 2:49 ` Mi, Dapeng
2025-10-15 8:55 ` tanze
0 siblings, 1 reply; 9+ messages in thread
From: Mi, Dapeng @ 2025-09-30 2:49 UTC (permalink / raw)
To: tanze, peterz, kan.liang; +Cc: linux-perf-users, linux-kernel, x86
On 6/20/2025 10:37 AM, tanze wrote:
> Perf's instructions event tests on Zhaoxin CPUs may exhibit:
>
> $perf stat -e instructions,cycles ls -l
>
> ......
> Performance counter stats for 'ls -l':
>
> 0 instructions # 0.00 insn per cycle
> 9,488,278 cycles
>
> 0.004365407 seconds time elapsed
>
> 0.003303000 seconds user
> 0.001099000 seconds sys
>
> The absence of the fixedctr member leads to an incorrect hwc->event_base
> value on Zhaoxin CPUs, causing a discrepancy in the instruction count
> reported by perf stat. This commit resolves the instruction count issue
> by properly initializing the fixedctr member.
>
> Fixes: 149fd4712bcd ("perf/x86/intel: Support Perfmon MSRs aliasing")
> Signed-off-by: tanze <tanze@kylinos.cn>
> Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
> ---
> arch/x86/events/zhaoxin/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/events/zhaoxin/core.c b/arch/x86/events/zhaoxin/core.c
> index 4bdfcf091200..3fc3f9abece9 100644
> --- a/arch/x86/events/zhaoxin/core.c
> +++ b/arch/x86/events/zhaoxin/core.c
> @@ -467,6 +467,7 @@ static const struct x86_pmu zhaoxin_pmu __initconst = {
> .schedule_events = x86_schedule_events,
> .eventsel = MSR_ARCH_PERFMON_EVENTSEL0,
> .perfctr = MSR_ARCH_PERFMON_PERFCTR0,
> + .fixedctr = MSR_ARCH_PERFMON_FIXED_CTR0,
> .event_map = zhaoxin_pmu_event_map,
> .max_events = ARRAY_SIZE(zx_pmon_event_map),
> .apic = 1,
LGTM.
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v3] perf/x86/zhaoxin: Fix instructions error by missing fixedctr member
2025-09-30 2:49 ` Mi, Dapeng
@ 2025-10-15 8:55 ` tanze
0 siblings, 0 replies; 9+ messages in thread
From: tanze @ 2025-10-15 8:55 UTC (permalink / raw)
To: Mi, Dapeng, peterz, kan.liang; +Cc: linux-perf-users, linux-kernel, x86
Hi Dapeng,
在 2025/9/30 10:49, Mi, Dapeng 写道:
>
> On 6/20/2025 10:37 AM, tanze wrote:
>> Perf's instructions event tests on Zhaoxin CPUs may exhibit:
>>
>> $perf stat -e instructions,cycles ls -l
>>
>> ......
>> Performance counter stats for 'ls -l':
>>
>> 0 instructions # 0.00 insn per cycle
>> 9,488,278 cycles
>>
>> 0.004365407 seconds time elapsed
>>
>> 0.003303000 seconds user
>> 0.001099000 seconds sys
>>
>> The absence of the fixedctr member leads to an incorrect hwc->event_base
>> value on Zhaoxin CPUs, causing a discrepancy in the instruction count
>> reported by perf stat. This commit resolves the instruction count issue
>> by properly initializing the fixedctr member.
>>
>> Fixes: 149fd4712bcd ("perf/x86/intel: Support Perfmon MSRs aliasing")
>> Signed-off-by: tanze <tanze@kylinos.cn>
>> Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
>> ---
>> arch/x86/events/zhaoxin/core.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/x86/events/zhaoxin/core.c b/arch/x86/events/zhaoxin/core.c
>> index 4bdfcf091200..3fc3f9abece9 100644
>> --- a/arch/x86/events/zhaoxin/core.c
>> +++ b/arch/x86/events/zhaoxin/core.c
>> @@ -467,6 +467,7 @@ static const struct x86_pmu zhaoxin_pmu __initconst = {
>> .schedule_events = x86_schedule_events,
>> .eventsel = MSR_ARCH_PERFMON_EVENTSEL0,
>> .perfctr = MSR_ARCH_PERFMON_PERFCTR0,
>> + .fixedctr = MSR_ARCH_PERFMON_FIXED_CTR0,
>> .event_map = zhaoxin_pmu_event_map,
>> .max_events = ARRAY_SIZE(zx_pmon_event_map),
>> .apic = 1,
>
> LGTM.
>
> Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Thank You
Ze Tan
^ permalink raw reply [flat|nested] 9+ messages in thread