[PATCH] arm: add .text at __CPUINIT places to prevent section grandfathering

Paul Gortmaker paul.gortmaker at windriver.com
Wed Jul 31 13:06:58 EDT 2013


In commit 22f0a27367742f65130c0fb25ef00f7297e032c1
("init.h: remove __cpuinit sections from the kernel") the macros
like __CPUINIT were converted from .section commands to no-ops.

This caused CPU hotplug regressions because the code following
the __CPUINIT lines was now grandfathered into whatever the
previous section happened to be.  In most files, __CPUINIT was
at the top of the file, so there was no previous section.

However in the files changed here, there was a previous section,
and so we'd inadvertently garbage collect CPU hotplug related
code.  This changeset inserts ".text" into the exact same spot
that the __CPUINIT section markers were found prior to commit
8bd26e3a7e49af2697449bbcb7187a39dc85d672 ("arm: delete
__cpuinit/__CPUINIT usage from all ARM users:) in the three affected
files, as suggested by Russell.

Bisected-by: Simon Horman <horms at verge.net.au>
Reported-by: Magnus Damm <magnus.damm at gmail.com>
Reported-by: Russell King <rmk+kernel at arm.linux.org.uk>
Signed-off-by: Paul Gortmaker <paul.gortmaker at windriver.com>
---

[NB: Untested - I've not got an SMP ARM handy at the moment]

 arch/arm/kernel/head-common.S | 1 +
 arch/arm/kernel/head-nommu.S  | 1 +
 arch/arm/kernel/head.S        | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 47cd974..def853e 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -149,6 +149,7 @@ ENDPROC(lookup_processor_type)
  *	r5 = proc_info pointer in physical address space
  *	r9 = cpuid (preserved)
  */
+	.text
 __lookup_processor_type:
 	adr	r3, __lookup_processor_type_data
 	ldmia	r3, {r4 - r6}
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index b361de1..14235ba 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -87,6 +87,7 @@ ENTRY(stext)
 ENDPROC(stext)
 
 #ifdef CONFIG_SMP
+	.text
 ENTRY(secondary_startup)
 	/*
 	 * Common entry point for secondary CPUs.
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 9cf6063..2c7cc1e 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -343,6 +343,7 @@ __turn_mmu_on_loc:
 	.long	__turn_mmu_on_end
 
 #if defined(CONFIG_SMP)
+	.text
 ENTRY(secondary_startup)
 	/*
 	 * Common entry point for secondary CPUs.
-- 
1.8.1.2




More information about the linux-arm-kernel mailing list