A couple slight improvements, after which get_enable_apicv is unused. Paolo On 14/11/19 21:15, Suravee Suthikulpanit wrote: > @@ -6848,6 +6848,7 @@ static int vmx_vm_init(struct kvm *kvm) > break; > } > } > + kvm_apicv_init(kvm, vmx_get_enable_apicv(kvm)); > return 0; > } > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 01f60d6cd881..d011ffaec7ee 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -6852,7 +6852,7 @@ static int vmx_vm_init(struct kvm *kvm) break; } } - kvm_apicv_init(kvm, vmx_get_enable_apicv(kvm)); + kvm_apicv_init(kvm, enable_apicv); return 0; } > @@ -9347,10 +9364,11 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) > goto fail_free_pio_data; > > if (irqchip_in_kernel(vcpu->kvm)) { > - vcpu->arch.apicv_active = kvm_x86_ops->get_enable_apicv(vcpu->kvm); > r = kvm_create_lapic(vcpu, lapic_timer_advance_ns); > if (r < 0) > goto fail_mmu_destroy; > + if (kvm_apicv_activated(vcpu->kvm)) > + vcpu->arch.apicv_active = kvm_x86_ops->get_enable_apicv(vcpu->kvm); > } else > static_key_slow_inc(&kvm_no_apic_vcpu); > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6c62abb4fdd9..cc9f84527a55 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9236,7 +9236,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) if (r < 0) goto fail_mmu_destroy; if (kvm_apicv_activated(vcpu->kvm)) - vcpu->arch.apicv_active = kvm_x86_ops->get_enable_apicv(vcpu->kvm); + vcpu->arch.apicv_active = true; } else static_key_slow_inc(&kvm_no_apic_vcpu);