Skip to contentSkip to conversation

asm-generic: Conditionally enable do_softirq_own_stack() via Kconfig.

PATCH In review Sebastian Andrzej Siewior 1 participant 2 messages Aug 25, 2022 – Sep 8, 2022

Subsystems (8)
Arm (32-bit) x86 PowerPC s390 +4 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 asm-generic: Conditionally enable do_softirq_own_stack() via Kconfig.

Remove the CONFIG_PREEMPT_RT symbol from the ifdef around do_softirq_own_stack() and move it to Kconfig instead.

Enable softirq stacks based on SOFTIRQ_ON_OWN_STACK which depends on HAVE_SOFTIRQ_ON_OWN_STACK and its default value is set to !PREEMPT_RT. This ensures that softirq stacks are not used on PREEMPT_RT and avoids a 'select' statement on an option which has a 'depends' statement.

---

Arnd, could you please route it via your tree?

v1…v2:
- Use "def_bool HAVE_SOFTIRQ_ON_OWN_STACK && !PREEMPT_RT"

 arch/Kconfig                          |    3 +++
 arch/arm/kernel/irq.c                 |    2 +-
 arch/parisc/kernel/irq.c              |    2 +-
 arch/powerpc/kernel/irq.c             |    4 ++--
 arch/s390/include/asm/softirq_stack.h |    2 +-
 arch/sh/kernel/irq.c                  |    2 +-
 arch/sparc/kernel/irq_64.c            |    2 +-
 arch/x86/include/asm/irq_stack.h      |    2 +-
 arch/x86/kernel/irq_32.c              |    2 +-
 include/asm-generic/softirq_stack.h   |    2 +-
 10 files changed, 13 insertions(+), 10 deletions(-)
arch/Kconfig +3 -0
@@ -923,6 +923,9 @@ config HAVE_SOFTIRQ_ON_OWN_STACK
 	  Architecture provides a function to run __do_softirq() on a
 	  separate stack.
 
+config SOFTIRQ_ON_OWN_STACK
+	def_bool HAVE_SOFTIRQ_ON_OWN_STACK && !PREEMPT_RT
+
 config ALTERNATE_USER_ADDRESS_SPACE
 	bool
 	help
arch/arm/kernel/irq.c +1 -1
@@ -70,7 +70,7 @@ static void __init init_irq_stacks(void)
 	}
 }
 
-#ifndef CONFIG_PREEMPT_RT
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 static void ____do_softirq(void *arg)
 {
 	__do_softirq();
arch/parisc/kernel/irq.c +1 -1
@@ -480,7 +480,7 @@ static void execute_on_irq_stack(void *f
 	*irq_stack_in_use = 1;
 }
 
-#ifndef CONFIG_PREEMPT_RT
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 void do_softirq_own_stack(void)
 {
 	execute_on_irq_stack(__do_softirq, 0);
arch/powerpc/kernel/irq.c +2 -2
@@ -199,7 +199,7 @@ static inline void check_stack_overflow(
 	}
 }
 
-#ifndef CONFIG_PREEMPT_RT
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 static __always_inline void call_do_softirq(const void *sp)
 {
 	/* Temporarily switch r1 to sp, call __do_softirq() then restore r1. */
@@ -335,7 +335,7 @@ void *mcheckirq_ctx[NR_CPUS] __read_most
 void *softirq_ctx[NR_CPUS] __read_mostly;
 void *hardirq_ctx[NR_CPUS] __read_mostly;
 
-#ifndef CONFIG_PREEMPT_RT
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 void do_softirq_own_stack(void)
 {
 	call_do_softirq(softirq_ctx[smp_processor_id()]);
arch/s390/include/asm/softirq_stack.h +1 -1
@@ -5,7 +5,7 @@
 #include <asm/lowcore.h>
 #include <asm/stacktrace.h>
 
-#ifndef CONFIG_PREEMPT_RT
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 static inline void do_softirq_own_stack(void)
 {
 	call_on_stack(0, S390_lowcore.async_stack, void, __do_softirq);
arch/sh/kernel/irq.c +1 -1
@@ -149,7 +149,7 @@ void irq_ctx_exit(int cpu)
 	hardirq_ctx[cpu] = NULL;
 }
 
-#ifndef CONFIG_PREEMPT_RT
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 void do_softirq_own_stack(void)
 {
 	struct thread_info *curctx;
arch/sparc/kernel/irq_64.c +1 -1
@@ -855,7 +855,7 @@ void __irq_entry handler_irq(int pil, st
 	set_irq_regs(old_regs);
 }
 
-#ifndef CONFIG_PREEMPT_RT
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 void do_softirq_own_stack(void)
 {
 	void *orig_sp, *sp = softirq_stack[smp_processor_id()];
arch/x86/include/asm/irq_stack.h +1 -1
@@ -203,7 +203,7 @@
 			      IRQ_CONSTRAINTS, regs, vector);		\
 }
 
-#ifndef CONFIG_PREEMPT_RT
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 /*
  * Macro to invoke __do_softirq on the irq stack. This is only called from
  * task context when bottom halves are about to be reenabled and soft
arch/x86/kernel/irq_32.c +1 -1
@@ -132,7 +132,7 @@ int irq_init_percpu_irqstack(unsigned in
 	return 0;
 }
 
-#ifndef CONFIG_PREEMPT_RT
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 void do_softirq_own_stack(void)
 {
 	struct irq_stack *irqstk;
include/asm-generic/softirq_stack.h +1 -1
@@ -2,7 +2,7 @@
 #ifndef __ASM_GENERIC_SOFTIRQ_STACK_H
 #define __ASM_GENERIC_SOFTIRQ_STACK_H
 
-#if defined(CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK) && !defined(CONFIG_PREEMPT_RT)
+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
 void do_softirq_own_stack(void);
 #else
 static inline void do_softirq_own_stack(void)
#1 lore raw
Quoted 8 lines · To Arnd Bergmann

Remove the CONFIG_PREEMPT_RT symbol from the ifdef around do_softirq_own_stack() and move it to Kconfig instead.

Enable softirq stacks based on SOFTIRQ_ON_OWN_STACK which depends on HAVE_SOFTIRQ_ON_OWN_STACK and its default value is set to !PREEMPT_RT. This ensures that softirq stacks are not used on PREEMPT_RT and avoids a 'select' statement on an option which has a 'depends' statement.

Quoted 8 lines

---

Arnd, could you please route it via your tree?

v1…v2:
- Use "def_bool HAVE_SOFTIRQ_ON_OWN_STACK && !PREEMPT_RT"

a gentle *ping*

Sebastian