Skip to content
Snippets Groups Projects
Commit 43e77bbb authored by Dan Schatzberg's avatar Dan Schatzberg Committed by Pekka Enberg
Browse files

x64: Fix rare SMP deadlock when acquiring stack


The SMP bringup code uses a linked list of stacks. The APs are all
brought up concurrently and so to acquire a stack, they compare and swap
on smp_stack_free. The current code works as long as the compare and
swap succeeds, if it fails, then smp_stack_free MUST be read again
otherwise the AP will be deadlocked. This patch fixes the current code
by enforcing a re-read on a cmpxchg failure.

Reviewed-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
Signed-off-by: default avatarDan Schatzberg <schatzberg.dan@gmail.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent cd987b50
No related branches found
No related tags found
No related merge requests found
......@@ -175,8 +175,8 @@ trlock: .byte 0
smpboot64:
mov smpboot_cr3, %rax
mov %rax, %cr3
mov smp_stack_free, %rax
1:
mov smp_stack_free, %rax
mov 4096(%rax), %rbx
lock cmpxchg %rbx, smp_stack_free
jnz 1b
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment