Re: [PATCH v3 1/2] x86/mce: new Centaur CPU support MCE broadcasting

From: Borislav Petkov
Date: Mon Apr 30 2018 - 05:42:28 EST


On Wed, Apr 25, 2018 at 06:33:39PM +0800, David Wang wrote:
> Newer Centaur multi-core CPU also support MCE broadcasting to all cores. But
> no Centaur special code tell this truth to kernel.
>
> Signed-off-by: David Wang <davidwang@xxxxxxxxxxx>
> ---
> arch/x86/kernel/cpu/mcheck/mce.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)

I applied this with some minor improvements:

---
From: David Wang <davidwang@xxxxxxxxxxx>
Date: Wed, 25 Apr 2018 18:33:39 +0800
Subject: [PATCH] x86/MCA: Enable MCE broadcasting on new Centaur CPUs

Newer Centaur multi-core CPUs also support MCE broadcasting to all
cores. Add a Centaur-specific init function setting that up.

[ bp:
- make mce_centaur_feature_init() static
- flip check to do the f/m/s first for better readability
- touch up text
]

Signed-off-by: David Wang <davidwang@xxxxxxxxxxx>
Cc: Greg KH <greg@xxxxxxxxx>
Cc: Tony Luck <tony.luck@xxxxxxxxx>
Cc: benjaminpan@xxxxxxxxxxx
Cc: brucechang@xxxxxxxxxxxxxxxx
Cc: cooperyan@xxxxxxxxxxx
Cc: lukelin@xxxxxxxxxx
Cc: qiyuanwang@xxxxxxxxxxx
Cc: timguo@xxxxxxxxxxx
Cc: x86-ml <x86@xxxxxxxxxx>
Cc: linux-edac <linux-edac@xxxxxxxxxxxxxxx>
Link: http://lkml.kernel.org/r/1524652420-17330-2-git-send-email-davidwang@xxxxxxxxxxx
Signed-off-by: Borislav Petkov <bp@xxxxxxx>
---
arch/x86/kernel/cpu/mcheck/mce.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 42cf2880d0ed..cd76380af79f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1727,6 +1727,21 @@ static void __mcheck_cpu_init_early(struct cpuinfo_x86 *c)
}
}

+static void mce_centaur_feature_init(struct cpuinfo_x86 *c)
+{
+ struct mca_config *cfg = &mca_cfg;
+
+ /*
+ * All newer Centaur CPUs support MCE broadcasting. Enable
+ * synchronization with a one second timeout.
+ */
+ if ((c->x86 == 6 && c->x86_model == 0xf && c->x86_stepping >= 0xe) ||
+ c->x86 > 6) {
+ if (cfg->monarch_timeout < 0)
+ cfg->monarch_timeout = USEC_PER_SEC;
+ }
+}
+
static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
{
switch (c->x86_vendor) {
@@ -1739,6 +1754,9 @@ static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
mce_amd_feature_init(c);
break;
}
+ case X86_VENDOR_CENTAUR:
+ mce_centaur_feature_init(c);
+ break;

default:
break;
--
2.13.0

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.