[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJF2gTRtRzeDqr3=AUkGadPMmMA6kwU86+zSNn8+0qXSk8zmVQ@mail.gmail.com>
Date: Tue, 20 Sep 2022 08:11:55 +0800
From: Guo Ren <guoren@...nel.org>
To: arnd@...db.de, guoren@...nel.org, palmer@...osinc.com,
tglx@...utronix.de, peterz@...radead.org, luto@...nel.org,
conor.dooley@...rochip.com, heiko@...ech.de, jszhang@...nel.org,
lazyparser@...il.com, falcon@...ylab.org, chenhuacai@...nel.org,
apatel@...tanamicro.com, atishp@...shpatra.org, palmer@...belt.com,
paul.walmsley@...ive.com, mark.rutland@....com,
zouyipeng@...wei.com, bigeasy@...utronix.de,
David.Laight@...lab.com
Cc: linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, Guo Ren <guoren@...ux.alibaba.com>
Subject: Re: [PATCH V5 09/11] riscv: Support HAVE_SOFTIRQ_ON_OWN_STACK
On Sun, Sep 18, 2022 at 11:53 PM <guoren@...nel.org> wrote:
>
> From: Guo Ren <guoren@...ux.alibaba.com>
>
> 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.
>
> Signed-off-by: Guo Ren <guoren@...ux.alibaba.com>
> Signed-off-by: Guo Ren <guoren@...nel.org>
> Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
> arch/riscv/Kconfig | 7 ++++---
> arch/riscv/kernel/irq.c | 16 ++++++++++++++++
> 2 files changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 75db47a983f2..dfe600f3526c 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -434,12 +434,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
> help
> - Add independent irq stacks for percpu to prevent kernel stack overflows.
> - We may save some memory footprint by disabling IRQ_STACKS.
> + Add independent irq & softirq stacks for percpu to prevent kernel stack
> + overflows. We may save some memory footprint by disabling IRQ_STACKS.
>
> endmenu # "Platform type"
>
> diff --git a/arch/riscv/kernel/irq.c b/arch/riscv/kernel/irq.c
> index 5ad4952203c5..6dc9ccd01470 100644
> --- a/arch/riscv/kernel/irq.c
> +++ b/arch/riscv/kernel/irq.c
> @@ -11,6 +11,7 @@
> #include <linux/seq_file.h>
> #include <asm/smp.h>
> #include <asm/vmap_stack.h>
> +#include <asm/softirq_stack.h>
>
> #ifdef CONFIG_IRQ_STACKS
> static DEFINE_PER_CPU(ulong *, irq_stack_ptr);
> @@ -38,6 +39,21 @@ static void init_irq_stacks(void)
> per_cpu(irq_stack_ptr, cpu) = per_cpu(irq_stack, cpu);
> }
> #endif /* CONFIG_VMAP_STACK */
> +
> +#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
Sorry, it should be. If you compiled an error, please modify it manually,
+#ifdef CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK
> +static void do_riscv_softirq(struct pt_regs *regs)
> +{
> + __do_softirq();
> +}
> +
> +void do_softirq_own_stack(void)
> +{
> + ulong *sp = per_cpu(irq_stack_ptr, smp_processor_id());
> +
> + call_on_stack(NULL, sp, do_riscv_softirq, 0);
> +}
> +#endif /* CONFIG_SOFTIRQ_ON_OWN_STACK */
> +
> #else
> static void init_irq_stacks(void) {}
> #endif /* CONFIG_IRQ_STACKS */
> --
> 2.36.1
>
--
Best Regards
Guo Ren
Powered by blists - more mailing lists