Index: linux/drivers/kvm/kvm_main.c =================================================================== --- linux/drivers/kvm/kvm_main.c (revision 4365) +++ linux/drivers/kvm/kvm_main.c (working copy) @@ -2113,6 +2113,16 @@ smp_call_function_single(cpu, kvm_arch_ops->hardware_disable, NULL, 0, 1); break; + } + return NOTIFY_OK; +} + +static int kvm_cpu_hotplug2(struct notifier_block *notifier, unsigned long val, + void *v) +{ + int cpu = (long)v; + + switch (val) { case CPU_UP_PREPARE: smp_call_function_single(cpu, kvm_arch_ops->hardware_enable, NULL, 0, 1); @@ -2126,6 +2136,11 @@ .priority = 20, /* must be > scheduler priority */ }; +static struct notifier_block kvm_cpu_notifier2 = { + .notifier_call = kvm_cpu_hotplug2, + .priority = 2, /* must be < scheduler priority */ +}; + static __init void kvm_init_debug(void) { struct kvm_stats_debugfs_item *p; @@ -2197,6 +2212,7 @@ on_each_cpu(kvm_arch_ops->hardware_enable, 0, 0, 1); r = register_cpu_notifier(&kvm_cpu_notifier); + register_cpu_notifier(&kvm_cpu_notifier2); if (r) goto out_free_1; register_reboot_notifier(&kvm_reboot_notifier); @@ -2226,6 +2242,7 @@ out_free_2: unregister_reboot_notifier(&kvm_reboot_notifier); unregister_cpu_notifier(&kvm_cpu_notifier); + unregister_cpu_notifier(&kvm_cpu_notifier2); out_free_1: on_each_cpu(kvm_arch_ops->hardware_disable, 0, 0, 1); kvm_arch_ops->hardware_unsetup(); @@ -2239,6 +2256,7 @@ sysdev_class_unregister(&kvm_sysdev_class); unregister_reboot_notifier(&kvm_reboot_notifier); unregister_cpu_notifier(&kvm_cpu_notifier); + unregister_cpu_notifier(&kvm_cpu_notifier2); on_each_cpu(kvm_arch_ops->hardware_disable, 0, 0, 1); kvm_arch_ops->hardware_unsetup(); kvm_arch_ops = NULL;