| From | isaku.yamahata@intel ... | Subject | [PATCH v5 30/30] RFC: KVM: Remove cpus_hardware_enabled and related sanity check | Date | Thu, 22 Sep 2022 11:20:59 -0700 |
| |
From: Isaku Yamahata <isaku.yamahata@intel.com>
cpus_hardware_enabled mask seems incomplete protection against other kernel component using CPU virtualization feature. Because it's obscure and incomplete, remove the check.
Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> --- virt/kvm/kvm_arch.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/virt/kvm/kvm_arch.c b/virt/kvm/kvm_arch.c index 076a55d59988..e7708bfa0360 100644 --- a/virt/kvm/kvm_arch.c +++ b/virt/kvm/kvm_arch.c @@ -12,23 +12,16 @@ #include <linux/kvm_host.h> -static cpumask_t cpus_hardware_enabled = CPU_MASK_NONE; - static int __hardware_enable(void) { - int cpu = raw_smp_processor_id(); int r; WARN_ON_ONCE(preemptible()); - if (cpumask_test_cpu(cpu, &cpus_hardware_enabled)) - return 0; r = kvm_arch_hardware_enable(); if (r) pr_warn("kvm: enabling virtualization on CPU%d failed during %pSb\n", - cpu, __builtin_return_address(0)); - else - cpumask_set_cpu(cpu, &cpus_hardware_enabled); + smp_processor_id(), __builtin_return_address(0)); return r; } @@ -42,13 +35,7 @@ static void hardware_enable(void *arg) static void hardware_disable(void *junk) { - int cpu = raw_smp_processor_id(); - WARN_ON_ONCE(preemptible()); - - if (!cpumask_test_cpu(cpu, &cpus_hardware_enabled)) - return; - cpumask_clear_cpu(cpu, &cpus_hardware_enabled); kvm_arch_hardware_disable(); } -- 2.25.1
|