[lkml]   [2012]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] xen/cpu: Make VCPU hotplug code online CPUs properly.
Offlining CPUs works. Onlining does not work anymore and it looks
like we were missing a cpu_up() call in the hotplug bring up path.

When the vCPUs are initialized, if they are onlined or never had
been in use (so maxcpus > vcpus) the vCPUs are in xen_play_dead
having called VCPUOP_down and are not running. When a vCPU is
onlined, the bootup (or any other currently running CPU) is suppose
to call VCPUOP_up on the vCPU that is not running and make the
vCPU unhinge itself out of the xen_play_dead and continue in
cpu_idle. We did not make the hypercall on onlining, nor did we
recreate the timer, spinlocks, ipi interrupts so the vCPU never
was onlined. This patch fixes it by calling cpu_on() and we
also make the code more readable.

Signed-off-by: Konrad Rzeszutek Wilk <>
drivers/xen/cpu_hotplug.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c
index 4dcfced..df80af8 100644
--- a/drivers/xen/cpu_hotplug.c
+++ b/drivers/xen/cpu_hotplug.c
@@ -8,18 +8,20 @@

static void enable_hotplug_cpu(int cpu)
- if (!cpu_present(cpu))
+ if (!cpu_present(cpu)) {
- set_cpu_present(cpu, true);
+ set_cpu_present(cpu, true);
+ (void)cpu_up(cpu);
+ }

static void disable_hotplug_cpu(int cpu)
- if (cpu_present(cpu))
+ if (cpu_present(cpu)) {
+ (void)cpu_down(cpu);
+ set_cpu_present(cpu, false);
- set_cpu_present(cpu, false);
+ }

static int vcpu_online(unsigned int cpu)
@@ -53,7 +55,6 @@ static void vcpu_hotplug(unsigned int cpu)
case 0:
- (void)cpu_down(cpu);

 \ /
  Last update: 2012-02-10 15:49    [W:0.052 / U:6.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site