Skip to content

Commit 0415b00

Browse files
committed
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
1 parent 6c51038 commit 0415b00

File tree

20 files changed

+28
-29
lines changed

20 files changed

+28
-29
lines changed

arch/alpha/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ SECTIONS
3939
__init_begin = ALIGN(PAGE_SIZE);
4040
INIT_TEXT_SECTION(PAGE_SIZE)
4141
INIT_DATA_SECTION(16)
42-
PERCPU(L1_CACHE_BYTES, PAGE_SIZE)
42+
PERCPU_SECTION(L1_CACHE_BYTES)
4343
/* Align to THREAD_SIZE rather than PAGE_SIZE here so any padding page
4444
needed for the THREAD_SIZE aligned init_task gets freed after init */
4545
. = ALIGN(THREAD_SIZE);

arch/arm/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ SECTIONS
8282
#endif
8383
}
8484

85-
PERCPU(32, PAGE_SIZE)
85+
PERCPU_SECTION(32)
8686

8787
#ifndef CONFIG_XIP_KERNEL
8888
. = ALIGN(PAGE_SIZE);

arch/blackfin/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ SECTIONS
136136

137137
. = ALIGN(16);
138138
INIT_DATA_SECTION(16)
139-
PERCPU(32, PAGE_SIZE)
139+
PERCPU_SECTION(32)
140140

141141
.exit.data :
142142
{

arch/cris/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ SECTIONS
102102
#endif
103103
__vmlinux_end = .; /* Last address of the physical file. */
104104
#ifdef CONFIG_ETRAX_ARCH_V32
105-
PERCPU(32, PAGE_SIZE)
105+
PERCPU_SECTION(32)
106106

107107
.init.ramfs : {
108108
INIT_RAM_FS

arch/frv/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ SECTIONS
3737
_einittext = .;
3838

3939
INIT_DATA_SECTION(8)
40-
PERCPU(L1_CACHE_BYTES, 4096)
40+
PERCPU_SECTION(L1_CACHE_BYTES)
4141

4242
. = ALIGN(PAGE_SIZE);
4343
__init_end = .;

arch/m32r/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ SECTIONS
5353
__init_begin = .;
5454
INIT_TEXT_SECTION(PAGE_SIZE)
5555
INIT_DATA_SECTION(16)
56-
PERCPU(32, PAGE_SIZE)
56+
PERCPU_SECTION(32)
5757
. = ALIGN(PAGE_SIZE);
5858
__init_end = .;
5959
/* freed after init ends here */

arch/mips/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ SECTIONS
115115
EXIT_DATA
116116
}
117117

118-
PERCPU(1 << CONFIG_MIPS_L1_CACHE_SHIFT, PAGE_SIZE)
118+
PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
119119
. = ALIGN(PAGE_SIZE);
120120
__init_end = .;
121121
/* freed after init ends here */

arch/mn10300/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SECTIONS
7070
.exit.text : { EXIT_TEXT; }
7171
.exit.data : { EXIT_DATA; }
7272

73-
PERCPU(32, PAGE_SIZE)
73+
PERCPU_SECTION(32)
7474
. = ALIGN(PAGE_SIZE);
7575
__init_end = .;
7676
/* freed after init ends here */

arch/parisc/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ SECTIONS
145145
EXIT_DATA
146146
}
147147

148-
PERCPU(L1_CACHE_BYTES, PAGE_SIZE)
148+
PERCPU_SECTION(L1_CACHE_BYTES)
149149
. = ALIGN(PAGE_SIZE);
150150
__init_end = .;
151151
/* freed after init ends here */

arch/powerpc/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ SECTIONS
160160
INIT_RAM_FS
161161
}
162162

163-
PERCPU(L1_CACHE_BYTES, PAGE_SIZE)
163+
PERCPU_SECTION(L1_CACHE_BYTES)
164164

165165
. = ALIGN(8);
166166
.machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) {

0 commit comments

Comments
 (0)