Skip to contentSkip to conversation

sparc32: keep PIL raised on the SMP ticker and LEON IPI exit paths

PATCH In review Imre Kaloz 2 participants 2 messages Oct 16

Subsystems (2)
lore
Share & tools
lore

Imre Kaloz

author
#0 lore raw

PATCH v2 1/1 sparc32: keep PIL raised on the SMP ticker and LEON IPI exit paths

smp4m_ticker returns from smp4m_percpu_timer_interrupt() by writing the interrupted %psr back with traps enabled, which drops PIL before RESTORE_ALL. A level 14 tick pending again at that point can be taken on top of the current trap frame, and back-to-back ticks can nest until the 8K kernel stack runs into thread_info. Keep PIL at 15 until rett restores the interrupted %psr, as real_irq_continue does.

smp4d_ticker and smpleon_ipi exit the same way and get the same change.

Broken since 2.1.36 (sun4m), 2.1.97 (sun4d) and 2.6.33 (LEON).

---

Notes:
No Fixes: tag: this has been broken since 2.1.36 on sun4m (as smp_ticker) and since 2.1.97 on sun4d, before the git history. The LEON exit came with smpleon_ticker in 8401707ff645 ("sparc,leon:
Sparc-Leon SMP support") in 2.6.33 and moved to smpleon_ipi in 3.0; a
Fixes: tag naming one commit would date all three sites to it.

Changes in v2:
- Shorten the exit-path comments (Andreas Larsson)

v1: https://lore.kernel.org/r/[email protected]

 arch/sparc/kernel/entry.S | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/sparc/kernel/entry.S +6 -3
index ea51ef52c952..7ceaa328a9e3 100644
@@ -252,7 +252,8 @@ smp4m_ticker:
 	WRITE_PAUSE
 	call	smp4m_percpu_timer_interrupt
 	 add	%sp, STACKFRAME_SZ, %o0
-	wr	%l0, PSR_ET, %psr
+	or	%l0, PSR_PIL, %g2	! keep PIL raised until rett
+	wr	%g2, PSR_ET, %psr
 	WRITE_PAUSE
 	RESTORE_ALL
 
@@ -353,7 +354,8 @@ smp4d_ticker:
 	WRITE_PAUSE
 	call	smp4d_percpu_timer_interrupt
 	 add	%sp, STACKFRAME_SZ, %o0
-	wr	%l0, PSR_ET, %psr
+	or	%l0, PSR_PIL, %g2	! keep PIL raised until rett
+	wr	%g2, PSR_ET, %psr
 	WRITE_PAUSE
 	RESTORE_ALL
 
@@ -407,7 +409,8 @@ smpleon_ipi:
 	WRITE_PAUSE
 	call	leonsmp_ipi_interrupt
 	 add	%sp, STACKFRAME_SZ, %o1 ! pt_regs
-	wr	%l0, PSR_ET, %psr
+	or	%l0, PSR_PIL, %g2	! keep PIL raised until rett
+	wr	%g2, PSR_ET, %psr
 	WRITE_PAUSE
 	RESTORE_ALL
 

base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907

Signature · 1 line
2.47.3
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 67 lines · Imre Kaloz

smp4m_ticker returns from smp4m_percpu_timer_interrupt() by writing the interrupted %psr back with traps enabled, which drops PIL before RESTORE_ALL. A level 14 tick pending again at that point can be taken on top of the current trap frame, and back-to-back ticks can nest until the 8K kernel stack runs into thread_info. Keep PIL at 15 until rett restores the interrupted %psr, as real_irq_continue does.

smp4d_ticker and smpleon_ipi exit the same way and get the same change.

Broken since 2.1.36 (sun4m), 2.1.97 (sun4d) and 2.6.33 (LEON).

---

Notes:
No Fixes: tag: this has been broken since 2.1.36 on sun4m (as smp_ticker) and since 2.1.97 on sun4d, before the git history. The LEON exit came with smpleon_ticker in 8401707ff645 ("sparc,leon:
Sparc-Leon SMP support") in 2.6.33 and moved to smpleon_ipi in 3.0; a
Fixes: tag naming one commit would date all three sites to it.

Changes in v2:
- Shorten the exit-path comments (Andreas Larsson)

v1: https://lore.kernel.org/r/[email protected]

 arch/sparc/kernel/entry.S | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/sparc/kernel/entry.S +6 -3
index ea51ef52c952..7ceaa328a9e3 100644
@@ -252,7 +252,8 @@ smp4m_ticker:
 	WRITE_PAUSE
 	call	smp4m_percpu_timer_interrupt
 	 add	%sp, STACKFRAME_SZ, %o0
-	wr	%l0, PSR_ET, %psr
+	or	%l0, PSR_PIL, %g2	! keep PIL raised until rett
+	wr	%g2, PSR_ET, %psr
 	WRITE_PAUSE
 	RESTORE_ALL
 
@@ -353,7 +354,8 @@ smp4d_ticker:
 	WRITE_PAUSE
 	call	smp4d_percpu_timer_interrupt
 	 add	%sp, STACKFRAME_SZ, %o0
-	wr	%l0, PSR_ET, %psr
+	or	%l0, PSR_PIL, %g2	! keep PIL raised until rett
+	wr	%g2, PSR_ET, %psr
 	WRITE_PAUSE
 	RESTORE_ALL
 
@@ -407,7 +409,8 @@ smpleon_ipi:
 	WRITE_PAUSE
 	call	leonsmp_ipi_interrupt
 	 add	%sp, STACKFRAME_SZ, %o1 ! pt_regs
-	wr	%l0, PSR_ET, %psr
+	or	%l0, PSR_PIL, %g2	! keep PIL raised until rett
+	wr	%g2, PSR_ET, %psr
 	WRITE_PAUSE
 	RESTORE_ALL
 
Quoted 1 line

base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907

Picking this up to my for-next.

Thanks,
Andreas