lkml.org 
[lkml]   [2011]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 8/8] x86, mce, edac: call edac_mce_parse() once per a record
There is no reason to keep it in the cmpxchg loop.
(The loop continues until mcelog acquires buffer to save the record)

And use do-while for the loop here.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
arch/x86/kernel/cpu/mcheck/mce.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index bc8a02c..f1d8ce1 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -148,21 +148,21 @@ void mce_log(struct mce *mce)
/* Emit the trace record: */
trace_mce_record(mce);

+ /*
+ * If edac_mce is enabled, it will check the error type and will
+ * process it, if it is a known error.
+ * Otherwise, the error will be sent through mcelog interface.
+ */
+ if (edac_mce_parse(mce))
+ return;
+
mce->finished = 0;
wmb();
- for (;;) {
+
+ do {
entry = rcu_dereference_check_mce(mcelog.next);
for (;;) {
/*
- * If edac_mce is enabled, it will check the error type
- * and will process it, if it is a known error.
- * Otherwise, the error will be sent through mcelog
- * interface
- */
- if (edac_mce_parse(mce))
- return;
-
- /*
* When the buffer fills up discard new entries.
* Assume that the earlier errors are the more
* interesting ones:
@@ -181,10 +181,10 @@ void mce_log(struct mce *mce)
}
smp_rmb();
next = entry + 1;
- if (cmpxchg(&mcelog.next, entry, next) == entry)
- break;
- }
+ } while (cmpxchg(&mcelog.next, entry, next) != entry);
+
memcpy(mcelog.entry + entry, mce, sizeof(struct mce));
+
wmb();
mcelog.entry[entry].finished = 1;
wmb();
--
1.7.1



\
 
 \ /
  Last update: 2011-06-17 10:53    [from the cache]
©2003-2011 Jasper Spaans