Commit 7974891d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Thomas Gleixner

x86: Always use irq stacks

IRQ stacks provide much better safety against unexpected stack use from
interrupts, at the minimal downside of slightly higher memory usage.
Enable irq stacks also for the default 8k stack on 32-bit kernels to
minimize the problem of stack overflows through interrupt activity.

This is what the 64-bit kernel and various other architectures already do.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
LKML-Reference: <20100628121554.GA6605@lst.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 5904b3b8
...@@ -18,9 +18,9 @@ specialized stacks contain no useful data. The main CPU stacks are: ...@@ -18,9 +18,9 @@ specialized stacks contain no useful data. The main CPU stacks are:
Used for external hardware interrupts. If this is the first external Used for external hardware interrupts. If this is the first external
hardware interrupt (i.e. not a nested hardware interrupt) then the hardware interrupt (i.e. not a nested hardware interrupt) then the
kernel switches from the current task to the interrupt stack. Like kernel switches from the current task to the interrupt stack. Like
the split thread and interrupt stacks on i386 (with CONFIG_4KSTACKS), the split thread and interrupt stacks on i386, this gives more room
this gives more room for kernel interrupt processing without having for kernel interrupt processing without having to increase the size
to increase the size of every per thread stack. of every per thread stack.
The interrupt stack is also used when processing a softirq. The interrupt stack is also used when processing a softirq.
......
...@@ -128,8 +128,7 @@ config 4KSTACKS ...@@ -128,8 +128,7 @@ config 4KSTACKS
If you say Y here the kernel will use a 4Kb stacksize for the If you say Y here the kernel will use a 4Kb stacksize for the
kernel stack attached to each process/thread. This facilitates kernel stack attached to each process/thread. This facilitates
running more threads on a system and also reduces the pressure running more threads on a system and also reduces the pressure
on the VM subsystem for higher order allocations. This option on the VM subsystem for higher order allocations.
will also use IRQ stacks to compensate for the reduced stackspace.
config DOUBLEFAULT config DOUBLEFAULT
default y default y
......
...@@ -19,18 +19,16 @@ static inline int irq_canonicalize(int irq) ...@@ -19,18 +19,16 @@ static inline int irq_canonicalize(int irq)
# define ARCH_HAS_NMI_WATCHDOG # define ARCH_HAS_NMI_WATCHDOG
#endif #endif
#ifdef CONFIG_4KSTACKS #ifdef CONFIG_X86_32
extern void irq_ctx_init(int cpu); extern void irq_ctx_init(int cpu);
extern void irq_ctx_exit(int cpu); extern void irq_ctx_exit(int cpu);
# define __ARCH_HAS_DO_SOFTIRQ
#else #else
# define irq_ctx_init(cpu) do { } while (0) # define irq_ctx_init(cpu) do { } while (0)
# define irq_ctx_exit(cpu) do { } while (0) # define irq_ctx_exit(cpu) do { } while (0)
# ifdef CONFIG_X86_64
# define __ARCH_HAS_DO_SOFTIRQ
# endif
#endif #endif
#define __ARCH_HAS_DO_SOFTIRQ
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
#include <linux/cpumask.h> #include <linux/cpumask.h>
extern void fixup_irqs(void); extern void fixup_irqs(void);
......
...@@ -49,7 +49,6 @@ static inline int check_stack_overflow(void) { return 0; } ...@@ -49,7 +49,6 @@ static inline int check_stack_overflow(void) { return 0; }
static inline void print_stack_overflow(void) { } static inline void print_stack_overflow(void) { }
#endif #endif
#ifdef CONFIG_4KSTACKS
/* /*
* per-CPU IRQ handling contexts (thread information and stack) * per-CPU IRQ handling contexts (thread information and stack)
*/ */
...@@ -187,11 +186,6 @@ asmlinkage void do_softirq(void) ...@@ -187,11 +186,6 @@ asmlinkage void do_softirq(void)
local_irq_restore(flags); local_irq_restore(flags);
} }
#else
static inline int
execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq) { return 0; }
#endif
bool handle_irq(unsigned irq, struct pt_regs *regs) bool handle_irq(unsigned irq, struct pt_regs *regs)
{ {
struct irq_desc *desc; struct irq_desc *desc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment