aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-09-10 06:57:17 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2013-09-30 03:21:30 -0400
commit4fa92fb25ae5a2d79d872ab54df511c831b1f363 (patch)
treee8d25b4fb392cc7ec498346d40a593f2cf5953f2 /virt
parentfeaf0c7dc473fefa1f263d88788f57e39b4b007e (diff)
KVM: cleanup (physical) CPU hotplug
Remove the useless argument, and do not do anything if there are no VMs running at the time of the hotplug. Cc: kvm@vger.kernel.org Cc: gleb@redhat.com Cc: jan.kiszka@siemens.com Reviewed-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 979bff485fb0..426051d66173 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2681,10 +2681,11 @@ static void hardware_enable_nolock(void *junk)
2681 } 2681 }
2682} 2682}
2683 2683
2684static void hardware_enable(void *junk) 2684static void hardware_enable(void)
2685{ 2685{
2686 raw_spin_lock(&kvm_lock); 2686 raw_spin_lock(&kvm_lock);
2687 hardware_enable_nolock(junk); 2687 if (kvm_usage_count)
2688 hardware_enable_nolock(NULL);
2688 raw_spin_unlock(&kvm_lock); 2689 raw_spin_unlock(&kvm_lock);
2689} 2690}
2690 2691
@@ -2698,10 +2699,11 @@ static void hardware_disable_nolock(void *junk)
2698 kvm_arch_hardware_disable(NULL); 2699 kvm_arch_hardware_disable(NULL);
2699} 2700}
2700 2701
2701static void hardware_disable(void *junk) 2702static void hardware_disable(void)
2702{ 2703{
2703 raw_spin_lock(&kvm_lock); 2704 raw_spin_lock(&kvm_lock);
2704 hardware_disable_nolock(junk); 2705 if (kvm_usage_count)
2706 hardware_disable_nolock(NULL);
2705 raw_spin_unlock(&kvm_lock); 2707 raw_spin_unlock(&kvm_lock);
2706} 2708}
2707 2709
@@ -2748,20 +2750,17 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val,
2748{ 2750{
2749 int cpu = (long)v; 2751 int cpu = (long)v;
2750 2752
2751 if (!kvm_usage_count)
2752 return NOTIFY_OK;
2753
2754 val &= ~CPU_TASKS_FROZEN; 2753 val &= ~CPU_TASKS_FROZEN;
2755 switch (val) { 2754 switch (val) {
2756 case CPU_DYING: 2755 case CPU_DYING:
2757 printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", 2756 printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n",
2758 cpu); 2757 cpu);
2759 hardware_disable(NULL); 2758 hardware_disable();
2760 break; 2759 break;
2761 case CPU_STARTING: 2760 case CPU_STARTING:
2762 printk(KERN_INFO "kvm: enabling virtualization on CPU%d\n", 2761 printk(KERN_INFO "kvm: enabling virtualization on CPU%d\n",
2763 cpu); 2762 cpu);
2764 hardware_enable(NULL); 2763 hardware_enable();
2765 break; 2764 break;
2766 } 2765 }
2767 return NOTIFY_OK; 2766 return NOTIFY_OK;