Skip to contentSkip to conversation

riscv: Report dying CPU to RCU in IPI_CPU_STOP

PATCH New Guo Ren 1 participant 1 message Jun 22

Subsystems (2)
lore
Share & tools
lore

Guo Ren

author
#0 lore raw

PATCH 1/1 riscv: Report dying CPU to RCU in IPI_CPU_STOP

From: "Guo Ren (Alibaba DAMO Academy)" <[email protected]>

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 Huacai Chen <[email protected]>
Cc Jonas Jelonek <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
Cc Sebastian Andrzej Siewior <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Jiayuan Chen <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes 91840be8f710 ("irq_work: Fix use-after-free in irq_work_single() on PREEMPT_RT")
---
 arch/riscv/kernel/smp.c | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/kernel/smp.c +1 -0
index fa66f9c97d74..0a73b36be825 100644
@@ -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();
 }
Signature · 1 line
2.43.0