From: Yao Zi <me@ziyao.cc>
To: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] x86/cpu/centaur: Disable X86_FEATURE_FSGSBASE on Zhaoxin C4600
Date: Sun, 1 Mar 2026 09:27:29 +0000 [thread overview]
Message-ID: <aaQGgQOyU877bT1L@pie> (raw)
In-Reply-To: <20260228190615.GDaaM8p65-qJFWzgK2@fat_crate.local>
On Sat, Feb 28, 2026 at 08:06:15PM +0100, Borislav Petkov wrote:
> On Sat, Feb 28, 2026 at 05:37:04PM +0000, Yao Zi wrote:
> > Zhaoxin C4600, which names itself as CentaurHauls, claims
> > X86_FEATURE_FSGSBASE support in CPUID, while execution of fsgsbase-
> > related instructions fails with #UD exception. This will cause kernel
> > to crash early in current_save_fsgs().
> >
> > Let's disable the feature on this problematic CPU and warn the user
> > about the quirk. x86_model_id is used to match the platform to avoid
> > unexpectedly breaking other CentaurHauls cores with conflicting
> > family/model ID.
>
> Please use passive voice in your commit message: no "we" or "I", etc,
> and describe your changes in imperative mood.
>
> Also, pls read section "2) Describe your changes" in
> Documentation/process/submitting-patches.rst for more details.
>
> Also, see section "Changelog" in
> Documentation/process/maintainer-tip.rst
Okay.
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Yao Zi <me@ziyao.cc>
> > ---
> > arch/x86/kernel/cpu/centaur.c | 25 +++++++++++++++++++++++++
> > 1 file changed, 25 insertions(+)
> >
> > diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
> > index 81695da9c524..3773784ba6a9 100644
> > --- a/arch/x86/kernel/cpu/centaur.c
> > +++ b/arch/x86/kernel/cpu/centaur.c
> > @@ -108,6 +108,29 @@ static void early_init_centaur(struct cpuinfo_x86 *c)
> > }
> > }
> >
> > +/*
> > + * Zhaoxin C4600 (family 6, model 15) names itself as CentaurHauls, it claims
> > + * X86_FEATURE_FSGSBASE support in CPUID, while executing any fsgsbase-related
> > + * instructions on it results in #UD.
> > + */
> > +static void fixup_zhaoxin_fsgsbase(struct cpuinfo_x86 *c)
>
> s/fixup/disable/
Okay.
> > +{
> > + const char *name, *model_names[] = {
> > + "C-QuadCore C4600"
> > + };
>
> Why is this an array with a single string in it?
>
> > + int i;
> > +
> > + for (i = 0; i < ARRAY_SIZE(model_names); i++) {
>
> So that you can loop once with it?
>
> Silly.
Though I don't have the conditions to confirm it, it's likely other CPUs
in the same generation of designs from Zhaoxin have similar issues:
their specifications[1] are mostly identical except the core frequency,
thus they're likely the same die. So I leave a loop here to ease latter
additions if necessary. Sorry not to make it clear.
This may be a little farsight. Dave suggests declaring an x86_cpu_id
array and switching to x86_cpu_match(), do you think it's acceptable? Or
should I focus only on the known problematic model and use a simple
if to match Zhaoxin C4600 for now?
> > + name = model_names[i];
> > +
> > + if (!strncmp(c->x86_model_id, name, strlen(name))) {
> > + pr_warn_once("CPU has broken FSGSBASE support\n");
> > + setup_clear_cpu_cap(X86_FEATURE_FSGSBASE);
> > + return;
> > + }
> > + }
> > +}
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
Regards,
Yao Zi
[1]: https://www.zhaoxin.com/qt.aspx?nid=3&typeid=90
next prev parent reply other threads:[~2026-03-01 9:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-28 17:37 [PATCH] x86/cpu/centaur: Disable X86_FEATURE_FSGSBASE on Zhaoxin C4600 Yao Zi
2026-02-28 19:06 ` Borislav Petkov
2026-03-01 9:27 ` Yao Zi [this message]
2026-03-01 18:37 ` David Laight
2026-03-02 5:09 ` Yao Zi
2026-03-01 0:33 ` Dave Hansen
2026-03-01 9:10 ` Yao Zi
2026-03-01 10:28 ` Borislav Petkov
2026-03-01 16:29 ` Andrew Cooper
2026-03-02 5:08 ` Yao Zi
2026-03-02 9:36 ` Andrew Cooper
2026-03-05 9:03 ` Tony W Wang-oc
2026-03-05 12:40 ` Andrew Cooper
2026-03-05 14:04 ` Yao Zi
2026-03-05 14:10 ` Andrew Cooper
2026-03-05 14:11 ` David Laight
2026-03-05 16:20 ` Dave Hansen
2026-03-12 2:14 ` Tony W Wang-oc
2026-03-12 15:52 ` Dave Hansen
2026-03-17 7:41 ` Tony W Wang-oc
2026-03-17 15:21 ` Dave Hansen
2026-03-18 3:44 ` Tony W Wang-oc
-- strict thread matches above, loose matches on Subject: below --
2026-03-05 20:26 Christian Ludloff
2026-03-12 2:18 ` Tony W Wang-oc
2026-03-12 16:31 ` Christian Ludloff
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=aaQGgQOyU877bT1L@pie \
--to=me@ziyao.cc \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@kernel.org \
--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