aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-03-24 13:50:09 -0400
committerTejun Heo <tj@kernel.org>2011-03-24 13:50:09 -0400
commit0415b00d175e0d8945e6785aad21b5f157976ce0 (patch)
treecf6f9286a47a22bf57766a3f17eaf4190bc9c242 /include/asm-generic
parent6c5103890057b1bb781b26b7aae38d33e4c517d8 (diff)
percpu: Always align percpu output section to PAGE_SIZE
Percpu allocator honors alignment request upto PAGE_SIZE and both the percpu addresses in the percpu address space and the translated kernel addresses should be aligned accordingly. The calculation of the former depends on the alignment of percpu output section in the kernel image. The linker script macros PERCPU_VADDR() and PERCPU() are used to define this output section and the latter takes @align parameter. Several architectures are using @align smaller than PAGE_SIZE breaking percpu memory alignment. This patch removes @align parameter from PERCPU(), renames it to PERCPU_SECTION() and makes it always align to PAGE_SIZE. While at it, add PCPU_SETUP_BUG_ON() checks such that alignment problems are reliably detected and remove percpu alignment comment recently added in workqueue.c as the condition would trigger BUG way before reaching there. For um, this patch raises the alignment of percpu area. As the area is in .init, there shouldn't be any noticeable difference. This problem was discovered by David Howells while debugging boot failure on mn10300. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Mike Frysinger <vapier@gentoo.org> Cc: uclinux-dist-devel@blackfin.uclinux.org Cc: David Howells <dhowells@redhat.com> Cc: Jeff Dike <jdike@addtoit.com> Cc: user-mode-linux-devel@lists.sourceforge.net
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/vmlinux.lds.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 32c45e5fe0ab..f301cea5ca2d 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -15,7 +15,7 @@
15 * HEAD_TEXT_SECTION 15 * HEAD_TEXT_SECTION
16 * INIT_TEXT_SECTION(PAGE_SIZE) 16 * INIT_TEXT_SECTION(PAGE_SIZE)
17 * INIT_DATA_SECTION(...) 17 * INIT_DATA_SECTION(...)
18 * PERCPU(CACHELINE_SIZE, PAGE_SIZE) 18 * PERCPU_SECTION(CACHELINE_SIZE)
19 * __init_end = .; 19 * __init_end = .;
20 * 20 *
21 * _stext = .; 21 * _stext = .;
@@ -709,7 +709,7 @@
709 * 709 *
710 * Note that this macros defines __per_cpu_load as an absolute symbol. 710 * Note that this macros defines __per_cpu_load as an absolute symbol.
711 * If there is no need to put the percpu section at a predetermined 711 * If there is no need to put the percpu section at a predetermined
712 * address, use PERCPU(). 712 * address, use PERCPU_SECTION.
713 */ 713 */
714#define PERCPU_VADDR(cacheline, vaddr, phdr) \ 714#define PERCPU_VADDR(cacheline, vaddr, phdr) \
715 VMLINUX_SYMBOL(__per_cpu_load) = .; \ 715 VMLINUX_SYMBOL(__per_cpu_load) = .; \
@@ -729,20 +729,19 @@
729 . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data..percpu); 729 . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data..percpu);
730 730
731/** 731/**
732 * PERCPU - define output section for percpu area, simple version 732 * PERCPU_SECTION - define output section for percpu area, simple version
733 * @cacheline: cacheline size 733 * @cacheline: cacheline size
734 * @align: required alignment
735 * 734 *
736 * Align to @align and outputs output section for percpu area. This macro 735 * Align to PAGE_SIZE and outputs output section for percpu area. This
737 * doesn't manipulate @vaddr or @phdr and __per_cpu_load and 736 * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and
738 * __per_cpu_start will be identical. 737 * __per_cpu_start will be identical.
739 * 738 *
740 * This macro is equivalent to ALIGN(@align); PERCPU_VADDR(@cacheline,,) 739 * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,)
741 * except that __per_cpu_load is defined as a relative symbol against 740 * except that __per_cpu_load is defined as a relative symbol against
742 * .data..percpu which is required for relocatable x86_32 configuration. 741 * .data..percpu which is required for relocatable x86_32 configuration.
743 */ 742 */
744#define PERCPU(cacheline, align) \ 743#define PERCPU_SECTION(cacheline) \
745 . = ALIGN(align); \ 744 . = ALIGN(PAGE_SIZE); \
746 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \ 745 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
747 VMLINUX_SYMBOL(__per_cpu_load) = .; \ 746 VMLINUX_SYMBOL(__per_cpu_load) = .; \
748 VMLINUX_SYMBOL(__per_cpu_start) = .; \ 747 VMLINUX_SYMBOL(__per_cpu_start) = .; \