Use xchg in Xcpustop to close a race and make cpustop_restartfunc truly
one-shot in the SMP case (before using the simple mov / cmp / mov sequence could allow multiple CPUs to execute the restart function on resume).
This commit is contained in:
parent
6b1e0d75b0
commit
95d84e5461
@ -297,10 +297,11 @@ IDTVEC(cpustop)
|
||||
test %eax, %eax
|
||||
jnz 2f
|
||||
|
||||
movq cpustop_restartfunc, %rax
|
||||
xorq %rax, %rax
|
||||
lock
|
||||
xchgq cpustop_restartfunc, %rax
|
||||
testq %rax, %rax
|
||||
jz 2f
|
||||
movq $0, cpustop_restartfunc /* One-shot */
|
||||
|
||||
call *%rax
|
||||
2:
|
||||
|
@ -340,10 +340,11 @@ IDTVEC(cpustop)
|
||||
test %eax, %eax
|
||||
jnz 2f
|
||||
|
||||
movl CNAME(cpustop_restartfunc), %eax
|
||||
xorl %eax, %eax
|
||||
lock
|
||||
xchgl CNAME(cpustop_restartfunc), %eax
|
||||
test %eax, %eax
|
||||
jz 2f
|
||||
movl $0, CNAME(cpustop_restartfunc) /* One-shot */
|
||||
|
||||
call *%eax
|
||||
2:
|
||||
|
Loading…
Reference in New Issue
Block a user