public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Fix irq_work when SMP is disabled
@ 2022-04-30  3:00 Samuel Holland
  2022-05-03 23:16 ` Heiko Stuebner
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Holland @ 2022-04-30  3:00 UTC (permalink / raw)
  To: Palmer Dabbelt, linux-riscv
  Cc: Samuel Holland, Albert Ou, Greentime Hu, Paul Walmsley,
	linux-kernel

irq_work is triggered via an IPI, but the IPI infrastructure is not
included in uniprocessor kernels. As a result, irq_work never runs.
Fall back to the tick-based irq_work implementation on uniprocessor
configurations.

Fixes: 298447928bb1 ("riscv: Support irq_work via self IPIs")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
This was found while bringing up cpufreq on D1. Switching cpufreq
governors was hanging on irq_work_sync().

 arch/riscv/include/asm/irq_work.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/include/asm/irq_work.h b/arch/riscv/include/asm/irq_work.h
index d6c277992f76..b53891964ae0 100644
--- a/arch/riscv/include/asm/irq_work.h
+++ b/arch/riscv/include/asm/irq_work.h
@@ -4,7 +4,7 @@
 
 static inline bool arch_irq_work_has_interrupt(void)
 {
-	return true;
+	return IS_ENABLED(CONFIG_SMP);
 }
 extern void arch_irq_work_raise(void);
 #endif /* _ASM_RISCV_IRQ_WORK_H */
-- 
2.35.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] riscv: Fix irq_work when SMP is disabled
  2022-04-30  3:00 [PATCH] riscv: Fix irq_work when SMP is disabled Samuel Holland
@ 2022-05-03 23:16 ` Heiko Stuebner
  2022-06-02  4:27   ` Palmer Dabbelt
  0 siblings, 1 reply; 3+ messages in thread
From: Heiko Stuebner @ 2022-05-03 23:16 UTC (permalink / raw)
  To: Palmer Dabbelt, linux-riscv
  Cc: Samuel Holland, Albert Ou, Greentime Hu, Paul Walmsley,
	linux-kernel, Samuel Holland

Am Samstag, 30. April 2022, 05:00:23 CEST schrieb Samuel Holland:
> irq_work is triggered via an IPI, but the IPI infrastructure is not
> included in uniprocessor kernels. As a result, irq_work never runs.
> Fall back to the tick-based irq_work implementation on uniprocessor
> configurations.
> 
> Fixes: 298447928bb1 ("riscv: Support irq_work via self IPIs")
> Signed-off-by: Samuel Holland <samuel@sholland.org>

That uniprocessor part seems a tiny bit neglected - as I saw previously
with alternatives not getting applied as well, so

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

Though somehow I find the arm32 style a tad nicer by defining
an is_smp() function [0] that holds the necessary checks.

But I guess that is a style preference.


Heiko


[0] https://elixir.bootlin.com/linux/latest/source/arch/arm/include/asm/smp_plat.h#L18
> ---
> This was found while bringing up cpufreq on D1. Switching cpufreq
> governors was hanging on irq_work_sync().
> 
>  arch/riscv/include/asm/irq_work.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/include/asm/irq_work.h b/arch/riscv/include/asm/irq_work.h
> index d6c277992f76..b53891964ae0 100644
> --- a/arch/riscv/include/asm/irq_work.h
> +++ b/arch/riscv/include/asm/irq_work.h
> @@ -4,7 +4,7 @@
>  
>  static inline bool arch_irq_work_has_interrupt(void)
>  {
> -	return true;
> +	return IS_ENABLED(CONFIG_SMP);
>  }
>  extern void arch_irq_work_raise(void);
>  #endif /* _ASM_RISCV_IRQ_WORK_H */
> 





_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] riscv: Fix irq_work when SMP is disabled
  2022-05-03 23:16 ` Heiko Stuebner
@ 2022-06-02  4:27   ` Palmer Dabbelt
  0 siblings, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2022-06-02  4:27 UTC (permalink / raw)
  To: samuel, heiko
  Cc: linux-riscv, samuel, aou, greentime.hu, Paul Walmsley,
	linux-kernel, samuel

On Tue, 03 May 2022 16:16:26 PDT (-0700), heiko@sntech.de wrote:
> Am Samstag, 30. April 2022, 05:00:23 CEST schrieb Samuel Holland:
>> irq_work is triggered via an IPI, but the IPI infrastructure is not
>> included in uniprocessor kernels. As a result, irq_work never runs.
>> Fall back to the tick-based irq_work implementation on uniprocessor
>> configurations.
>>
>> Fixes: 298447928bb1 ("riscv: Support irq_work via self IPIs")
>> Signed-off-by: Samuel Holland <samuel@sholland.org>
>
> That uniprocessor part seems a tiny bit neglected - as I saw previously
> with alternatives not getting applied as well, so

Ya, it definately is -- and not just me missing this fix, I'd also 
dropped the CONFIG_SMP=n test from my list by accident.  Luckily it 
still boots in QEMU, so at least it's not as brokn as it could be.

>
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
>
> Though somehow I find the arm32 style a tad nicer by defining
> an is_smp() function [0] that holds the necessary checks.
>
> But I guess that is a style preference.

IIUC that's slightly different: this is a compile-time issue related to 
the IPI framework not coming up at all, not a runtime "are we on a 
uniprocessor" issue.

I put this on for-next (no fixes right now, I'm still collecting 5.19 
merge window material).

Thanks!

>
>
> Heiko
>
>
> [0] https://elixir.bootlin.com/linux/latest/source/arch/arm/include/asm/smp_plat.h#L18
>> ---
>> This was found while bringing up cpufreq on D1. Switching cpufreq
>> governors was hanging on irq_work_sync().
>>
>>  arch/riscv/include/asm/irq_work.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/riscv/include/asm/irq_work.h b/arch/riscv/include/asm/irq_work.h
>> index d6c277992f76..b53891964ae0 100644
>> --- a/arch/riscv/include/asm/irq_work.h
>> +++ b/arch/riscv/include/asm/irq_work.h
>> @@ -4,7 +4,7 @@
>>
>>  static inline bool arch_irq_work_has_interrupt(void)
>>  {
>> -	return true;
>> +	return IS_ENABLED(CONFIG_SMP);
>>  }
>>  extern void arch_irq_work_raise(void);
>>  #endif /* _ASM_RISCV_IRQ_WORK_H */
>>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2022-06-02  4:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-30  3:00 [PATCH] riscv: Fix irq_work when SMP is disabled Samuel Holland
2022-05-03 23:16 ` Heiko Stuebner
2022-06-02  4:27   ` Palmer Dabbelt

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