Skip to content

Commit

Permalink
Drivers: hv: vmbus: use cpu_hotplug_enable/disable
Browse files Browse the repository at this point in the history
Commit e513229 ("Drivers: hv: vmbus: prevent cpu offlining on newer
hypervisors") was altering smp_ops.cpu_disable to prevent CPU offlining.
We can bo better by using cpu_hotplug_enable/disable functions instead of
such hard-coding.

Reported-by: Radim Kr.má  <rkrcmar@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Vitaly Kuznetsov authored and Greg Kroah-Hartman committed Aug 5, 2015
1 parent 32145c4 commit f39c428
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions drivers/hv/vmbus_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,38 +828,6 @@ static void vmbus_isr(void)
}
}

#ifdef CONFIG_HOTPLUG_CPU
static int hyperv_cpu_disable(void)
{
return -ENOSYS;
}

static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
{
static void *previous_cpu_disable;

/*
* Offlining a CPU when running on newer hypervisors (WS2012R2, Win8,
* ...) is not supported at this moment as channel interrupts are
* distributed across all of them.
*/

if ((vmbus_proto_version == VERSION_WS2008) ||
(vmbus_proto_version == VERSION_WIN7))
return;

if (vmbus_loaded) {
previous_cpu_disable = smp_ops.cpu_disable;
smp_ops.cpu_disable = hyperv_cpu_disable;
pr_notice("CPU offlining is not supported by hypervisor\n");
} else if (previous_cpu_disable)
smp_ops.cpu_disable = previous_cpu_disable;
}
#else
static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
{
}
#endif

/*
* vmbus_bus_init -Main vmbus driver initialization routine.
Expand Down Expand Up @@ -901,7 +869,8 @@ static int vmbus_bus_init(int irq)
if (ret)
goto err_alloc;

hv_cpu_hotplug_quirk(true);
if (vmbus_proto_version > VERSION_WIN7)
cpu_hotplug_disable();

/*
* Only register if the crash MSRs are available
Expand Down Expand Up @@ -1364,7 +1333,8 @@ static void __exit vmbus_exit(void)
}
hv_synic_free();
acpi_bus_unregister_driver(&vmbus_acpi_driver);
hv_cpu_hotplug_quirk(false);
if (vmbus_proto_version > VERSION_WIN7)
cpu_hotplug_enable();
}


Expand Down

0 comments on commit f39c428

Please sign in to comment.