From: Ard Biesheuvel <ardb@kernel.org>
To: linux-arm-kernel@lists.infradead.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Arnd Bergmann <arnd@arndb.de>, Kees Cook <keescook@chromium.org>,
Keith Packard <keithpac@amazon.com>,
Linus Walleij <linus.walleij@linaro.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Pitre <nico@fluxnic.net>
Subject: [PATCH v4 9/9] ARM: run softirqs on the per-CPU IRQ stack
Date: Mon, 15 Nov 2021 09:47:32 +0100 [thread overview]
Message-ID: <20211115084732.3704393-10-ardb@kernel.org> (raw)
In-Reply-To: <20211115084732.3704393-1-ardb@kernel.org>
Now that we have enabled IRQ stacks, any softIRQs that are handled over
the back of a hard IRQ will run from the IRQ stack as well. However, any
synchronous softirq processing that happens when re-enabling softIRQs
from task context will still execute on that task's stack.
Since any call to local_bh_enable() at any level in the task's call
stack may trigger a softIRQ processing run, which could potentially
cause a task stack overflow if the combined stack footprints exceed the
stack's size, let's run these synchronous invocations of do_softirq() on
the IRQ stack as well.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Keith Packard <keithpac@amazon.com>
---
arch/arm/Kconfig | 2 ++
arch/arm/kernel/irq.c | 14 ++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index aa421f29910b..b1eba1b4168c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1169,6 +1169,8 @@ config CURRENT_POINTER_IN_TPIDRURO
config IRQSTACKS
def_bool y
depends on GENERIC_IRQ_MULTI_HANDLER && THREAD_INFO_IN_TASK
+ select HAVE_IRQ_EXIT_ON_IRQ_STACK
+ select HAVE_SOFTIRQ_ON_OWN_STACK
config ARM_CPU_TOPOLOGY
bool "Support cpu topology definition"
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index abb0aa679bba..e05219bca218 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -36,11 +36,14 @@
#include <asm/hardware/cache-l2x0.h>
#include <asm/hardware/cache-uniphier.h>
#include <asm/outercache.h>
+#include <asm/softirq_stack.h>
#include <asm/exception.h>
#include <asm/mach/arch.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
+#include "reboot.h"
+
unsigned long irq_err_count;
#ifdef CONFIG_IRQSTACKS
@@ -60,6 +63,17 @@ static void __init init_irq_stacks(void)
}
}
+static void ____do_softirq(void *arg)
+{
+ __do_softirq();
+}
+
+void do_softirq_own_stack(void)
+{
+ call_with_stack(____do_softirq, NULL,
+ __this_cpu_read(irq_stack_ptr));
+}
+
#endif
int arch_show_interrupts(struct seq_file *p, int prec)
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2021-11-15 8:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 8:47 [PATCH v4 0/9] ARM: add support for IRQ stacks Ard Biesheuvel
2021-11-15 8:47 ` [PATCH v4 1/9] ARM: remove some dead code Ard Biesheuvel
2021-11-15 8:47 ` [PATCH v4 2/9] ARM: assembler: introduce bl_r macro Ard Biesheuvel
2021-11-15 8:47 ` [PATCH v4 3/9] ARM: unwind: support unwinding across multiple stacks Ard Biesheuvel
2021-11-15 8:47 ` [PATCH v4 4/9] ARM: export dump_mem() to other objects Ard Biesheuvel
2021-11-15 8:47 ` [PATCH v4 5/9] ARM: unwind: dump exception stack from calling frame Ard Biesheuvel
2021-11-15 8:47 ` [PATCH v4 6/9] ARM: backtrace-clang: avoid crash on bogus frame pointer Ard Biesheuvel
2021-11-15 8:47 ` [PATCH v4 7/9] ARM: implement IRQ stacks Ard Biesheuvel
2021-11-15 8:47 ` [PATCH v4 8/9] ARM: call_with_stack: add unwind support Ard Biesheuvel
2021-11-15 8:47 ` Ard Biesheuvel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211115084732.3704393-10-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=keescook@chromium.org \
--cc=keithpac@amazon.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=ndesaulniers@google.com \
--cc=nico@fluxnic.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).