From: Paolo Bonzini Date: Thu, 12 Sep 2024 15:13:05 +0000 (-0400) Subject: Merge branch 'kvm-redo-enable-virt' into HEAD X-Git-Tag: v6.12-rc1~11^2~8 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=c09dd2bb5748075d995ae46c2d18423032230f9b;p=linux-block.git Merge branch 'kvm-redo-enable-virt' into HEAD Register KVM's cpuhp and syscore callbacks when enabling virtualization in hardware, as the sole purpose of said callbacks is to disable and re-enable virtualization as needed. The primary motivation for this series is to simplify dealing with enabling virtualization for Intel's TDX, which needs to enable virtualization when kvm-intel.ko is loaded, i.e. long before the first VM is created. That said, this is a nice cleanup on its own. By registering the callbacks on-demand, the callbacks themselves don't need to check kvm_usage_count, because their very existence implies a non-zero count. Patch 1 (re)adds a dedicated lock for kvm_usage_count. This avoids a lock ordering issue between cpus_read_lock() and kvm_lock. The lock ordering issue still exist in very rare cases, and will be fixed for good by switching vm_list to an (S)RCU-protected list. Signed-off-by: Paolo Bonzini --- c09dd2bb5748075d995ae46c2d18423032230f9b