diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-04-03 11:36:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-04-03 11:36:24 -0400 |
commit | 3ccfcdc9efe861983d26d56f1f0ecae3f61a3a09 (patch) | |
tree | 2dfa18f657e3e84a34f74f36aa0489eac7c8cda9 | |
parent | a71c9a1c779f2499fb2afc0553e543f18aff6edf (diff) | |
parent | cc66afea58f858ff6da7f79b8a595a67bbb4f9a9 (diff) |
Merge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/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
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 8e9725c607ea..5accfbdee3f0 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -54,6 +54,8 @@ | |||
54 | 54 | ||
55 | static DEFINE_MUTEX(mce_chrdev_read_mutex); | 55 | static DEFINE_MUTEX(mce_chrdev_read_mutex); |
56 | 56 | ||
57 | static int mce_chrdev_open_count; /* #times opened */ | ||
58 | |||
57 | #define mce_log_get_idx_check(p) \ | 59 | #define mce_log_get_idx_check(p) \ |
58 | ({ \ | 60 | ({ \ |
59 | RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held() && \ | 61 | RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held() && \ |
@@ -598,6 +600,10 @@ static int mce_default_notifier(struct notifier_block *nb, unsigned long val, | |||
598 | if (atomic_read(&num_notifiers) > 2) | 600 | if (atomic_read(&num_notifiers) > 2) |
599 | return NOTIFY_DONE; | 601 | return NOTIFY_DONE; |
600 | 602 | ||
603 | /* Don't print when mcelog is running */ | ||
604 | if (mce_chrdev_open_count > 0) | ||
605 | return NOTIFY_DONE; | ||
606 | |||
601 | __print_mce(m); | 607 | __print_mce(m); |
602 | 608 | ||
603 | return NOTIFY_DONE; | 609 | return NOTIFY_DONE; |
@@ -1828,7 +1834,6 @@ void mcheck_cpu_clear(struct cpuinfo_x86 *c) | |||
1828 | */ | 1834 | */ |
1829 | 1835 | ||
1830 | static DEFINE_SPINLOCK(mce_chrdev_state_lock); | 1836 | static DEFINE_SPINLOCK(mce_chrdev_state_lock); |
1831 | static int mce_chrdev_open_count; /* #times opened */ | ||
1832 | static int mce_chrdev_open_exclu; /* already open exclusive? */ | 1837 | static int mce_chrdev_open_exclu; /* already open exclusive? */ |
1833 | 1838 | ||
1834 | static int mce_chrdev_open(struct inode *inode, struct file *file) | 1839 | static int mce_chrdev_open(struct inode *inode, struct file *file) |