aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/x86/x86_64/kernel-stacks6
-rw-r--r--arch/x86/Kconfig.debug10
-rw-r--r--arch/x86/include/asm/irq.h12
-rw-r--r--arch/x86/include/asm/module.h7
-rw-r--r--arch/x86/include/asm/page_32_types.h4
-rw-r--r--arch/x86/kernel/irq_32.c12
-rw-r--r--arch/x86/kernel/vmlinux.lds.S2
-rw-r--r--include/linux/percpu-defs.h12
8 files changed, 25 insertions, 40 deletions
diff --git a/Documentation/x86/x86_64/kernel-stacks b/Documentation/x86/x86_64/kernel-stacks
index 5ad65d51fb95..a01eec5d1d0b 100644
--- a/Documentation/x86/x86_64/kernel-stacks
+++ b/Documentation/x86/x86_64/kernel-stacks
@@ -18,9 +18,9 @@ specialized stacks contain no useful data. The main CPU stacks are:
18 Used for external hardware interrupts. If this is the first external 18 Used for external hardware interrupts. If this is the first external
19 hardware interrupt (i.e. not a nested hardware interrupt) then the 19 hardware interrupt (i.e. not a nested hardware interrupt) then the
20 kernel switches from the current task to the interrupt stack. Like 20 kernel switches from the current task to the interrupt stack. Like
21 the split thread and interrupt stacks on i386 (with CONFIG_4KSTACKS), 21 the split thread and interrupt stacks on i386, this gives more room
22 this gives more room for kernel interrupt processing without having 22 for kernel interrupt processing without having to increase the size
23 to increase the size of every per thread stack. 23 of every per thread stack.
24 24
25 The interrupt stack is also used when processing a softirq. 25 The interrupt stack is also used when processing a softirq.
26 26
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index e5bb96b10f1a..b59ee765414e 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -125,16 +125,6 @@ config DEBUG_NX_TEST
125 and the software setup of this feature. 125 and the software setup of this feature.
126 If in doubt, say "N" 126 If in doubt, say "N"
127 127
128config 4KSTACKS
129 bool "Use 4Kb for kernel stacks instead of 8Kb"
130 depends on X86_32
131 ---help---
132 If you say Y here the kernel will use a 4Kb stacksize for the
133 kernel stack attached to each process/thread. This facilitates
134 running more threads on a system and also reduces the pressure
135 on the VM subsystem for higher order allocations. This option
136 will also use IRQ stacks to compensate for the reduced stackspace.
137
138config DOUBLEFAULT 128config DOUBLEFAULT
139 default y 129 default y
140 bool "Enable doublefault exception handler" if EMBEDDED 130 bool "Enable doublefault exception handler" if EMBEDDED
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
index 5458380b6ef8..0bf5b0083650 100644
--- a/arch/x86/include/asm/irq.h
+++ b/arch/x86/include/asm/irq.h
@@ -19,18 +19,16 @@ static inline int irq_canonicalize(int irq)
19# define ARCH_HAS_NMI_WATCHDOG 19# define ARCH_HAS_NMI_WATCHDOG
20#endif 20#endif
21 21
22#ifdef CONFIG_4KSTACKS 22#ifdef CONFIG_X86_32
23 extern void irq_ctx_init(int cpu); 23extern void irq_ctx_init(int cpu);
24 extern void irq_ctx_exit(int cpu); 24extern void irq_ctx_exit(int cpu);
25# define __ARCH_HAS_DO_SOFTIRQ
26#else 25#else
27# define irq_ctx_init(cpu) do { } while (0) 26# define irq_ctx_init(cpu) do { } while (0)
28# define irq_ctx_exit(cpu) do { } while (0) 27# define irq_ctx_exit(cpu) do { } while (0)
29# ifdef CONFIG_X86_64
30# define __ARCH_HAS_DO_SOFTIRQ
31# endif
32#endif 28#endif
33 29
30#define __ARCH_HAS_DO_SOFTIRQ
31
34#ifdef CONFIG_HOTPLUG_CPU 32#ifdef CONFIG_HOTPLUG_CPU
35#include <linux/cpumask.h> 33#include <linux/cpumask.h>
36extern void fixup_irqs(void); 34extern void fixup_irqs(void);
diff --git a/arch/x86/include/asm/module.h b/arch/x86/include/asm/module.h
index 3e2ce58a31a3..67763c5d8b4e 100644
--- a/arch/x86/include/asm/module.h
+++ b/arch/x86/include/asm/module.h
@@ -60,12 +60,7 @@
60#endif 60#endif
61 61
62#ifdef CONFIG_X86_32 62#ifdef CONFIG_X86_32
63# ifdef CONFIG_4KSTACKS 63# define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
64# define MODULE_STACKSIZE "4KSTACKS "
65# else
66# define MODULE_STACKSIZE ""
67# endif
68# define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE
69#endif 64#endif
70 65
71#endif /* _ASM_X86_MODULE_H */ 66#endif /* _ASM_X86_MODULE_H */
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h
index 6f1b7331313f..ade619ff9e2a 100644
--- a/arch/x86/include/asm/page_32_types.h
+++ b/arch/x86/include/asm/page_32_types.h
@@ -15,11 +15,7 @@
15 */ 15 */
16#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) 16#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
17 17
18#ifdef CONFIG_4KSTACKS
19#define THREAD_ORDER 0
20#else
21#define THREAD_ORDER 1 18#define THREAD_ORDER 1
22#endif
23#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) 19#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
24 20
25#define STACKFAULT_STACK 0 21#define STACKFAULT_STACK 0
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 10709f29d166..50fbbe60e507 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -49,20 +49,19 @@ static inline int check_stack_overflow(void) { return 0; }
49static inline void print_stack_overflow(void) { } 49static inline void print_stack_overflow(void) { }
50#endif 50#endif
51 51
52#ifdef CONFIG_4KSTACKS
53/* 52/*
54 * per-CPU IRQ handling contexts (thread information and stack) 53 * per-CPU IRQ handling contexts (thread information and stack)
55 */ 54 */
56union irq_ctx { 55union irq_ctx {
57 struct thread_info tinfo; 56 struct thread_info tinfo;
58 u32 stack[THREAD_SIZE/sizeof(u32)]; 57 u32 stack[THREAD_SIZE/sizeof(u32)];
59} __attribute__((aligned(PAGE_SIZE))); 58} __attribute__((aligned(THREAD_SIZE)));
60 59
61static DEFINE_PER_CPU(union irq_ctx *, hardirq_ctx); 60static DEFINE_PER_CPU(union irq_ctx *, hardirq_ctx);
62static DEFINE_PER_CPU(union irq_ctx *, softirq_ctx); 61static DEFINE_PER_CPU(union irq_ctx *, softirq_ctx);
63 62
64static DEFINE_PER_CPU_PAGE_ALIGNED(union irq_ctx, hardirq_stack); 63static DEFINE_PER_CPU_MULTIPAGE_ALIGNED(union irq_ctx, hardirq_stack, THREAD_SIZE);
65static DEFINE_PER_CPU_PAGE_ALIGNED(union irq_ctx, softirq_stack); 64static DEFINE_PER_CPU_MULTIPAGE_ALIGNED(union irq_ctx, softirq_stack, THREAD_SIZE);
66 65
67static void call_on_stack(void *func, void *stack) 66static void call_on_stack(void *func, void *stack)
68{ 67{
@@ -187,11 +186,6 @@ asmlinkage void do_softirq(void)
187 local_irq_restore(flags); 186 local_irq_restore(flags);
188} 187}
189 188
190#else
191static inline int
192execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq) { return 0; }
193#endif
194
195bool handle_irq(unsigned irq, struct pt_regs *regs) 189bool handle_irq(unsigned irq, struct pt_regs *regs)
196{ 190{
197 struct irq_desc *desc; 191 struct irq_desc *desc;
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 38e2b67807e1..e03530aebfd0 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -301,7 +301,7 @@ SECTIONS
301 } 301 }
302 302
303#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP) 303#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
304 PERCPU(PAGE_SIZE) 304 PERCPU(THREAD_SIZE)
305#endif 305#endif
306 306
307 . = ALIGN(PAGE_SIZE); 307 . = ALIGN(PAGE_SIZE);
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 27ef6b190ea6..018db9a62ffe 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -148,6 +148,18 @@
148 DEFINE_PER_CPU_SECTION(type, name, "..readmostly") 148 DEFINE_PER_CPU_SECTION(type, name, "..readmostly")
149 149
150/* 150/*
151 * Declaration/definition used for large per-CPU variables that must be
152 * aligned to something larger than the pagesize.
153 */
154#define DECLARE_PER_CPU_MULTIPAGE_ALIGNED(type, name, size) \
155 DECLARE_PER_CPU_SECTION(type, name, "..page_aligned") \
156 __aligned(size)
157
158#define DEFINE_PER_CPU_MULTIPAGE_ALIGNED(type, name, size) \
159 DEFINE_PER_CPU_SECTION(type, name, "..page_aligned") \
160 __aligned(size)
161
162/*
151 * Intermodule exports for per-CPU variables. sparse forgets about 163 * Intermodule exports for per-CPU variables. sparse forgets about
152 * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to 164 * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to
153 * noop if __CHECKER__. 165 * noop if __CHECKER__.