Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0415b00d authored by Tejun Heo's avatar Tejun Heo
Browse files

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: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarMike 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
parent 6c510389
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -39,7 +39,7 @@ SECTIONS
	__init_begin = ALIGN(PAGE_SIZE);
	__init_begin = ALIGN(PAGE_SIZE);
	INIT_TEXT_SECTION(PAGE_SIZE)
	INIT_TEXT_SECTION(PAGE_SIZE)
	INIT_DATA_SECTION(16)
	INIT_DATA_SECTION(16)
	PERCPU(L1_CACHE_BYTES, PAGE_SIZE)
	PERCPU_SECTION(L1_CACHE_BYTES)
	/* Align to THREAD_SIZE rather than PAGE_SIZE here so any padding page
	/* Align to THREAD_SIZE rather than PAGE_SIZE here so any padding page
	   needed for the THREAD_SIZE aligned init_task gets freed after init */
	   needed for the THREAD_SIZE aligned init_task gets freed after init */
	. = ALIGN(THREAD_SIZE);
	. = ALIGN(THREAD_SIZE);
+1 −1
Original line number Original line Diff line number Diff line
@@ -82,7 +82,7 @@ SECTIONS
#endif
#endif
	}
	}


	PERCPU(32, PAGE_SIZE)
	PERCPU_SECTION(32)


#ifndef CONFIG_XIP_KERNEL
#ifndef CONFIG_XIP_KERNEL
	. = ALIGN(PAGE_SIZE);
	. = ALIGN(PAGE_SIZE);
+1 −1
Original line number Original line Diff line number Diff line
@@ -136,7 +136,7 @@ SECTIONS


	. = ALIGN(16);
	. = ALIGN(16);
	INIT_DATA_SECTION(16)
	INIT_DATA_SECTION(16)
	PERCPU(32, PAGE_SIZE)
	PERCPU_SECTION(32)


	.exit.data :
	.exit.data :
	{
	{
+1 −1
Original line number Original line Diff line number Diff line
@@ -102,7 +102,7 @@ SECTIONS
#endif
#endif
	__vmlinux_end = .;		/* Last address of the physical file. */
	__vmlinux_end = .;		/* Last address of the physical file. */
#ifdef CONFIG_ETRAX_ARCH_V32
#ifdef CONFIG_ETRAX_ARCH_V32
	PERCPU(32, PAGE_SIZE)
	PERCPU_SECTION(32)


	.init.ramfs : {
	.init.ramfs : {
		INIT_RAM_FS
		INIT_RAM_FS
+1 −1
Original line number Original line Diff line number Diff line
@@ -37,7 +37,7 @@ SECTIONS
  _einittext = .;
  _einittext = .;


  INIT_DATA_SECTION(8)
  INIT_DATA_SECTION(8)
  PERCPU(L1_CACHE_BYTES, 4096)
  PERCPU_SECTION(L1_CACHE_BYTES)


  . = ALIGN(PAGE_SIZE);
  . = ALIGN(PAGE_SIZE);
  __init_end = .;
  __init_end = .;
Loading