mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] irqchip/jcore-aic: Fix lost IPIs on SMP
@ 2026-09-28  3:54 Karl Mehltretter
  2026-09-28  5:57 ` John Paul Adrian Glaubitz
  2026-09-28 14:04 ` John Paul Adrian Glaubitz
  0 siblings, 2 replies; 6+ messages in thread
From: Karl Mehltretter @ 2026-09-28  3:54 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Karl Mehltretter, Marc Zyngier, Radu Rendec, Artur Rojek,
	Rich Felker, linux-sh, linux-kernel

Since commit bdf4e2ac295fe ("genirq: Allow per-cpu interrupt sharing for
non-overlapping affinities"), handle_percpu_devid_irq() only runs an
action whose affinity mask contains the current CPU. Only actions set up
through the percpu_devid request functions have such a mask.

handle_jcore_irq() passes every per-CPU interrupt to
handle_percpu_devid_irq(). The J2 IPI is not a percpu_devid interrupt.
j2_prepare_cpus() requests it with request_irq() and IRQF_PERCPU, so its
action has no affinity mask and cpumask_test_cpu() reads through a NULL
pointer. J2 has no MMU to catch this. The read returns whatever is at
address 0, the action is not found, and IPIs are dropped as spurious
("Spurious percpu IRQ20 on CPU1", printed once).

Pass only percpu_devid interrupts (the PIT) to handle_percpu_devid_irq()
and the other per-CPU interrupts to handle_percpu_irq() again, as before
commit d7e3fd658248f ("irqchip/jcore-aic, clocksource/drivers/jcore: Fix
jcore-pit interrupt request").

Found with a two-CPU J2 model simulated from the J-Core RTL. Without
this change the boot stalls with both CPUs idle shortly after
"smp: Brought up 1 node, 2 CPUs". With it, the boot reaches userspace.

Fixes: bdf4e2ac295fe ("genirq: Allow per-cpu interrupt sharing for non-overlapping affinities")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---

Notes:
    Tested on a two-CPU J2 model simulated from the J-Core RTL with
    Verilator (J2 CPUs, caches, bus mux and AIC1 from jcore-cpu/jcore-soc),
    kernel v7.3-rc4 j2_defconfig with SMP=y:
    
    - unpatched: "Spurious percpu IRQ20 on CPU1", pending IPI messages are
      never cleared (the message word of CPU1 grows to 0x6), boot stalls
      with both CPUs idle after SMP bring-up
    - patched: IPIs are handled, boot reaches userspace on both CPUs
    
    Not tested on J-Core hardware. Testing on real hardware is welcome.

 drivers/irqchip/irq-jcore-aic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-jcore-aic.c b/drivers/irqchip/irq-jcore-aic.c
index 94c05cf974be8..b4fee02997eee 100644
--- a/drivers/irqchip/irq-jcore-aic.c
+++ b/drivers/irqchip/irq-jcore-aic.c
@@ -37,8 +37,10 @@ static struct irq_chip jcore_aic;
 
 static void handle_jcore_irq(struct irq_desc *desc)
 {
-	if (irqd_is_per_cpu(irq_desc_get_irq_data(desc)))
+	if (irq_is_percpu_devid(irq_desc_get_irq(desc)))
 		handle_percpu_devid_irq(desc);
+	else if (irqd_is_per_cpu(irq_desc_get_irq_data(desc)))
+		handle_percpu_irq(desc);
 	else
 		handle_simple_irq(desc);
 }
-- 
2.53.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-28 14:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28  3:54 [PATCH] irqchip/jcore-aic: Fix lost IPIs on SMP Karl Mehltretter
2026-09-28  5:57 ` John Paul Adrian Glaubitz
2026-09-28  6:07   ` Karl Mehltretter
2026-09-28  6:42     ` John Paul Adrian Glaubitz
2026-09-28 13:40     ` John Paul Adrian Glaubitz
2026-09-28 14:04 ` John Paul Adrian Glaubitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®