Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jan 2026 19:23:00 +0000
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a50789d8b89b - stable/15 - powerpc: put the isync inside the TD_LOCK() checking loop
Message-ID:  <6963f894.3d6c2.4880f123@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by adrian:

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

commit a50789d8b89bd32199c6a9bf75b48ed8dee1e70d
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2026-01-03 22:52:14 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-01-11 19:21:52 +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
    
    (cherry picked from commit 8df2e542146801fd01675e56724eaa567d04c209)
---
 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 */


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6963f894.3d6c2.4880f123>