The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] riscv: Report dying CPU to RCU in IPI_CPU_STOP
@ 2026-06-22 13:40 Guo Ren
  2026-12-01  1:42 ` Paul Walmsley
  0 siblings, 1 reply; 2+ messages in thread
From: Guo Ren @ 2026-06-22 13:40 UTC (permalink / raw)
  To: pjw, palmer, aou, alex, samuel.holland, tglx, bigeasy
  Cc: linux-riscv, linux-kernel, Guo Ren (Alibaba DAMO Academy), stable,
	Huacai Chen, Jonas Jelonek, Thomas Bogendoerfer, Steven Rostedt,
	Jiayuan Chen

From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>

This is a port of MIPS commit 9f3f3bdc6d9dac1 ("MIPS: smp: report
dying CPU to RCU in stop_this_cpu()") inspired by the Loongarch
mailing thread.

The smp_send_stop() parks all secondary CPUs in IPI_CPU_STOP, which
marks the CPU offline for the scheduler via set_cpu_online(false),
but never informs RCU, so RCU keeps expecting a quiescent state
from CPUs that are now spinning forever with interrupts disabled.

Please read the MIPS commit mentioned before for details.

Cc: stable@vger.kernel.org
Cc: Huacai Chen <chenhuacai@loongson.cn>
Cc: Jonas Jelonek <jelonek.jonas@gmail.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: Thomas Gleixner <tglx@kernel.org>
Fixes: 91840be8f710 ("irq_work: Fix use-after-free in irq_work_single() on PREEMPT_RT")
Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
---
 arch/riscv/kernel/smp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c
index fa66f9c97d74..0a73b36be825 100644
--- a/arch/riscv/kernel/smp.c
+++ b/arch/riscv/kernel/smp.c
@@ -82,6 +82,7 @@ int riscv_hartid_to_cpuid(unsigned long hartid)
 static void ipi_stop(void)
 {
 	set_cpu_online(smp_processor_id(), false);
+	rcutree_report_cpu_dead();
 	while (1)
 		wait_for_interrupt();
 }
-- 
2.43.0


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

* Re: [PATCH] riscv: Report dying CPU to RCU in IPI_CPU_STOP
  2026-06-22 13:40 [PATCH] riscv: Report dying CPU to RCU in IPI_CPU_STOP Guo Ren
@ 2026-12-01  1:42 ` Paul Walmsley
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Walmsley @ 2026-12-01  1:42 UTC (permalink / raw)
  To: Guo Ren
  Cc: pjw, palmer, aou, alex, samuel.holland, tglx, bigeasy,
	linux-riscv, linux-kernel, stable, Huacai Chen, Jonas Jelonek,
	Thomas Bogendoerfer, Steven Rostedt, Jiayuan Chen

On Mon, 22 Jun 2026, Guo Ren wrote:

> From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
> 
> This is a port of MIPS commit 9f3f3bdc6d9dac1 ("MIPS: smp: report
> dying CPU to RCU in stop_this_cpu()") inspired by the Loongarch
> mailing thread.
> 
> The smp_send_stop() parks all secondary CPUs in IPI_CPU_STOP, which
> marks the CPU offline for the scheduler via set_cpu_online(false),
> but never informs RCU, so RCU keeps expecting a quiescent state
> from CPUs that are now spinning forever with interrupts disabled.
> 
> Please read the MIPS commit mentioned before for details.

The MIPS commit message implies that this is a concern when 
arch_irq_work_has_interrupt() returns false.  This only happens on RISC-V 
when !CONFIG_SMP.  So I'm curious - were you able to observe the 
failure on RISC-V that was observed on MIPS?  

thanks,


- Paul

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

end of thread, other threads:[~2026-12-01  1:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 13:40 [PATCH] riscv: Report dying CPU to RCU in IPI_CPU_STOP Guo Ren
2026-12-01  1:42 ` Paul Walmsley

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