* [PATCH] RISC-V: Enable the IPI before workqueue_online_cpu()
@ 2024-07-16 9:05 Nick Hu
2024-07-16 10:51 ` Anup Patel
0 siblings, 1 reply; 3+ messages in thread
From: Nick Hu @ 2024-07-16 9:05 UTC (permalink / raw)
To: paul.walmsley, palmer, aou, tglx, peterz, anup, samuel.holland,
tj, linux-riscv, linux-kernel, greentime.hu, zong.li
Cc: 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")
Signed-off-by: Nick Hu <nick.hu@sifive.com>
---
arch/riscv/kernel/sbi-ipi.c | 2 +-
include/linux/cpuhotplug.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/sbi-ipi.c b/arch/riscv/kernel/sbi-ipi.c
index 1026e22955cc..e05e68de8871 100644
--- a/arch/riscv/kernel/sbi-ipi.c
+++ b/arch/riscv/kernel/sbi-ipi.c
@@ -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_SWINT_STARTING,
"irqchip/sbi-ipi:starting",
sbi_ipi_starting_cpu, NULL);
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 7a5785f405b6..57dcf1229b27 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -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_SWINT_STARTING,
CPUHP_AP_ARM_MVEBU_COHERENCY,
CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
CPUHP_AP_PERF_X86_STARTING,
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] RISC-V: Enable the IPI before workqueue_online_cpu()
2024-07-16 9:05 [PATCH] RISC-V: Enable the IPI before workqueue_online_cpu() Nick Hu
@ 2024-07-16 10:51 ` Anup Patel
2024-07-17 1:20 ` Nick Hu
0 siblings, 1 reply; 3+ messages in thread
From: Anup Patel @ 2024-07-16 10:51 UTC (permalink / raw)
To: Nick Hu
Cc: paul.walmsley, palmer, aou, tglx, peterz, samuel.holland, tj,
linux-riscv, linux-kernel, greentime.hu, zong.li
On Tue, Jul 16, 2024 at 2:35 PM Nick Hu <nick.hu@sifive.com> 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")
> Signed-off-by: Nick Hu <nick.hu@sifive.com>
> ---
> arch/riscv/kernel/sbi-ipi.c | 2 +-
> include/linux/cpuhotplug.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/sbi-ipi.c b/arch/riscv/kernel/sbi-ipi.c
> index 1026e22955cc..e05e68de8871 100644
> --- a/arch/riscv/kernel/sbi-ipi.c
> +++ b/arch/riscv/kernel/sbi-ipi.c
> @@ -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_SWINT_STARTING,
> "irqchip/sbi-ipi:starting",
> sbi_ipi_starting_cpu, NULL);
>
> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> index 7a5785f405b6..57dcf1229b27 100644
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -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_SWINT_STARTING,
This is a misleading name.
I suggest s/_RISCV_SWINT_/_RISCV_SBI_IPI_/ .
> CPUHP_AP_ARM_MVEBU_COHERENCY,
> CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
> CPUHP_AP_PERF_X86_STARTING,
> --
> 2.34.1
>
Regards,
Anup
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] RISC-V: Enable the IPI before workqueue_online_cpu()
2024-07-16 10:51 ` Anup Patel
@ 2024-07-17 1:20 ` Nick Hu
0 siblings, 0 replies; 3+ messages in thread
From: Nick Hu @ 2024-07-17 1:20 UTC (permalink / raw)
To: Anup Patel
Cc: paul.walmsley, palmer, aou, tglx, peterz, samuel.holland, tj,
linux-riscv, linux-kernel, greentime.hu, zong.li
Hi Anup
On Tue, Jul 16, 2024 at 6:51 PM Anup Patel <anup@brainfault.org> wrote:
>
> On Tue, Jul 16, 2024 at 2:35 PM Nick Hu <nick.hu@sifive.com> 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")
> > Signed-off-by: Nick Hu <nick.hu@sifive.com>
> > ---
> > arch/riscv/kernel/sbi-ipi.c | 2 +-
> > include/linux/cpuhotplug.h | 1 +
> > 2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/riscv/kernel/sbi-ipi.c b/arch/riscv/kernel/sbi-ipi.c
> > index 1026e22955cc..e05e68de8871 100644
> > --- a/arch/riscv/kernel/sbi-ipi.c
> > +++ b/arch/riscv/kernel/sbi-ipi.c
> > @@ -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_SWINT_STARTING,
> > "irqchip/sbi-ipi:starting",
> > sbi_ipi_starting_cpu, NULL);
> >
> > diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> > index 7a5785f405b6..57dcf1229b27 100644
> > --- a/include/linux/cpuhotplug.h
> > +++ b/include/linux/cpuhotplug.h
> > @@ -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_SWINT_STARTING,
>
> This is a misleading name.
>
> I suggest s/_RISCV_SWINT_/_RISCV_SBI_IPI_/ .
>
Good point.
I'll update it in the next version.
Thank you for the feedback.
> > CPUHP_AP_ARM_MVEBU_COHERENCY,
> > CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
> > CPUHP_AP_PERF_X86_STARTING,
> > --
> > 2.34.1
> >
>
> Regards,
> Anup
Regards,
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-17 1:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-16 9:05 [PATCH] RISC-V: Enable the IPI before workqueue_online_cpu() Nick Hu
2024-07-16 10:51 ` Anup Patel
2024-07-17 1:20 ` Nick Hu
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®