linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1 RESEND 2] ARM: plat-versatile: move secondary CPU startup out of .init.
@ 2012-11-27  8:39 Claudio Fontana
  2012-11-27  8:43 ` [PATCH 1/1 " Claudio Fontana
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Claudio Fontana @ 2012-11-27  8:39 UTC (permalink / raw)
  To: Russell King; +Cc: linux-arm-kernel, linux-kernel, Christoffer Dall


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(-)

-- 
1.7.12.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1 RESEND 2] ARM: plat-versatile: move secondary CPU startup out of .init.
  2012-11-27  8:39 [PATCH 0/1 RESEND 2] ARM: plat-versatile: move secondary CPU startup out of .init Claudio Fontana
@ 2012-11-27  8:43 ` Claudio Fontana
  2012-12-12  8:59 ` [PATCH RESEND 3] ARM: plat-versatile: move secondary CPU startup into cpuinit Claudio Fontana
  2012-12-18  8:42 ` [PATCH RESEND 4] " Claudio Fontana
  2 siblings, 0 replies; 5+ messages in thread
From: Claudio Fontana @ 2012-11-27  8:43 UTC (permalink / raw)
  To: Russell King; +Cc: linux-arm-kernel, linux-kernel, Christoffer Dall


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.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Tested-by: Claudio Fontana <claudio.fontana@huawei.com>

diff --git a/arch/arm/plat-versatile/headsmp.S b/arch/arm/plat-versatile/headsmp.S
index dd703ef..19fe180 100644
--- a/arch/arm/plat-versatile/headsmp.S
+++ b/arch/arm/plat-versatile/headsmp.S
@@ -11,7 +11,7 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 
-	__INIT
+	__CPUINIT
 
 /*
  * Realview/Versatile Express specific entry point for secondary CPUs.
-- 
1.7.12.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH RESEND 3] ARM: plat-versatile: move secondary CPU startup into cpuinit
  2012-11-27  8:39 [PATCH 0/1 RESEND 2] ARM: plat-versatile: move secondary CPU startup out of .init Claudio Fontana
  2012-11-27  8:43 ` [PATCH 1/1 " Claudio Fontana
@ 2012-12-12  8:59 ` Claudio Fontana
  2012-12-18  8:42 ` [PATCH RESEND 4] " Claudio Fontana
  2 siblings, 0 replies; 5+ messages in thread
From: Claudio Fontana @ 2012-12-12  8:59 UTC (permalink / raw)
  To: Russell King; +Cc: linux-arm-kernel, linux-kernel, Christoffer Dall


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.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Tested-by: Claudio Fontana <claudio.fontana@huawei.com>

diff --git a/arch/arm/plat-versatile/headsmp.S b/arch/arm/plat-versatile/headsmp.S
index dd703ef..19fe180 100644
--- a/arch/arm/plat-versatile/headsmp.S
+++ b/arch/arm/plat-versatile/headsmp.S
@@ -11,7 +11,7 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 
-	__INIT
+	__CPUINIT
 
 /*
  * Realview/Versatile Express specific entry point for secondary CPUs.
-- 
1.7.12.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH RESEND 4] ARM: plat-versatile: move secondary CPU startup into cpuinit
  2012-11-27  8:39 [PATCH 0/1 RESEND 2] ARM: plat-versatile: move secondary CPU startup out of .init Claudio Fontana
  2012-11-27  8:43 ` [PATCH 1/1 " Claudio Fontana
  2012-12-12  8:59 ` [PATCH RESEND 3] ARM: plat-versatile: move secondary CPU startup into cpuinit Claudio Fontana
@ 2012-12-18  8:42 ` Claudio Fontana
  2012-12-30  4:09   ` Christoffer Dall
  2 siblings, 1 reply; 5+ messages in thread
From: Claudio Fontana @ 2012-12-18  8:42 UTC (permalink / raw)
  To: Russell King; +Cc: linux-arm-kernel, linux-kernel, Christoffer Dall


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. 

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Tested-by: Claudio Fontana <claudio.fontana@huawei.com>

diff --git a/arch/arm/plat-versatile/headsmp.S b/arch/arm/plat-versatile/headsmp.S
index dd703ef..19fe180 100644
--- a/arch/arm/plat-versatile/headsmp.S
+++ b/arch/arm/plat-versatile/headsmp.S
@@ -11,7 +11,7 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 
-	__INIT
+	__CPUINIT
 
 /*
  * Realview/Versatile Express specific entry point for secondary CPUs.
-- 
1.7.12.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND 4] ARM: plat-versatile: move secondary CPU startup into cpuinit
  2012-12-18  8:42 ` [PATCH RESEND 4] " Claudio Fontana
@ 2012-12-30  4:09   ` Christoffer Dall
  0 siblings, 0 replies; 5+ messages in thread
From: Christoffer Dall @ 2012-12-30  4:09 UTC (permalink / raw)
  To: Claudio Fontana; +Cc: Russell King, linux-arm-kernel, linux-kernel

On Tue, Dec 18, 2012 at 3:42 AM, Claudio Fontana
<Claudio.Fontana@huawei.com> wrote:
>
> 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?

>
> Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
> Tested-by: Claudio Fontana <claudio.fontana@huawei.com>
>
> diff --git a/arch/arm/plat-versatile/headsmp.S b/arch/arm/plat-versatile/headsmp.S
> index dd703ef..19fe180 100644
> --- a/arch/arm/plat-versatile/headsmp.S
> +++ b/arch/arm/plat-versatile/headsmp.S
> @@ -11,7 +11,7 @@
>  #include <linux/linkage.h>
>  #include <linux/init.h>
>
> -       __INIT
> +       __CPUINIT
>
>  /*
>   * Realview/Versatile Express specific entry point for secondary CPUs.
> --
> 1.7.12.1
>

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

-Christoffer

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-30  4:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-27  8:39 [PATCH 0/1 RESEND 2] ARM: plat-versatile: move secondary CPU startup out of .init Claudio Fontana
2012-11-27  8:43 ` [PATCH 1/1 " Claudio Fontana
2012-12-12  8:59 ` [PATCH RESEND 3] ARM: plat-versatile: move secondary CPU startup into cpuinit Claudio Fontana
2012-12-18  8:42 ` [PATCH RESEND 4] " Claudio Fontana
2012-12-30  4:09   ` Christoffer Dall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).