From: Borislav Petkov <bp@alien8.de>
To: Jue Wang <juew@google.com>
Cc: Tony Luck <tony.luck@intel.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
patches@lists.linux.dev
Subject: Re: [RFC] x86/mce: Add workaround for SKX/CLX/CPX spurious machine checks
Date: Mon, 7 Feb 2022 19:52:56 +0100 [thread overview]
Message-ID: <YgFqiJOU5tZsHbY6@zn.tnic> (raw)
In-Reply-To: <20220207043640.2829295-1-juew@google.com>
And while you're working in Tony's request...
On Sun, Feb 06, 2022 at 08:36:40PM -0800, Jue Wang wrote:
> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> index 5818b837fd4d..06001e3b2ff2 100644
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -834,6 +834,57 @@ static void quirk_sandybridge_ifu(int bank, struct mce *m, struct pt_regs *regs)
> m->cs = regs->cs;
> }
>
> +static bool is_intel_srar(u64 mci_status)
You don't need this separate function - stick it all in quirk_skylake_repmov()
> + return (mci_status &
> + (MCI_STATUS_VAL|MCI_STATUS_OVER|MCI_STATUS_UC|MCI_STATUS_EN|
> + MCI_STATUS_ADDRV|MCI_STATUS_MISCV|MCI_STATUS_PCC|
> + MCI_STATUS_AR|MCI_STATUS_S)) ==
> + (MCI_STATUS_VAL|MCI_STATUS_UC|MCI_STATUS_EN|MCI_STATUS_ADDRV|
> + MCI_STATUS_MISCV|MCI_STATUS_AR|MCI_STATUS_S);
> +}
> +
> +/*
> + * Disable fast string copy and return from the MCE handler upon the first SRAR
> + * MCE on bank 1 due to a CPU erratum on Intel SKX/CLX/CPL CPUs.
> + * The fast string copy instructions ("rep movs*") could consume an
> + * uncorrectable memory error in the cache line _right after_ the
> + * desired region to copy and raise an MCE with RIP pointing to the
> + * instruction _after_ the "rep movs*".
> + * This mitigation addresses the issue completely with the caveat of
> + * performance degradation on the CPU affected. This is still better
> + * than the OS crashes on MCEs raised on an irrelevant process due to
> + * 'rep movs*' accesses in a kernel context (e.g., copy_page).
> + * Since a host drain / fail-over usually starts right after the first
> + * MCE is signaled, which results in VM migration or termination, the
> + * performance degradation is a transient effect.
> + *
> + * Returns true when fast string copy on cpu should be disabled.
> + */
> +static bool quirk_skylake_repmov(void)
> +{
> + /*
> + * State that represents if an SRAR MCE has already signaled on the DCU bank.
> + */
> + static DEFINE_PER_CPU(bool, srar_dcu_signaled);
What's that needed for?
If the MSR write below clears the CPUID bit, you clear the corresponding
X86_FEATURE flag. And this test becomes a X86_FEATURE flag test:
if (this_cpu_has(X86_FEATURE_FSRM))
I'd guess...
> + if (unlikely(!__this_cpu_read(srar_dcu_signaled))) {
> + u64 mc1_status = mce_rdmsrl(MSR_IA32_MCx_STATUS(1));
> +
> + if (is_intel_srar(mc1_status)) {
> + __this_cpu_write(srar_dcu_signaled, true);
> + msr_clear_bit(MSR_IA32_MISC_ENABLE,
> + MSR_IA32_MISC_ENABLE_FAST_STRING_BIT);
> + mce_wrmsrl(MSR_IA32_MCG_STATUS, 0);
> + mce_wrmsrl(MSR_IA32_MCx_STATUS(1), 0);
> + pr_err("First SRAR MCE on DCU, CPU: %d, disable fast string copy.\n",
That error message can be understood probably only by a handful dozen of
people on the planet. Is it write-only or is it supposed to be consumed
by humans and if so, what would be the use case?
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2022-02-07 18:58 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 4:36 Jue Wang
2022-02-07 18:23 ` Luck, Tony
2022-02-07 18:52 ` Borislav Petkov [this message]
2022-02-07 19:24 ` Luck, Tony
2022-02-07 20:27 ` Borislav Petkov
2022-02-07 21:07 ` Luck, Tony
2022-02-07 21:20 ` Borislav Petkov
2022-02-07 21:51 ` Luck, Tony
2022-02-08 15:04 ` Jue Wang
2022-02-08 15:09 ` [PATCH] " Jue Wang
2022-02-11 20:08 ` Jue Wang
2022-02-11 20:18 ` Borislav Petkov
2022-02-11 20:23 ` Jue Wang
2022-02-15 18:42 ` Luck, Tony
2022-02-15 22:08 ` Borislav Petkov
2022-02-15 22:22 ` Luck, Tony
2022-02-16 10:28 ` Borislav Petkov
2022-02-16 15:50 ` Jue Wang
2022-02-16 18:02 ` Borislav Petkov
2022-02-16 18:41 ` Luck, Tony
2022-02-16 18:52 ` Borislav Petkov
2022-02-16 18:58 ` Luck, Tony
2022-02-16 18:59 ` Jue Wang
2022-02-16 21:53 ` [PATCH] x86/mce: work around an erratum on fast string copy instructions Jue Wang
2022-02-17 16:30 ` Borislav Petkov
2022-02-17 16:32 ` Borislav Petkov
2022-02-18 1:32 ` [PATCH v2] " Jue Wang
2022-02-18 15:07 ` Borislav Petkov
2022-02-18 16:03 ` Jue Wang
2022-02-18 16:14 ` Borislav Petkov
2022-02-18 16:21 ` Jue Wang
2022-02-18 17:16 ` Borislav Petkov
2022-02-18 17:39 ` Jue Wang
[not found] ` <CAPcxDJ7=hCz6KRih4OBVv-k8WLcBL4n+VSpeP_zky7Uunq89zg@mail.gmail.com>
2022-02-18 22:05 ` Borislav Petkov
2022-02-18 22:38 ` Luck, Tony
2022-02-18 22:58 ` Borislav Petkov
2022-02-18 17:58 ` Luck, Tony
2022-02-19 18:09 ` [tip: ras/core] x86/mce: Work " tip-bot2 for Jue Wang
2022-02-16 5:40 ` [PATCH] x86/mce: Add workaround for SKX/CLX/CPX spurious machine checks Jue Wang
2022-02-16 5:56 ` [PATCH] x86/mce: work around an erratum on fast string copy instructions Jue Wang
2022-02-16 9:04 ` David Laight
2022-02-16 15:33 ` Jue Wang
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=YgFqiJOU5tZsHbY6@zn.tnic \
--to=bp@alien8.de \
--cc=juew@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=tony.luck@intel.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
all inboxes | Powered by JetHome®