The branch main has been updated by adrian:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8df2e542146801fd01675e56724eaa567d04c209

commit 8df2e542146801fd01675e56724eaa567d04c209
Author:     Adrian Chadd <[email protected]>
AuthorDate: 2026-01-03 22:52:14 +0000
Commit:     Adrian Chadd <[email protected]>
CommitDate: 2026-01-04 02:27:48 +0000

    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
---
 sys/powerpc/powerpc/swtch32.S | 2 +-
 sys/powerpc/powerpc/swtch64.S | 2 +-
 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 */

Reply via email to