x86, 32-bit: Align percpu area and irq stacks to THREAD_SIZE
authorAlexander van Heukelum <heukelum@fastmail.fm>
Mon, 6 Sep 2010 18:53:42 +0000 (20:53 +0200)
committerIngo Molnar <mingo@elte.hu>
Tue, 7 Sep 2010 03:07:00 +0000 (05:07 +0200)
The irq stacks, located in the percpu-area, need to be
THREAD_SIZE aligned. Add the infrastucture to align percpu
variables to larger-than-pagesize amounts within the percpu
area, and use it to specify the alignment for the irq stacks.
Also align the percpu area itself to THREAD_SIZE.

This should make irq stacks work with 8K THREAD_SIZE.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Cc: Tejun Heo <tj@kernel.org>
Cc: hch@lst.de
LKML-Reference: <1283799222.15941.1393621887@webmail.messagingengine.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/irq_32.c
arch/x86/kernel/vmlinux.lds.S
include/linux/percpu-defs.h

index 3b5609f54c4b5edba8ada8691e75635b0a1de1b0..50fbbe60e5074efcc11600616e32e21e3ca31551 100644 (file)
@@ -60,8 +60,8 @@ union irq_ctx {
 static DEFINE_PER_CPU(union irq_ctx *, hardirq_ctx);
 static DEFINE_PER_CPU(union irq_ctx *, softirq_ctx);
 
-static DEFINE_PER_CPU_PAGE_ALIGNED(union irq_ctx, hardirq_stack);
-static DEFINE_PER_CPU_PAGE_ALIGNED(union irq_ctx, softirq_stack);
+static DEFINE_PER_CPU_MULTIPAGE_ALIGNED(union irq_ctx, hardirq_stack, THREAD_SIZE);
+static DEFINE_PER_CPU_MULTIPAGE_ALIGNED(union irq_ctx, softirq_stack, THREAD_SIZE);
 
 static void call_on_stack(void *func, void *stack)
 {
index d0bb52296fa3a8f564cdb1964107e677494859ed..bb899475355db8312e8353610c76ca02892f5ecc 100644 (file)
@@ -273,7 +273,7 @@ SECTIONS
        }
 
 #if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
-       PERCPU(PAGE_SIZE)
+       PERCPU(THREAD_SIZE)
 #endif
 
        . = ALIGN(PAGE_SIZE);
index ce2dc655cd1d40a6765acc2dd3f49e104bca4f5c..ab20d119a85d6eb031b2fdbf0ff919f03307330c 100644 (file)
        DEFINE_PER_CPU_SECTION(type, name, "..page_aligned")            \
        __aligned(PAGE_SIZE)
 
+/*
+ * Declaration/definition used for large per-CPU variables that must be
+ * aligned to something larger than the pagesize.
+ */
+#define DECLARE_PER_CPU_MULTIPAGE_ALIGNED(type, name, size)            \
+       DECLARE_PER_CPU_SECTION(type, name, "..page_aligned")           \
+       __aligned(size)
+
+#define DEFINE_PER_CPU_MULTIPAGE_ALIGNED(type, name, size)             \
+       DEFINE_PER_CPU_SECTION(type, name, "..page_aligned")            \
+       __aligned(size)
+
 /*
  * Intermodule exports for per-CPU variables.  sparse forgets about
  * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to