Messages in this thread Patch in this message | | | Date | Mon, 05 Oct 2009 15:41:23 +0900 | From | Hidetoshi Seto <> | Subject | [PATCH 08/10] x86, mce: change barriers in mce_log |
| |
Long time ago, smp_wmb() was replaced to wmb() by following commit: commit 7644143cd6f7e029f3a8ea64f5fb0ab33ec39f72 Author: Mike Waychison <mikew@google.com> Date: Fri Sep 30 00:01:27 2005 +0200 [PATCH] x86_64: Fix mce_log > AK: turned the smp_wmbs into true wmbs to make sure they are not > reordered by the compiler on UP.
Change them back to original form, and put comments.
(This piece originates from Huang's patch, titled: "x86, MCE: Fix bugs and issues of MCE log ring buffer")
Originally-From: Huang Ying <ying.huang@intel.com> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> --- arch/x86/kernel/cpu/mcheck/mce.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 87b2e29..655915b 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -141,8 +141,9 @@ void mce_log(struct mce *mce) struct mce_log_cpu *mcelog_cpu = &__get_cpu_var(mce_log_cpus); unsigned next, entry; + /* mce->finished must be set to 0 before written to buffer */ mce->finished = 0; - wmb(); + smp_wmb(); do { entry = mcelog_cpu->next; @@ -161,9 +162,12 @@ void mce_log(struct mce *mce) memcpy(mcelog_cpu->entry + entry, mce, sizeof(struct mce)); - wmb(); + /* ".finished" of MCE record in buffer must be set after copy */ + smp_wmb(); mcelog_cpu->entry[entry].finished = 1; - wmb(); + + /* bit 0 of notify_user should be set after finished be set */ + smp_wmb(); mce->finished = 1; set_bit(0, &mce_need_notify); } -- 1.6.4.3
| |