Skip to content

Commit 45d4b7b

Browse files
yghannamsuryasaimadhu
authored andcommitted
x86/MCE: Add an MCE-record filtering function
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 that pool in the first place. Add such a filtering function. [ bp: Move function prototype to the internal header and massage. ] Signed-off-by: Yazen Ghannam <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: "[email protected]" <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Pu Wen <[email protected]> Cc: Qiuxu Zhuo <[email protected]> Cc: "[email protected]" <[email protected]> Cc: Shirish S <[email protected]> Cc: <[email protected]> # 5.0.x Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Cc: Vishal Verma <[email protected]> Cc: x86-ml <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 09cbd21 commit 45d4b7b

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

arch/x86/kernel/cpu/mce/core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,6 +1775,11 @@ static void __mcheck_cpu_init_timer(void)
17751775
mce_start_timer(t);
17761776
}
17771777

1778+
bool filter_mce(struct mce *m)
1779+
{
1780+
return false;
1781+
}
1782+
17781783
/* Handle unconfigured int18 (should never happen) */
17791784
static void unexpected_machine_check(struct pt_regs *regs, long error_code)
17801785
{

arch/x86/kernel/cpu/mce/genpool.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ int mce_gen_pool_add(struct mce *mce)
9999
{
100100
struct mce_evt_llist *node;
101101

102+
if (filter_mce(mce))
103+
return -EINVAL;
104+
102105
if (!mce_evt_pool)
103106
return -EINVAL;
104107

arch/x86/kernel/cpu/mce/internal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,7 @@ struct mca_msr_regs {
173173

174174
extern struct mca_msr_regs msr_ops;
175175

176+
/* Decide whether to add MCE record to MCE event pool or filter it out. */
177+
extern bool filter_mce(struct mce *m);
178+
176179
#endif /* __X86_MCE_INTERNAL_H__ */

0 commit comments

Comments
 (0)