]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
x86/MCE: Add an MCE-record filtering function
authorYazen Ghannam <yazen.ghannam@amd.com>
Wed, 3 Jul 2019 07:23:00 +0000 (09:23 +0200)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:56:02 +0000 (19:56 -0600)
BugLink: https://bugs.launchpad.net/bugs/1796443
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 <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "clemej@gmail.com" <clemej@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Pu Wen <puwen@hygon.cn>
Cc: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Cc: "rafal@milecki.pl" <rafal@milecki.pl>
Cc: Shirish S <Shirish.S@amd.com>
Cc: <stable@vger.kernel.org> # 5.0.x
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20190325163410.171021-1-Yazen.Ghannam@amd.com
(backported from commit 45d4b7b9cb88526f6d5bd4c03efab88d75d10e4f)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
arch/x86/kernel/cpu/mcheck/mce-genpool.c
arch/x86/kernel/cpu/mcheck/mce-internal.h
arch/x86/kernel/cpu/mcheck/mce.c

index 217cd4449bc9db3aedfd6367529bc9ca99fb8443..fe1e74d0fb5b0fce92998016f851587d5e9a29ad 100644 (file)
@@ -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;
 
index e956eb26706191d27447bc9feec2e9fbde5310c7..0eb5d12c6bd0687c05c2463cb34e123007fddaaf 100644 (file)
@@ -130,4 +130,7 @@ static inline void mce_unmap_kpfn(unsigned long pfn) {}
 #define mce_unmap_kpfn mce_unmap_kpfn
 #endif
 
+/* Decide whether to add MCE record to MCE event pool or filter it out. */
+extern bool filter_mce(struct mce *m);
+
 #endif /* __X86_MCE_INTERNAL_H__ */
index 851b209c2f7d4559b72bc3a5970b0cb22e48fde0..bd99ba35099099ba2b6168c8b4d7391163695613 100644 (file)
@@ -1766,6 +1766,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)
 {