Skip to contentSkip to conversation

ARM: plat-versatile: move secondary CPU startup out of .init.

PATCH RESEND New Claudio Fontana 2 participants 5 messages Nov 27, 2012 – Dec 30, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ARM: plat-versatile: move secondary CPU startup out of .init.

Hello,

I am implementing virtual CPU hotplug for the the ARM Cortex A-15 VExpress motherboard. This is mainly a QEMU feature, which allows dynamically changing the number of CPUs in the guest.

I stumbled upon a limitation in the kernel support for plat-versatile, which contains the secondary CPU startup code for the VExpress.

Basically, the secondary CPU startup code is preceded by the macro __INIT, which causes the code to be freed in free_initmem() during kernel_init().

This means that any attempt at hot-booting CPUs in the guest results in VCPUs jumping to a memory address that was freed, after which the VCPU behaves erratically, as can be expected.

With this patch applied, we use __CPUINIT instead of __INIT, so that the right thing happens:
under CONFIG_HOTPLUG_CPU, the secondary CPU startup code is not freed, the secondary VCPUs start successfully, and it's all gardens and blue skies.

Tested successfully using the ARM fast models for the Cortex-A15.

--
Claudio Fontana (1):
ARM: plat-versatile: move secondary CPU startup code out of .init.

 arch/arm/plat-versatile/headsmp.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
1.7.12.1
#1 lore raw

PATCH RESEND 1/1 ARM: plat-versatile: move secondary CPU startup out of .init.

Using __CPUINIT instead of __INIT puts the secondary CPU startup code into the "right" section: it will not be freed in hotplug configurations, allowing hot-add of cpus, while still getting freed in non-hotplug configs.

arch/arm/plat-versatile/headsmp.S +1 -1
index dd703ef..19fe180 100644
@@ -11,7 +11,7 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 
-	__INIT
+	__CPUINIT
 
 /*
  * Realview/Versatile Express specific entry point for secondary CPUs.
Signature · 1 line
1.7.12.1
#2 lore raw

PATCH RESEND 1/1 ARM: plat-versatile: move secondary CPU startup into cpuinit

In reply to Claudio Fontana

Using __CPUINIT instead of __INIT puts the secondary CPU startup code into the "right" section: it will not be freed in hotplug configurations, allowing hot-add of cpus, while still getting freed in non-hotplug configs.

arch/arm/plat-versatile/headsmp.S +1 -1
index dd703ef..19fe180 100644
@@ -11,7 +11,7 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 
-	__INIT
+	__CPUINIT
 
 /*
  * Realview/Versatile Express specific entry point for secondary CPUs.
Signature · 1 line
1.7.12.1
#3 lore raw

PATCH RESEND 1/1 ARM: plat-versatile: move secondary CPU startup into cpuinit

In reply to Claudio Fontana

Using __CPUINIT instead of __INIT puts the secondary CPU startup code into the "right" section: it will not be freed in hotplug configurations, allowing hot-add of cpus, while still getting freed in non-hotplug configs.

Tested successfully on Fast-Models and on Arndale for VCPU hotplug.

arch/arm/plat-versatile/headsmp.S +1 -1
index dd703ef..19fe180 100644
@@ -11,7 +11,7 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 
-	__INIT
+	__CPUINIT
 
 /*
  * Realview/Versatile Express specific entry point for secondary CPUs.
Signature · 1 line
1.7.12.1
#4 lore raw

Re: [PATCH RESEND 4] ARM: plat-versatile: move secondary CPU startup into cpuinit

Quoted 6 lines · Claudio Fontana

Using __CPUINIT instead of __INIT puts the secondary CPU startup code into the "right" section: it will not be freed in hotplug configurations, allowing hot-add of cpus, while still getting freed in non-hotplug configs.

Tested successfully on Fast-Models and on Arndale for VCPU hotplug.

not quite sure how testing on Arndale verifies this change?

Quoted 18 lines
arch/arm/plat-versatile/headsmp.S +1 -2
index dd703ef..19fe180 100644
@@ -11,7 +11,7 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 
-       __INIT
+       __CPUINIT
 
 /*
  * Realview/Versatile Express specific entry point for secondary CPUs.
--
Quoted 2 lines

1.7.12.1

Otherwise looks ok to me (not guaranteeing that cpu hotplug will magically work for KVM using this change though).

-Christoffer