mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/mce: Don't print all MCEs when mcelog is active
@ 2017-03-24  0:31 Andi Kleen
  2017-03-24  9:02 ` Borislav Petkov
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2017-03-24  0:31 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, bp, tony.luck, Andi Kleen, stable

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

Since

cd9c57c x86/MCE: Dump MCE to dmesg if no consumers

in 4.9 all MCEs are printed even when mcelog is running. This fixes
this regression to not print again when mcelog is running, because it
already takes care of the logging.

This was hit by a lot of people, so it's good to fix this regression again.

Cc: stable@vger.kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 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 537c6647d84c..036fc03aefbd 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -54,6 +54,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() && \
@@ -601,6 +603,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;
@@ -1871,7 +1877,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.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/mce: Don't print all MCEs when mcelog is active
  2017-03-24  0:31 [PATCH] x86/mce: Don't print all MCEs when mcelog is active Andi Kleen
@ 2017-03-24  9:02 ` Borislav Petkov
  0 siblings, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2017-03-24  9:02 UTC (permalink / raw)
  To: Andi Kleen; +Cc: x86, linux-kernel, tony.luck, Andi Kleen, stable

On Thu, Mar 23, 2017 at 05:31:40PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> Since
> 
> cd9c57c x86/MCE: Dump MCE to dmesg if no consumers
> 
> in 4.9 all MCEs are printed even when mcelog is running. This fixes

That's 4.10.

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] x86/mce: Don't print all MCEs when mcelog is active
@ 2017-03-11  1:30 Andi Kleen
  0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2017-03-11  1:30 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Andi Kleen

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

Since

cd9c57c x86/MCE: Dump MCE to dmesg if no consumers

in 4.9 all MCEs are printed even when mcelog is running. This fixes
the code again to not print when mcelog is running, because it
already takes care of the logging and predicting.

This fixes spamming all xterms for corrected errors which
is really not needed.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 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 537c6647d84c..036fc03aefbd 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -54,6 +54,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() && \
@@ -601,6 +603,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;
@@ -1871,7 +1877,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.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-24  9:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24  0:31 [PATCH] x86/mce: Don't print all MCEs when mcelog is active Andi Kleen
2017-03-24  9:02 ` Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2017-03-11  1:30 Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®