All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Yazen Ghannam <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com,
	rafal@milecki.pl, tglx@linutronix.de, mingo@kernel.org,
	tony.luck@intel.com, hpa@zytor.com, Shirish.S@amd.com,
	arnd@arndb.de, vishal.l.verma@intel.com, puwen@hygon.cn,
	qiuxu.zhuo@intel.com, bp@suse.de, yazen.ghannam@amd.com,
	clemej@gmail.com
Subject: [tip:ras/core] x86/MCE: Add an MCE-record filtering function
Date: Tue, 23 Apr 2019 11:19:07 -0700	[thread overview]
Message-ID: <tip-45d4b7b9cb88526f6d5bd4c03efab88d75d10e4f@git.kernel.org> (raw)
In-Reply-To: <20190325163410.171021-1-Yazen.Ghannam@amd.com>

Commit-ID:  45d4b7b9cb88526f6d5bd4c03efab88d75d10e4f
Gitweb:     https://git.kernel.org/tip/45d4b7b9cb88526f6d5bd4c03efab88d75d10e4f
Author:     Yazen Ghannam <yazen.ghannam@amd.com>
AuthorDate: Mon, 25 Mar 2019 16:34:22 +0000
Committer:  Borislav Petkov <bp@suse.de>
CommitDate: Tue, 23 Apr 2019 18:04:47 +0200

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 <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
---
 arch/x86/kernel/cpu/mce/core.c     | 5 +++++
 arch/x86/kernel/cpu/mce/genpool.c  | 3 +++
 arch/x86/kernel/cpu/mce/internal.h | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 3e081428117c..80b8c6bff8ed 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -1775,6 +1775,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;
 
diff --git a/arch/x86/kernel/cpu/mce/internal.h b/arch/x86/kernel/cpu/mce/internal.h
index af5eab1e65e2..b822a645395d 100644
--- a/arch/x86/kernel/cpu/mce/internal.h
+++ b/arch/x86/kernel/cpu/mce/internal.h
@@ -173,4 +173,7 @@ struct mca_msr_regs {
 
 extern struct mca_msr_regs msr_ops;
 
+/* 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__ */

      parent reply	other threads:[~2019-04-23 18:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 16:34 [PATCH v4 1/2] x86/MCE: Add function to allow filtering of MCA errors Ghannam, Yazen
2019-03-25 16:34 ` [v4,1/2] " Yazen Ghannam
2019-03-25 16:34 ` [PATCH v4 2/2] x86/MCE/AMD: Don't report L1 BTB MCA errors on some Family 17h models Ghannam, Yazen
2019-03-25 16:34   ` [v4,2/2] " Yazen Ghannam
2019-03-27 19:19   ` [PATCH v4 2/2] " Thomas Gleixner
2019-03-27 19:19     ` [v4,2/2] " Thomas Gleixner
2019-03-27 19:29     ` [PATCH v4 2/2] " Borislav Petkov
2019-03-27 19:29       ` [v4,2/2] " Borislav Petkov
2019-03-27 19:37       ` [PATCH v4 2/2] " Thomas Gleixner
2019-03-27 19:37         ` [v4,2/2] " Thomas Gleixner
2019-04-23 18:19   ` [tip:ras/core] x86/MCE/AMD: Don't report L1 BTB MCA errors on some family " tip-bot for Yazen Ghannam
2019-04-23 18:19     ` tip-bot for Borislav Petkov
2019-03-26  7:56 ` [PATCH v4 1/2] x86/MCE: Add function to allow filtering of MCA errors Borislav Petkov
2019-03-26  7:56   ` [v4,1/2] " Borislav Petkov
2019-03-26 11:41   ` [PATCH v4 1/2] " Ghannam, Yazen
2019-03-26 11:41     ` [v4,1/2] " Yazen Ghannam
2019-03-26 15:47     ` [PATCH v4 1/2] " Borislav Petkov
2019-03-26 15:47       ` [v4,1/2] " Borislav Petkov
2019-03-26  9:28 ` [PATCH v4 1/2] " Borislav Petkov
2019-03-26  9:28   ` [v4,1/2] " Borislav Petkov
2019-04-23 18:19 ` tip-bot for Yazen Ghannam [this message]

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=tip-45d4b7b9cb88526f6d5bd4c03efab88d75d10e4f@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=Shirish.S@amd.com \
    --cc=arnd@arndb.de \
    --cc=bp@suse.de \
    --cc=clemej@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=puwen@hygon.cn \
    --cc=qiuxu.zhuo@intel.com \
    --cc=rafal@milecki.pl \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=vishal.l.verma@intel.com \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.