Skip to contentSkip to conversation

x86/mce: Don't print all MCEs when mcelog is active

PATCH Applied Andi Kleen 2 participants 2 messages Mar 24, 2017

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 x86/mce: Don't print all MCEs when mcelog is active

From: Andi Kleen <[email protected]>

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.

---
 arch/x86/kernel/cpu/mcheck/mce.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +6 -1
index 537c6647d84c..036fc03aefbd 100644
@@ -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)
Signature · 1 line
2.9.3
#1 lore raw
Quoted 7 lines · Andi Kleen

From: Andi Kleen <[email protected]>

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.

Signature · 5 lines
Regards/Gruss,
    Boris.

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