Skip to content

Commit cc66afe

Browse files
Andi KleenIngo Molnar
authored andcommitted
x86/mce: Don't print MCEs when mcelog is active
Since: cd9c57c ("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 <[email protected]> [ Massage commit message. ] Signed-off-by: Borislav Petkov <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Cc: linux-edac <[email protected]> Cc: [email protected] # 4.10.. Fixes: cd9c57c ("x86/MCE: Dump MCE to dmesg if no consumers") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent ad0376e commit cc66afe

File tree

1 file changed

+6
-1
lines changed
  • arch/x86/kernel/cpu/mcheck

1 file changed

+6
-1
lines changed

arch/x86/kernel/cpu/mcheck/mce.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454

5555
static DEFINE_MUTEX(mce_chrdev_read_mutex);
5656

57+
static int mce_chrdev_open_count; /* #times opened */
58+
5759
#define mce_log_get_idx_check(p) \
5860
({ \
5961
RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held() && \
@@ -598,6 +600,10 @@ static int mce_default_notifier(struct notifier_block *nb, unsigned long val,
598600
if (atomic_read(&num_notifiers) > 2)
599601
return NOTIFY_DONE;
600602

603+
/* Don't print when mcelog is running */
604+
if (mce_chrdev_open_count > 0)
605+
return NOTIFY_DONE;
606+
601607
__print_mce(m);
602608

603609
return NOTIFY_DONE;
@@ -1828,7 +1834,6 @@ void mcheck_cpu_clear(struct cpuinfo_x86 *c)
18281834
*/
18291835

18301836
static DEFINE_SPINLOCK(mce_chrdev_state_lock);
1831-
static int mce_chrdev_open_count; /* #times opened */
18321837
static int mce_chrdev_open_exclu; /* already open exclusive? */
18331838

18341839
static int mce_chrdev_open(struct inode *inode, struct file *file)

0 commit comments

Comments
 (0)