aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorZwane Mwaikambo <zwane@arm.linux.org.uk>2005-01-11 01:51:57 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-11 01:51:57 -0800
commitffc8a499efb64e72fe76d5454ec6abc5c22f8556 (patch)
tree38746440eb41fa0ed1130fecbcd6dbf1e8954fa2 /arch
parentbbb4828f1400f563571da6e7f65d8b828249dea5 (diff)
downloadhistory-ffc8a499efb64e72fe76d5454ec6abc5c22f8556.tar.gz
[PATCH] x86_64: Notify user of MCE events.
x86_64 uses a userspace mce utility to decode MCEs, this patch will ensure that the user is notified of MCE events being logged too. Signed-off-by: Zwane Mwaikambo <zwane@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/kernel/mce.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 6e717e4704602b..b05d3b19278d5e 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -31,6 +31,8 @@ static int mce_dont_init;
static int tolerant = 1;
static int banks;
static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL };
+static unsigned long console_logged;
+static int notify_user;
/*
* Lockless MCE logging infrastructure.
@@ -68,6 +70,9 @@ void mce_log(struct mce *mce)
smp_wmb();
mcelog.entry[entry].finished = 1;
smp_wmb();
+
+ if (!test_and_set_bit(0, &console_logged))
+ notify_user = 1;
}
static void print_mce(struct mce *m)
@@ -252,6 +257,19 @@ static void mcheck_timer(void *data)
{
on_each_cpu(mcheck_check_cpu, NULL, 1, 1);
schedule_delayed_work(&mcheck_work, check_interval * HZ);
+
+ /*
+ * It's ok to read stale data here for notify_user and
+ * console_logged as we'll simply get the updated versions
+ * on the next mcheck_timer execution and atomic operations
+ * on console_logged act as synchronization for notify_user
+ * writes.
+ */
+ if (notify_user && console_logged) {
+ notify_user = 0;
+ clear_bit(0, &console_logged);
+ printk(KERN_INFO "Machine check events logged\n");
+ }
}