Re: [PATCH -next V10 09/10] riscv: stack: Support HAVE_SOFTIRQ_ON_OWN_STACK

From: Guo Ren
Date: Sat Dec 10 2022 - 05:21:47 EST


On Fri, Dec 9, 2022 at 3:50 PM Björn Töpel <bjorn@xxxxxxxxxx> wrote:
>
> Guo Ren <guoren@xxxxxxxxxx> writes:
>
> > On Thu, Dec 8, 2022 at 6:12 PM Björn Töpel <bjorn@xxxxxxxxxx> wrote:
> >>
> >> guoren@xxxxxxxxxx writes:
> >>
> >> > From: Guo Ren <guoren@xxxxxxxxxxxxxxxxx>
> >> >
> >> > Add the HAVE_SOFTIRQ_ON_OWN_STACK feature for the IRQ_STACKS config. The
> >> > irq and softirq use the same independent irq_stack of percpu by time
> >> > division multiplexing.
> >> >
> >> > Tested-by: Jisheng Zhang <jszhang@xxxxxxxxxx>
> >> > Signed-off-by: Guo Ren <guoren@xxxxxxxxxxxxxxxxx>
> >> > Signed-off-by: Guo Ren <guoren@xxxxxxxxxx>
> >> > ---
> >> > arch/riscv/Kconfig | 7 ++++---
> >> > arch/riscv/kernel/irq.c | 33 +++++++++++++++++++++++++++++++++
> >> > 2 files changed, 37 insertions(+), 3 deletions(-)
> >> >
> >> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> >> > index 0a9d4bdc0338..bd4c4ae4cdc9 100644
> >> > --- a/arch/riscv/Kconfig
> >> > +++ b/arch/riscv/Kconfig
> >> > @@ -447,12 +447,13 @@ config FPU
> >> > If you don't know what to do here, say Y.
> >> >
> >> > config IRQ_STACKS
> >> > - bool "Independent irq stacks" if EXPERT
> >> > + bool "Independent irq & softirq stacks" if EXPERT
> >> > default y
> >> > select HAVE_IRQ_EXIT_ON_IRQ_STACK
> >> > + select HAVE_SOFTIRQ_ON_OWN_STACK
> >>
> >> HAVE_IRQ_EXIT_ON_IRQ_STACK is used by softirq.c Shouldn't that be
> >> selected introduced in this patch, instead of the previous one?
> > This patch depends on the previous one. And the previous one could
> > work separately.
>
> Let me try to be more clear: IRQ_STACKS should be introduced in the
> previous patch, which adds per-cpu stacks to hardirq. This patch adds
> per-cpu stacks for softirq, and the softirq related selects:
>
> select HAVE_IRQ_EXIT_ON_IRQ_STACK
> select HAVE_SOFTIRQ_ON_OWN_STACK
>
> Hence, the "HAVE_IRQ_EXIT_ON_IRQ_STACK" select should be part of *this*
> patch, not the previous.
>
> Or am I missing something?
You are right, HAVE_IRQ_EXIT_ON_IRQ_STACK is belong to SOFTIRQ:
static inline void invoke_softirq(void)
{
...
if (!force_irqthreads() || !__this_cpu_read(ksoftirqd)) {
#ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK
...
__do_softirq();
#else
...
do_softirq_own_stack();
#endif
...
}

I would fix that in the next version.

>
>
> Björn



--
Best Regards
Guo Ren