aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-04-03 11:36:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-04-03 11:36:24 -0400
commit3ccfcdc9efe861983d26d56f1f0ecae3f61a3a09 (patch)
tree2dfa18f657e3e84a34f74f36aa0489eac7c8cda9
parenta71c9a1c779f2499fb2afc0553e543f18aff6edf (diff)
parentcc66afea58f858ff6da7f79b8a595a67bbb4f9a9 (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.c7
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
55static DEFINE_MUTEX(mce_chrdev_read_mutex); 55static DEFINE_MUTEX(mce_chrdev_read_mutex);
56 56
57static 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
1830static DEFINE_SPINLOCK(mce_chrdev_state_lock); 1836static DEFINE_SPINLOCK(mce_chrdev_state_lock);
1831static int mce_chrdev_open_count; /* #times opened */
1832static int mce_chrdev_open_exclu; /* already open exclusive? */ 1837static int mce_chrdev_open_exclu; /* already open exclusive? */
1833 1838
1834static int mce_chrdev_open(struct inode *inode, struct file *file) 1839static int mce_chrdev_open(struct inode *inode, struct file *file)