From: Dave Hansen <dave.hansen@intel.com>
To: Tina Zhang <zhang_wei@open-hieco.net>, x86@kernel.org
Cc: puwen@hygon.cn, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
linux-kernel@vger.kernel.org, yangzhen@hygon.cn,
dengqiming@hygon.cn, stable@vger.kernel.org
Subject: Re: [PATCH] x86/cpu/hygon: Work around XSAVES Erratum 1386
Date: Thu, 19 Nov 2026 07:28:49 -0800 [thread overview]
Message-ID: <4cabfb0e-c21d-4f73-9b41-9fb7eca5ea69@intel.com> (raw)
In-Reply-To: <20261028235712.383977-1-zhang_wei@open-hieco.net>
> +#define X86_MATCH_HYGON_MODEL_STEP_UCODE(model, step, ucode) \
> + X86_MATCH_VFM_STEPS(VFM_MAKE(X86_VENDOR_HYGON, 0x18, model), \
> + step, step, ucode)
> +
> +static const struct x86_cpu_id erratum_1386_microcode[] = {
> + X86_MATCH_HYGON_MODEL_STEP_UCODE(0x04, 0x00, 0x9040000f),
> + X86_MATCH_HYGON_MODEL_STEP_UCODE(0x04, 0x01, 0x9041000f),
> + X86_MATCH_HYGON_MODEL_STEP_UCODE(0x06, 0x00, 0x9060000f),
> + X86_MATCH_HYGON_MODEL_STEP_UCODE(0x06, 0x01, 0x9061000f),
> + X86_MATCH_HYGON_MODEL_STEP_UCODE(0x10, 0x00, 0x91000004),
> + {}
> +};
This part is good.
> +static void fix_erratum_1386(struct cpuinfo_x86 *c)
> +{
> + /*
> + * Affected processors enumerate no supervisor XSAVE state components,
> + * so XSAVEC is equivalent and is not affected by Erratum 1386.
> + * Disable XSAVES unless the microcode is known to contain the fix.
> + */
This comment is in the wrong place and is really hard to read. I think
you're somehow trying to say here that the kernel *COULD* just use
XSAVEC instead of XSAVES instead of disabling XSAVES.
But this isn't the place to litigate your solution. That's for the
changelog. This just needs to say what it does.
> + if (c->x86 != 0x18)
> + return;
> +
> + /* Models affected by Erratum 1386. */
> + switch (c->x86_model) {
> + case 0x00 ... 0x06:
> + case 0x10:
> + break;
> + default:
> + return;
> + }
This part is not.
Why do you need an explicit 0x18 check if there's already an implicit
one in x86_match_min_microcode_rev()? If there are unfixed
model/steppings, then list those too.
I also don't get what the switch statement does.
> + if (x86_match_min_microcode_rev(erratum_1386_microcode))
> + return;
> +
> + clear_cpu_cap(c, X86_FEATURE_XSAVES);
> +}
My overall suggestion is to do more in erratum_1386_microcode[] and less
in code.
prev parent reply other threads:[~2026-11-19 15:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 23:57 Tina Zhang
2026-11-19 15:28 ` Dave Hansen [this message]
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=4cabfb0e-c21d-4f73-9b41-9fb7eca5ea69@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dengqiming@hygon.cn \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=puwen@hygon.cn \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yangzhen@hygon.cn \
--cc=zhang_wei@open-hieco.net \
/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
all inboxes | Powered by JetHome®