mirror_ubuntu-kernels/arch/x86/kernel/cpu/mcheck
Huang Ying ef41df4344 x86, mce: fix a race condition in mce_read()
Impact: bugfix

Considering the situation as follow:

before: mcelog.next == 1, mcelog.entry[0].finished = 1

+--------------------------------------------------------------------------
R                   W1                  W2                  W3

read mcelog.next (1)
                    mcelog.next++ (2)
                    (working on entry 1,
                    finished == 0)

mcelog.next = 0
                                        mcelog.next++ (1)
                                        (working on entry 0)
                                                           mcelog.next++ (2)
                                                           (working on entry 1)
                        <----------------- race ---------------->
                    (done on entry 1,
                    finished = 1)
                                                           (done on entry 1,
                                                           finished = 1)

To fix the race condition, a cmpxchg loop is added to mce_read() to
ensure no new MCE record can be added between mcelog.next reading and
mcelog.next = 0.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-02-17 15:33:05 -08:00
..
k7.c Update email addresses. 2008-10-20 12:50:03 -07:00
Makefile x86: consolidate the cpu/ related code usage 2007-10-23 22:37:23 +02:00
mce_32.c x86, mce: don't disable machine checks during code patching 2009-02-17 15:32:38 -08:00
mce_64.c x86, mce: fix a race condition in mce_read() 2009-02-17 15:33:05 -08:00
mce_amd_64.c x86: fix section mismatch warnings in mcheck/mce_amd_64.c 2009-01-07 12:23:35 +01:00
mce_intel_64.c x86: hardirq: use inc_irq_stat() in non-unified functions 2008-12-16 22:30:19 +01:00
mce.h x86: remove all definitions with fastcall 2008-01-30 13:31:17 +01:00
non-fatal.c Update email addresses. 2008-10-20 12:50:03 -07:00
p4.c x86: APIC: remove apic_write_around(); use alternatives 2008-07-18 12:51:21 +02:00
p5.c x86: update Alan Cox's email addresses 2009-01-05 15:19:16 +01:00
p6.c x86: update Alan Cox's email addresses 2009-01-05 15:19:16 +01:00
therm_throt.c sysdev: Pass the attribute to the low level sysdev show/store function 2008-07-21 21:55:02 -07:00
winchip.c x86: update Alan Cox's email addresses 2009-01-05 15:19:16 +01:00