Skip to content

Commit

Permalink
xen, cpu_hotplug: call device_offline instead of cpu_down
Browse files Browse the repository at this point in the history
When offlining a cpu, instead of cpu_down, call device_offline, which
also takes care of updating the cpu.dev.offline field. This keeps the
sysfs file /sys/devices/system/cpu/cpuN/online, up to date.  Also move
the call to disable_hotplug_cpu, because it makes more sense to have it
there.

We don't call device_online at cpu-hotplug time, because that would
immediately take the cpu online, while we want to retain the current
behaviour: the user needs to explicitly enable the cpu after it has
been hotplugged.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: konrad.wilk@oracle.com
CC: boris.ostrovsky@oracle.com
CC: david.vrabel@citrix.com
  • Loading branch information
Stefano Stabellini authored and David Vrabel committed Oct 23, 2015
1 parent a314e3e commit 1c7a621
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/xen/cpu_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ static void enable_hotplug_cpu(int cpu)

static void disable_hotplug_cpu(int cpu)
{
if (cpu_online(cpu)) {
lock_device_hotplug();
device_offline(get_cpu_device(cpu));
unlock_device_hotplug();
}
if (cpu_present(cpu))
xen_arch_unregister_cpu(cpu);

Expand Down Expand Up @@ -55,7 +60,6 @@ static void vcpu_hotplug(unsigned int cpu)
enable_hotplug_cpu(cpu);
break;
case 0:
(void)cpu_down(cpu);
disable_hotplug_cpu(cpu);
break;
default:
Expand Down

0 comments on commit 1c7a621

Please sign in to comment.