From: Borislav Petkov <bp@alien8.de>
To: silviazhao-oc <silviazhao-oc@zhaoxin.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, namhyung@kernel.org, tglx@linutronix.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
cobechen@zhaoxin.com, louisqi@zhaoxin.com,
silviazhao@zhaoxin.com, tonywwang@zhaoxin.com,
kevinbrace@gmx.com, 8vvbbqzo567a@nospam.xutrox.com
Subject: Re: [PATCH] x86/perf/zhaoxin: Add stepping check for ZX-C
Date: Sat, 4 Feb 2023 14:44:57 +0100 [thread overview]
Message-ID: <Y95hWVFyw7TM1WSB@zn.tnic> (raw)
In-Reply-To: <20230202091738.5947-1-silviazhao-oc@zhaoxin.com>
On Thu, Feb 02, 2023 at 05:17:38PM +0800, silviazhao-oc wrote:
> Nano processor may not fully support rdpmc instruction, it works well
> for reading general pmc counter, but will lead GP(general protection)
> when accessing fixed pmc counter. Furthermore, family/mode information
> is same between Nano processor and ZX-C processor, it leads to zhaoxin
> pmu driver is wrongly loaded for Nano processor, which resulting boot
> kernal fail.
>
> To solve this problem, stepping information will be checked to distinguish
> between Nano processor and ZX-C processor.
>
> Fixes: 3a4ac121c2ca (“x86/perf: Add hardware performance events support for Zhaoxin CPU”)
> Reported-by: Arjan <8vvbbqzo567a@nospam.xutrox.com>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=212389
> Reported-by: Kevin Brace <kevinbrace@gmx.com>
>
> Signed-off-by: silviazhao-oc <silviazhao-oc@zhaoxin.com>
Please use your proper name in the Signed-off-by.
> ---
> arch/x86/events/zhaoxin/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/events/zhaoxin/core.c b/arch/x86/events/zhaoxin/core.c
> index 949d845c922b..cef1de251613 100644
> --- a/arch/x86/events/zhaoxin/core.c
> +++ b/arch/x86/events/zhaoxin/core.c
> @@ -541,7 +541,8 @@ __init int zhaoxin_pmu_init(void)
>
> switch (boot_cpu_data.x86) {
> case 0x06:
> - if (boot_cpu_data.x86_model == 0x0f || boot_cpu_data.x86_model == 0x19) {
> + if ((boot_cpu_data.x86_model == 0x0f && boot_cpu_data.x86_stepping >= 0x0e) ||
> + boot_cpu_data.x86_model == 0x19) {
>
> x86_pmu.max_period = x86_pmu.cntval_mask >> 1;
Last time we talked:
https://lore.kernel.org/r/3c7da7fd-402f-c74f-c96c-0e88828eab58@zhaoxin.com
you said that Nano #GPs when trying to RDPMC the fixed counters. Which
sounds like an erratum.
We do those by adding a X86_BUG flag, set that flag for Nano and then
test it where needed. Grep the source tree for examples.
Please do that above too unstead of testing steppings.
Also, I'd like to know why do steppings < 0xe mean Nano and why isn't
there a more reliable way to detect it?
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2023-02-04 13:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 9:17 [PATCH] x86/perf/zhaoxin: Add stepping check for ZX-C silviazhao-oc
2023-02-02 23:53 ` Kevin Brace
2023-02-03 3:12 ` silviazhaooc
2023-02-04 13:44 ` Borislav Petkov [this message]
2023-02-06 8:26 ` silviazhaooc
2023-02-06 9:48 ` Borislav Petkov
2023-02-06 10:55 ` silviazhaooc
2023-02-06 11:13 ` Borislav Petkov
2023-02-07 8:42 ` silviazhaooc
2023-02-07 18:30 ` Borislav Petkov
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=Y95hWVFyw7TM1WSB@zn.tnic \
--to=bp@alien8.de \
--cc=8vvbbqzo567a@nospam.xutrox.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=cobechen@zhaoxin.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=kevinbrace@gmx.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=louisqi@zhaoxin.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=silviazhao-oc@zhaoxin.com \
--cc=silviazhao@zhaoxin.com \
--cc=tglx@linutronix.de \
--cc=tonywwang@zhaoxin.com \
--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