* [v4,1/2] x86/MCE: Add function to allow filtering of MCA errors
@ 2019-03-25 16:34 Yazen Ghannam
0 siblings, 0 replies; 5+ messages in thread
From: Yazen Ghannam @ 2019-03-25 16:34 UTC (permalink / raw)
To: linux-edac@vger.kernel.org
Cc: Ghannam, Yazen, linux-kernel@vger.kernel.org, bp@suse.de,
tony.luck@intel.com, x86@kernel.org, rafal@milecki.pl,
clemej@gmail.com
From: Yazen Ghannam <yazen.ghannam@amd.com>
Some systems may report spurious MCA errors. In general, spurious MCA
errors may be disabled by clearing a particular bit in MCA_CTL. However,
clearing a bit in MCA_CTL may not be recommended for some errors, so the
only option is to ignore them.
An MCA error is printed and handled after it has been added to the MCE
event pool. So an MCA error can be ignored by not adding it to the pool.
Define a default function that does not filter any errors.
Check if an MCA error should be filtered out when adding it to the MCE
event pool.
Cc: <stable@vger.kernel.org> # 5.0.x
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
Link:
https://lkml.kernel.org/r/20190322202848.20749-1-Yazen.Ghannam@amd.com
v3->v4:
* No change.
v2->v3:
* Define a regular function rather than function pointer.
* Update comment in header file.
v1->v2:
* This is a new patch replacing V1 Patch 1 which is no longer needed.
arch/x86/include/asm/mce.h | 3 +++
arch/x86/kernel/cpu/mce/core.c | 5 +++++
arch/x86/kernel/cpu/mce/genpool.c | 3 +++
3 files changed, 11 insertions(+)
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index dc2d4b206ab7..446919cb4ca8 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -243,6 +243,9 @@ extern void mce_disable_bank(int bank);
extern void (*machine_check_vector)(struct pt_regs *, long error_code);
void do_machine_check(struct pt_regs *, long);
+/* Decide whether to add MCE record to MCE event pool or filter it out. */
+extern bool filter_mce(struct mce *m);
+
/*
* Threshold handler
*/
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index b7fb541a4873..12d61b8f8154 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -1771,6 +1771,11 @@ static void __mcheck_cpu_init_timer(void)
mce_start_timer(t);
}
+bool filter_mce(struct mce *m)
+{
+ return false;
+}
+
/* Handle unconfigured int18 (should never happen) */
static void unexpected_machine_check(struct pt_regs *regs, long error_code)
{
diff --git a/arch/x86/kernel/cpu/mce/genpool.c b/arch/x86/kernel/cpu/mce/genpool.c
index 3395549c51d3..64d1d5a00f39 100644
--- a/arch/x86/kernel/cpu/mce/genpool.c
+++ b/arch/x86/kernel/cpu/mce/genpool.c
@@ -99,6 +99,9 @@ int mce_gen_pool_add(struct mce *mce)
{
struct mce_evt_llist *node;
+ if (filter_mce(mce))
+ return -EINVAL;
+
if (!mce_evt_pool)
return -EINVAL;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [v4,1/2] x86/MCE: Add function to allow filtering of MCA errors
@ 2019-03-26 7:56 Borislav Petkov
0 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2019-03-26 7:56 UTC (permalink / raw)
To: Ghannam, Yazen
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
tony.luck@intel.com, x86@kernel.org, rafal@milecki.pl,
clemej@gmail.com
On Mon, Mar 25, 2019 at 04:34:22PM +0000, Ghannam, Yazen wrote:
> From: Yazen Ghannam <yazen.ghannam@amd.com>
>
> Some systems may report spurious MCA errors. In general, spurious MCA
> errors may be disabled by clearing a particular bit in MCA_CTL. However,
> clearing a bit in MCA_CTL may not be recommended for some errors, so the
> only option is to ignore them.
>
> An MCA error is printed and handled after it has been added to the MCE
> event pool. So an MCA error can be ignored by not adding it to the pool.
>
> Define a default function that does not filter any errors.
>
> Check if an MCA error should be filtered out when adding it to the MCE
> event pool.
>
> Cc: <stable@vger.kernel.org> # 5.0.x
The old version of the patches had 4.14.x here as a kernel version. Why
change?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [v4,1/2] x86/MCE: Add function to allow filtering of MCA errors
@ 2019-03-26 9:28 Borislav Petkov
0 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2019-03-26 9:28 UTC (permalink / raw)
To: rafal@milecki.pl, clemej@gmail.com
Cc: Ghannam, Yazen, linux-edac@vger.kernel.org,
linux-kernel@vger.kernel.org, tony.luck@intel.com, x86@kernel.org
On Mon, Mar 25, 2019 at 04:34:22PM +0000, Ghannam, Yazen wrote:
> From: Yazen Ghannam <yazen.ghannam@amd.com>
>
> Some systems may report spurious MCA errors. In general, spurious MCA
> errors may be disabled by clearing a particular bit in MCA_CTL. However,
> clearing a bit in MCA_CTL may not be recommended for some errors, so the
> only option is to ignore them.
Ok, I cleaned those up and applied them here:
https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git/log/?h=tip-x86-urgent-ras
Rafał, John, can you guys test them pls?
Thx.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [v4,1/2] x86/MCE: Add function to allow filtering of MCA errors
@ 2019-03-26 11:41 Yazen Ghannam
0 siblings, 0 replies; 5+ messages in thread
From: Yazen Ghannam @ 2019-03-26 11:41 UTC (permalink / raw)
To: Borislav Petkov
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
tony.luck@intel.com, x86@kernel.org, rafal@milecki.pl,
clemej@gmail.com
> -----Original Message-----
> From: linux-edac-owner@vger.kernel.org <linux-edac-owner@vger.kernel.org> On Behalf Of Borislav Petkov
> Sent: Tuesday, March 26, 2019 2:57 AM
> To: Ghannam, Yazen <Yazen.Ghannam@amd.com>
> Cc: linux-edac@vger.kernel.org; linux-kernel@vger.kernel.org; tony.luck@intel.com; x86@kernel.org; rafal@milecki.pl;
> clemej@gmail.com
> Subject: Re: [PATCH v4 1/2] x86/MCE: Add function to allow filtering of MCA errors
>
> On Mon, Mar 25, 2019 at 04:34:22PM +0000, Ghannam, Yazen wrote:
> > From: Yazen Ghannam <yazen.ghannam@amd.com>
> >
> > Some systems may report spurious MCA errors. In general, spurious MCA
> > errors may be disabled by clearing a particular bit in MCA_CTL. However,
> > clearing a bit in MCA_CTL may not be recommended for some errors, so the
> > only option is to ignore them.
> >
> > An MCA error is printed and handled after it has been added to the MCE
> > event pool. So an MCA error can be ignored by not adding it to the pool.
> >
> > Define a default function that does not filter any errors.
> >
> > Check if an MCA error should be filtered out when adding it to the MCE
> > event pool.
> >
> > Cc: <stable@vger.kernel.org> # 5.0.x
>
> The old version of the patches had 4.14.x here as a kernel version. Why
> change?
>
They don't apply cleanly to v4.14 anymore because of the recent header change.
I figured they would need to be fixed up and submitted separately to older stable
versions. Is that okay?
Thanks,
Yazen
^ permalink raw reply [flat|nested] 5+ messages in thread
* [v4,1/2] x86/MCE: Add function to allow filtering of MCA errors
@ 2019-03-26 15:47 Borislav Petkov
0 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2019-03-26 15:47 UTC (permalink / raw)
To: Ghannam, Yazen
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
tony.luck@intel.com, x86@kernel.org, rafal@milecki.pl,
clemej@gmail.com
On Tue, Mar 26, 2019 at 11:41:05AM +0000, Ghannam, Yazen wrote:
> They don't apply cleanly to v4.14 anymore because of the recent header change.
>
> I figured they would need to be fixed up and submitted separately to older stable
> versions. Is that okay?
Ah yes, right.
Thx.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-26 15:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-26 15:47 [v4,1/2] x86/MCE: Add function to allow filtering of MCA errors Borislav Petkov
-- strict thread matches above, loose matches on Subject: below --
2019-03-26 11:41 Yazen Ghannam
2019-03-26 9:28 Borislav Petkov
2019-03-26 7:56 Borislav Petkov
2019-03-25 16:34 Yazen Ghannam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox