linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Mi, Dapeng" <dapeng1.mi@linux.intel.com>
To: tanze <tanze@kylinos.cn>,
	peterz@infradead.org, kan.liang@linux.intel.com
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	x86@kernel.org
Subject: Re: [PATCH v3] perf/x86/zhaoxin: Fix instructions error by missing fixedctr member
Date: Tue, 30 Sep 2025 10:49:56 +0800	[thread overview]
Message-ID: <c962d1a5-b941-4361-839c-c34e621de5ee@linux.intel.com> (raw)
In-Reply-To: <20250620023757.1429898-1-tanze@kylinos.cn>


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>



  reply	other threads:[~2025-09-30  2:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19  3:19 [PATCH] perf/x86/zhaoxin: Fix instructions error by missing fixedctr member tanze
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
2025-09-30  2:49     ` Mi, Dapeng [this message]
2025-10-15  8:55       ` tanze
2025-09-28  9:44 ` [PATCH] " tanze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c962d1a5-b941-4361-839c-c34e621de5ee@linux.intel.com \
    --to=dapeng1.mi@linux.intel.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tanze@kylinos.cn \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).