All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: X86 ML <x86@kernel.org>
Cc: linux-edac <linux-edac@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/6] x86/mce: Don't print MCEs when mcelog is active
Date: Mon, 27 Mar 2017 11:32:59 +0200	[thread overview]
Message-ID: <20170327093304.10683-2-bp@alien8.de> (raw)
In-Reply-To: <20170327093304.10683-1-bp@alien8.de>

From: Andi Kleen <ak@linux.intel.com>

Since

  cd9c57cad3fe ("x86/MCE: Dump MCE to dmesg if no consumers")

all MCEs are printed even when mcelog is running. Fix the regression to
not print to dmesg when mcelog is running as it is a consumer too.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: stable@vger.kernel.org # 4.10..
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: x86-ml <x86@kernel.org>
Fixes: cd9c57cad3fe ("x86/MCE: Dump MCE to dmesg if no consumers")
Link: http://lkml.kernel.org/r/20170324003140.26400-1-andi@firstfloor.org
[ Massage commit message. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/mcheck/mce.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 5e365a2fabe5..e95e02734f25 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -55,6 +55,8 @@
 
 static DEFINE_MUTEX(mce_chrdev_read_mutex);
 
+static int mce_chrdev_open_count;	/* #times opened */
+
 #define mce_log_get_idx_check(p) \
 ({ \
 	RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held() && \
@@ -599,6 +601,10 @@ static int mce_default_notifier(struct notifier_block *nb, unsigned long val,
 	if (atomic_read(&num_notifiers) > 2)
 		return NOTIFY_DONE;
 
+	/* Don't print when mcelog is running */
+	if (mce_chrdev_open_count > 0)
+		return NOTIFY_DONE;
+
 	__print_mce(m);
 
 	return NOTIFY_DONE;
@@ -1848,7 +1854,6 @@ void mcheck_cpu_clear(struct cpuinfo_x86 *c)
  */
 
 static DEFINE_SPINLOCK(mce_chrdev_state_lock);
-static int mce_chrdev_open_count;	/* #times opened */
 static int mce_chrdev_open_exclu;	/* already open exclusive? */
 
 static int mce_chrdev_open(struct inode *inode, struct file *file)
-- 
2.11.0

  reply	other threads:[~2017-03-27  9:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27  9:32 [PATCH 0/6] x86/RAS: Correctable Errors Collector Borislav Petkov
2017-03-27  9:32 ` Borislav Petkov [this message]
2017-03-28  7:01   ` [tip:ras/core] x86/mce: Don't print MCEs when mcelog is active tip-bot for Andi Kleen
2017-03-27  9:33 ` [PATCH 2/6] x86/MCE: Rename mce_log()'s argument Borislav Petkov
2017-03-28  7:01   ` [tip:ras/core] x86/mce: " tip-bot for Borislav Petkov
2017-03-27  9:33 ` [PATCH 3/6] x86/MCE: Rename mce_log to mce_log_buffer Borislav Petkov
2017-03-28  7:02   ` [tip:ras/core] x86/mce: " tip-bot for Borislav Petkov
2017-03-27  9:33 ` [PATCH 4/6] RAS: Add a Corrected Errors Collector Borislav Petkov
2017-03-28  7:02   ` [tip:ras/core] " tip-bot for Borislav Petkov
2017-03-27  9:33 ` [PATCH 5/6] x86/mce: Deprecate /dev/mcelog Borislav Petkov
2017-03-28  7:03   ` [tip:ras/core] x86/mce: Factor out and deprecate the /dev/mcelog driver tip-bot for Tony Luck
2017-03-27  9:33 ` [PATCH 6/6] x86/mce: Do not register notifiers with invalid prio Borislav Petkov
2017-03-28  7:04   ` [tip:ras/core] " tip-bot for Borislav Petkov

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=20170327093304.10683-2-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /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.