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

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] x86_64: Fix race in TSC synchronization

Plug a race in TSC synchronization

We need to do tsc_sync_wait() before the CPU is set online to prevent
multiple CPUs from doing it in parallel - which won't work because TSC
sync has global unprotected state.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Andi Kleen and committed by
Linus Torvalds
1eecd73c 5e5ec104

+8 -7
+8 -7
arch/x86_64/kernel/smpboot.c
··· 492 492 */ 493 493 set_cpu_sibling_map(smp_processor_id()); 494 494 495 + /* 496 + * Wait for TSC sync to not schedule things before. 497 + * We still process interrupts, which could see an inconsistent 498 + * time in that window unfortunately. 499 + * Do this here because TSC sync has global unprotected state. 500 + */ 501 + tsc_sync_wait(); 502 + 495 503 /* 496 504 * We need to hold call_lock, so there is no inconsistency 497 505 * between the time smp_call_function() determines number of ··· 516 508 cpu_set(smp_processor_id(), cpu_online_map); 517 509 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; 518 510 unlock_ipi_call_lock(); 519 - 520 - mb(); 521 - 522 - /* Wait for TSC sync to not schedule things before. 523 - We still process interrupts, which could see an inconsistent 524 - time in that window unfortunately. */ 525 - tsc_sync_wait(); 526 511 527 512 cpu_idle(); 528 513 }