aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2026-01-03 22:52:14 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2026-01-04 02:27:48 +0000
commit8df2e542146801fd01675e56724eaa567d04c209 (patch)
tree5a535dc16eeb97615b2e48924b6018894afaf94e
parent17355cf50fcbd0d8ddb638e1f2fd5861b526edbe (diff)
powerpc: put the isync inside the TD_LOCK() checking loop
Fix a narrow window where the lock is unlocked but the checking CPU hasn't flushed things appropriately. Inside this window the CPU inside cpu_switch() will loop forever thinking the destination thread is still blocked/locked even though it is not. This manifests as the system hanging after starting all APs. I've seen this reliably trigger in qemu-system-ppc64 running power9 pseries guests; the more CPUs the more likely it triggers at boot. PR: kern/292167 Differential Revision: https://reviews.freebsd.org/D54478 Reviewed by: jhibbits MFC after: 1 week Relnotes: yes
-rw-r--r--sys/powerpc/powerpc/swtch32.S2
-rw-r--r--sys/powerpc/powerpc/swtch64.S2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/powerpc/powerpc/swtch32.S b/sys/powerpc/powerpc/swtch32.S
index 547e1c5a201b..ef1a397bf74d 100644
--- a/sys/powerpc/powerpc/swtch32.S
+++ b/sys/powerpc/powerpc/swtch32.S
@@ -141,8 +141,8 @@ cpu_switchin:
blocked_loop:
lwz %r7,TD_LOCK(%r2)
cmpw %r6,%r7
- beq- blocked_loop
isync
+ beq- blocked_loop
#endif
lwz %r17,TD_PCB(%r2) /* Get new current PCB */
diff --git a/sys/powerpc/powerpc/swtch64.S b/sys/powerpc/powerpc/swtch64.S
index 5f80751c8a10..ba37274d32bb 100644
--- a/sys/powerpc/powerpc/swtch64.S
+++ b/sys/powerpc/powerpc/swtch64.S
@@ -194,8 +194,8 @@ cpu_switchin:
blocked_loop:
ld %r7,TD_LOCK(%r13)
cmpd %r6,%r7
- beq- blocked_loop
isync
+ beq- blocked_loop
#endif
ld %r17,TD_PCB(%r13) /* Get new PCB */