Skip to contentSkip to conversation

RISC-V: Enable the IPI before workqueue_online_cpu()

PATCH Applied Nick Hu 3 participants 3 messages Jul 17, 2024 – Aug 1, 2024

Subsystems (2)
lore
Share & tools
lore

Nick Hu

author
#0 lore raw

PATCH v2 1/1 RISC-V: Enable the IPI before workqueue_online_cpu()

Sometimes the hotplug cpu stalls at the arch_cpu_idle() for a while after workqueue_online_cpu(). When cpu stalls at the idle loop, the reschedule IPI is pending. However the enable bit is not enabled yet so the cpu stalls at WFI until watchdog timeout. Therefore enable the IPI before the workqueue_online_cpu() to fix the issue.

Fixes 63c5484e7495 ("workqueue: Add multiple affinity scopes and interface to select them")

---
Changes in v2: Rename the cpuhp_state of sbi ipi

 arch/riscv/kernel/sbi-ipi.c | 2 +-
 include/linux/cpuhotplug.h  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/kernel/sbi-ipi.c +1 -1
index 1026e22955cc..0cc5559c08d8 100644
@@ -71,7 +71,7 @@ void __init sbi_ipi_init(void)
 	 * the masking/unmasking of virtual IPIs is done
 	 * via generic IPI-Mux
 	 */
-	cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
+	cpuhp_setup_state(CPUHP_AP_IRQ_RISCV_SBI_IPI_STARTING,
 			  "irqchip/sbi-ipi:starting",
 			  sbi_ipi_starting_cpu, NULL);
 
include/linux/cpuhotplug.h +1 -0
index 7a5785f405b6..0a8fd4a3d04c 100644
@@ -147,6 +147,7 @@ enum cpuhp_state {
 	CPUHP_AP_IRQ_LOONGARCH_STARTING,
 	CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING,
 	CPUHP_AP_IRQ_RISCV_IMSIC_STARTING,
+	CPUHP_AP_IRQ_RISCV_SBI_IPI_STARTING,
 	CPUHP_AP_ARM_MVEBU_COHERENCY,
 	CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
 	CPUHP_AP_PERF_X86_STARTING,
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Nick Hu

Sometimes the hotplug cpu stalls at the arch_cpu_idle() for a while after workqueue_online_cpu(). When cpu stalls at the idle loop, the reschedule IPI is pending. However the enable bit is not enabled yet so the cpu stalls at WFI until watchdog timeout. Therefore enable the IPI before the workqueue_online_cpu() to fix the issue.

Fixes 63c5484e7495 ("workqueue: Add multiple affinity scopes and interface to select them")

LGTM.

Regards,
Anup

Quoted 35 lines

---
Changes in v2: Rename the cpuhp_state of sbi ipi

 arch/riscv/kernel/sbi-ipi.c | 2 +-
 include/linux/cpuhotplug.h  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/kernel/sbi-ipi.c +1 -1
index 1026e22955cc..0cc5559c08d8 100644
@@ -71,7 +71,7 @@ void __init sbi_ipi_init(void)
         * the masking/unmasking of virtual IPIs is done
         * via generic IPI-Mux
         */
-       cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
+       cpuhp_setup_state(CPUHP_AP_IRQ_RISCV_SBI_IPI_STARTING,
                          "irqchip/sbi-ipi:starting",
                          sbi_ipi_starting_cpu, NULL);
 
include/linux/cpuhotplug.h +1 -1
index 7a5785f405b6..0a8fd4a3d04c 100644
@@ -147,6 +147,7 @@ enum cpuhp_state {
        CPUHP_AP_IRQ_LOONGARCH_STARTING,
        CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING,
        CPUHP_AP_IRQ_RISCV_IMSIC_STARTING,
+       CPUHP_AP_IRQ_RISCV_SBI_IPI_STARTING,
        CPUHP_AP_ARM_MVEBU_COHERENCY,
        CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
        CPUHP_AP_PERF_X86_STARTING,
--

2.34.1

#2 lore raw
In reply to Nick Hu
This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <[email protected]>:

Quoted 10 lines · On Wed, 17 Jul 2024 11:17:14 +0800 you wrote:

Sometimes the hotplug cpu stalls at the arch_cpu_idle() for a while after workqueue_online_cpu(). When cpu stalls at the idle loop, the reschedule IPI is pending. However the enable bit is not enabled yet so the cpu stalls at WFI until watchdog timeout. Therefore enable the IPI before the workqueue_online_cpu() to fix the issue.

Fixes 63c5484e7495 ("workqueue: Add multiple affinity scopes and interface to select them")

[...]

Here is the summary with links:
- [v2] RISC-V: Enable the IPI before workqueue_online_cpu()

    https://git.kernel.org/riscv/c/3908ba2e0b24

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html