Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86: Serialize SMP bootup CMOS accesses on rtc_lock

With CPU hotplug, there is a theoretical race between other CMOS
(namely RTC) accesses and those done in the SMP secondary
processor bringup path.

I am unware of the problem having been noticed by anyone in practice,
but it would very likely be rather spurious and very hard to reproduce.
So to be on the safe side, acquire rtc_lock around those accesses.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/4E257AE7020000780004E2FF@nat28.tlf.novell.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Jan Beulich and committed by
Ingo Molnar
ac619f4e 7e794cb7

+8
+8
arch/x86/include/asm/smpboot_hooks.h
··· 10 10 11 11 static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip) 12 12 { 13 + unsigned long flags; 14 + 15 + spin_lock_irqsave(&rtc_lock, flags); 13 16 CMOS_WRITE(0xa, 0xf); 17 + spin_unlock_irqrestore(&rtc_lock, flags); 14 18 local_flush_tlb(); 15 19 pr_debug("1.\n"); 16 20 *((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_high)) = ··· 27 23 28 24 static inline void smpboot_restore_warm_reset_vector(void) 29 25 { 26 + unsigned long flags; 27 + 30 28 /* 31 29 * Install writable page 0 entry to set BIOS data area. 32 30 */ ··· 38 32 * Paranoid: Set warm reset code and vector here back 39 33 * to default values. 40 34 */ 35 + spin_lock_irqsave(&rtc_lock, flags); 41 36 CMOS_WRITE(0, 0xf); 37 + spin_unlock_irqrestore(&rtc_lock, flags); 42 38 43 39 *((volatile u32 *)phys_to_virt(apic->trampoline_phys_low)) = 0; 44 40 }