Skip to content

Commit f2c5092

Browse files
Sebastian Andrzej Siewiorarndb
authored andcommitted
arch/*: Disable softirq stacks on PREEMPT_RT.
PREEMPT_RT preempts softirqs and the current implementation avoids do_softirq_own_stack() and only uses __do_softirq(). Disable the unused softirqs stacks on PREEMPT_RT to save some memory and ensure that do_softirq_own_stack() is not used bwcause it is not expected. Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent b13bacc commit f2c5092

File tree

7 files changed

+15
-3
lines changed

7 files changed

+15
-3
lines changed

arch/arm/kernel/irq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ static void __init init_irq_stacks(void)
7070
}
7171
}
7272

73+
#ifndef CONFIG_PREEMPT_RT
7374
static void ____do_softirq(void *arg)
7475
{
7576
__do_softirq();
@@ -80,7 +81,7 @@ void do_softirq_own_stack(void)
8081
call_with_stack(____do_softirq, NULL,
8182
__this_cpu_read(irq_stack_ptr));
8283
}
83-
84+
#endif
8485
#endif
8586

8687
int arch_show_interrupts(struct seq_file *p, int prec)

arch/parisc/kernel/irq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,12 @@ static void execute_on_irq_stack(void *func, unsigned long param1)
480480
*irq_stack_in_use = 1;
481481
}
482482

483+
#ifndef CONFIG_PREEMPT_RT
483484
void do_softirq_own_stack(void)
484485
{
485486
execute_on_irq_stack(__do_softirq, 0);
486487
}
488+
#endif
487489
#endif /* CONFIG_IRQSTACKS */
488490

489491
/* ONLY called from entry.S:intr_extint() */

arch/powerpc/kernel/irq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ static inline void check_stack_overflow(void)
611611
}
612612
}
613613

614+
#ifndef CONFIG_PREEMPT_RT
614615
static __always_inline void call_do_softirq(const void *sp)
615616
{
616617
/* Temporarily switch r1 to sp, call __do_softirq() then restore r1. */
@@ -629,6 +630,7 @@ static __always_inline void call_do_softirq(const void *sp)
629630
"r11", "r12"
630631
);
631632
}
633+
#endif
632634

633635
static __always_inline void call_do_irq(struct pt_regs *regs, void *sp)
634636
{
@@ -747,10 +749,12 @@ void *mcheckirq_ctx[NR_CPUS] __read_mostly;
747749
void *softirq_ctx[NR_CPUS] __read_mostly;
748750
void *hardirq_ctx[NR_CPUS] __read_mostly;
749751

752+
#ifndef CONFIG_PREEMPT_RT
750753
void do_softirq_own_stack(void)
751754
{
752755
call_do_softirq(softirq_ctx[smp_processor_id()]);
753756
}
757+
#endif
754758

755759
irq_hw_number_t virq_to_hw(unsigned int virq)
756760
{

arch/s390/include/asm/softirq_stack.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
#include <asm/lowcore.h>
66
#include <asm/stacktrace.h>
77

8+
#ifndef CONFIG_PREEMPT_RT
89
static inline void do_softirq_own_stack(void)
910
{
1011
call_on_stack(0, S390_lowcore.async_stack, void, __do_softirq);
1112
}
12-
13+
#endif
1314
#endif /* __ASM_S390_SOFTIRQ_STACK_H */

arch/sh/kernel/irq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ void irq_ctx_exit(int cpu)
149149
hardirq_ctx[cpu] = NULL;
150150
}
151151

152+
#ifndef CONFIG_PREEMPT_RT
152153
void do_softirq_own_stack(void)
153154
{
154155
struct thread_info *curctx;
@@ -176,6 +177,7 @@ void do_softirq_own_stack(void)
176177
"r5", "r6", "r7", "r8", "r9", "r15", "t", "pr"
177178
);
178179
}
180+
#endif
179181
#else
180182
static inline void handle_one_irq(unsigned int irq)
181183
{

arch/sparc/kernel/irq_64.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,7 @@ void __irq_entry handler_irq(int pil, struct pt_regs *regs)
855855
set_irq_regs(old_regs);
856856
}
857857

858+
#ifndef CONFIG_PREEMPT_RT
858859
void do_softirq_own_stack(void)
859860
{
860861
void *orig_sp, *sp = softirq_stack[smp_processor_id()];
@@ -869,6 +870,7 @@ void do_softirq_own_stack(void)
869870
__asm__ __volatile__("mov %0, %%sp"
870871
: : "r" (orig_sp));
871872
}
873+
#endif
872874

873875
#ifdef CONFIG_HOTPLUG_CPU
874876
void fixup_irqs(void)

include/asm-generic/softirq_stack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef __ASM_GENERIC_SOFTIRQ_STACK_H
33
#define __ASM_GENERIC_SOFTIRQ_STACK_H
44

5-
#ifdef CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK
5+
#if defined(CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK) && !defined(CONFIG_PREEMPT_RT)
66
void do_softirq_own_stack(void);
77
#else
88
static inline void do_softirq_own_stack(void)

0 commit comments

Comments
 (0)