Skip to content

Commit

Permalink
Merge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/tip/tip

Pull RAS fix from Thomas Gleixner:
 "Prevent dmesg from being spammed when MCE logging is active"

* 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/mce: Don't print MCEs when mcelog is active
  • Loading branch information
torvalds committed Apr 3, 2017
2 parents a71c9a1 + cc66afe commit 3ccfcdc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/x86/kernel/cpu/mcheck/mce.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() && \
Expand Down Expand Up @@ -598,6 +600,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;
Expand Down Expand Up @@ -1828,7 +1834,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)
Expand Down

0 comments on commit 3ccfcdc

Please sign in to comment.