Skip to contentSkip to conversation

risc-v: Fix order of IPI enablement vs RCU startup

PATCH Applied Marc Zyngier 3 participants 5 messages Jul 3, 2023 – Jul 5, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 risc-v: Fix order of IPI enablement vs RCU startup

Conor reports that risc-v tries to enable IPIs before telling the core code to enable RCU. With the introduction of the mapple tree as a backing store for the irq descriptors, this results in a very shouty boot sequence, as RCU is legitimately upset.

Restore some sanity by moving the risc_ipi_enable() call after notify_cpu_starting(), which explicitly enables RCU on the calling CPU.

Fixes 832f15f42646 ("RISC-V: Treat IPIs as normal Linux IRQs")
Cc Anup Patel <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Linus Torvalds <[email protected]>
---
 arch/riscv/kernel/smpboot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/riscv/kernel/smpboot.c +3 -2
index bb0b76e1a6d4..f4d6acb38dd0 100644
@@ -238,10 +238,11 @@ asmlinkage __visible void smp_callin(void)
 	mmgrab(mm);
 	current->active_mm = mm;
 
-	riscv_ipi_enable();
-
 	store_cpu_topology(curr_cpuid);
 	notify_cpu_starting(curr_cpuid);
+
+	riscv_ipi_enable();
+
 	numa_add_cpu(curr_cpuid);
 	set_cpu_online(curr_cpuid, 1);
 	probe_vendor_features(curr_cpuid);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 28 lines · Marc Zyngier

Conor reports that risc-v tries to enable IPIs before telling the core code to enable RCU. With the introduction of the mapple tree as a backing store for the irq descriptors, this results in a very shouty boot sequence, as RCU is legitimately upset.

Restore some sanity by moving the risc_ipi_enable() call after notify_cpu_starting(), which explicitly enables RCU on the calling CPU.

Fixes 832f15f42646 ("RISC-V: Treat IPIs as normal Linux IRQs")
Cc Anup Patel <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Linus Torvalds <[email protected]>
---
 arch/riscv/kernel/smpboot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/riscv/kernel/smpboot.c +0 -0
index bb0b76e1a6d4..f4d6acb38dd0 100644
@@ -238,10 +238,11 @@ asmlinkage __visible void smp_callin(void)
 	mmgrab(mm);
 	current->active_mm = mm;
 

arch/riscv/kernel/smpboot.c asmlinkage __visible void smp_callin(void) · line 248

Quoted 10 lines
arch/riscv/kernel/smpboot.c +3 -2
-	riscv_ipi_enable();
-
 	store_cpu_topology(curr_cpuid);
 	notify_cpu_starting(curr_cpuid);
+
+	riscv_ipi_enable();
+
 	numa_add_cpu(curr_cpuid);
 	set_cpu_online(curr_cpuid, 1);
 	probe_vendor_features(curr_cpuid);

Thanks. I was going to send another PR this week anyway, I can just pick this up if you want? Either way I'll look, I've still got a few hiccups from trying to clean up my staging bits post-merge but hopefully it's not too bad...

#2 lore raw
Quoted 30 lines · Palmer Dabbelt
Quoted 28 lines · Marc Zyngier

Conor reports that risc-v tries to enable IPIs before telling the core code to enable RCU. With the introduction of the mapple tree as a backing store for the irq descriptors, this results in a very shouty boot sequence, as RCU is legitimately upset.

Restore some sanity by moving the risc_ipi_enable() call after notify_cpu_starting(), which explicitly enables RCU on the calling CPU.

Fixes 832f15f42646 ("RISC-V: Treat IPIs as normal Linux IRQs")
Cc Anup Patel <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Linus Torvalds <[email protected]>
---
 arch/riscv/kernel/smpboot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/riscv/kernel/smpboot.c +0 -0
index bb0b76e1a6d4..f4d6acb38dd0 100644
@@ -238,10 +238,11 @@ asmlinkage __visible void smp_callin(void)
 	mmgrab(mm);
 	current->active_mm = mm;
 
Quoted 13 lines

arch/riscv/kernel/smpboot.c asmlinkage __visible void smp_callin(void) · line 248

Quoted 10 lines
arch/riscv/kernel/smpboot.c +3 -2
-	riscv_ipi_enable();
-
 	store_cpu_topology(curr_cpuid);
 	notify_cpu_starting(curr_cpuid);
+
+	riscv_ipi_enable();
+
 	numa_add_cpu(curr_cpuid);
 	set_cpu_online(curr_cpuid, 1);
 	probe_vendor_features(curr_cpuid);

Thanks. I was going to send another PR this week anyway, I can just pick this up if you want?

Yes please!

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Tested-by on v1 1/1
#3 lore raw
In reply to Marc Zyngier
Quoted 11 lines · Marc Zyngier

Conor reports that risc-v tries to enable IPIs before telling the core code to enable RCU. With the introduction of the mapple tree as a backing store for the irq descriptors, this results in a very shouty boot sequence, as RCU is legitimately upset.

Restore some sanity by moving the risc_ipi_enable() call after notify_cpu_starting(), which explicitly enables RCU on the calling CPU.

Fixes 832f15f42646 ("RISC-V: Treat IPIs as normal Linux IRQs")

RCU no longer chucks the toys at least, and none of the wheels seem to have fallen off the pram in the process.

Thanks guys!

Quoted 30 lines
---
 arch/riscv/kernel/smpboot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/riscv/kernel/smpboot.c +3 -2
index bb0b76e1a6d4..f4d6acb38dd0 100644
@@ -238,10 +238,11 @@ asmlinkage __visible void smp_callin(void)
 	mmgrab(mm);
 	current->active_mm = mm;
 
-	riscv_ipi_enable();
-
 	store_cpu_topology(curr_cpuid);
 	notify_cpu_starting(curr_cpuid);
+
+	riscv_ipi_enable();
+
 	numa_add_cpu(curr_cpuid);
 	set_cpu_online(curr_cpuid, 1);
 	probe_vendor_features(curr_cpuid);
Signature · 1 line
2.34.1
#4 lore raw
In reply to Marc Zyngier
Quoted 10 lines · Marc Zyngier

Conor reports that risc-v tries to enable IPIs before telling the core code to enable RCU. With the introduction of the mapple tree as a backing store for the irq descriptors, this results in a very shouty boot sequence, as RCU is legitimately upset.

Restore some sanity by moving the risc_ipi_enable() call after notify_cpu_starting(), which explicitly enables RCU on the calling CPU.

[...]

Applied, thanks!

[1/1] risc-v: Fix order of IPI enablement vs RCU startup

      https://git.kernel.org/palmer/c/6259f3443c6a

Best regards,

Signature · 1 line
Palmer Dabbelt <[email protected]>