summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorIsaku Yamahata <isaku.yamahata@intel.com>2022-12-01 00:09:29 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2022-12-29 21:48:34 +0100
commit667a83bf6a30b5660d02712dce9fb07e99abde38 (patch)
tree7f213e7d16f3983acda38553a0192155c9fce731 /virt
parentKVM: Drop kvm_count_lock and instead protect kvm_usage_count with kvm_lock (diff)
downloadlinux-667a83bf6a30b5660d02712dce9fb07e99abde38.tar.xz
linux-667a83bf6a30b5660d02712dce9fb07e99abde38.zip
KVM: Remove on_each_cpu(hardware_disable_nolock) in kvm_exit()
Drop the superfluous invocation of hardware_disable_nolock() during kvm_exit(), as it's nothing more than a glorified nop. KVM automatically disables hardware on all CPUs when the last VM is destroyed, and kvm_exit() cannot be called until the last VM goes away as the calling module is pinned by an elevated refcount of the fops associated with /dev/kvm. This holds true even on x86, where the caller of kvm_exit() is not kvm.ko, but is instead a dependent module, kvm_amd.ko or kvm_intel.ko, as kvm_chardev_ops.owner is set to the module that calls kvm_init(), not hardcoded to the base kvm.ko module. Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> [sean: rework changelog] Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20221130230934.1014142-46-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index f6caee790dc8..d1ed34856412 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -6050,7 +6050,6 @@ void kvm_exit(void)
unregister_syscore_ops(&kvm_syscore_ops);
unregister_reboot_notifier(&kvm_reboot_notifier);
cpuhp_remove_state_nocalls(CPUHP_AP_KVM_ONLINE);
- on_each_cpu(hardware_disable_nolock, NULL, 1);
kvm_irqfd_exit();
free_cpumask_var(cpus_hardware_enabled);
}