Re: [PATCH 2/4] KVM: SVM: Fixes setting V_IRQ while AVIC is still enabled

From: Paolo Bonzini
Date: Wed May 06 2020 - 12:29:57 EST


On 06/05/20 15:17, Suravee Suthikulpanit wrote:
> */
> -void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit)
> +void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit,
> + struct kvm_vcpu *except)
> {
> unsigned long old, new, expected;
>
> @@ -8110,7 +8111,16 @@ void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit)
> trace_kvm_apicv_update_request(activate, bit);
> if (kvm_x86_ops.pre_update_apicv_exec_ctrl)
> kvm_x86_ops.pre_update_apicv_exec_ctrl(kvm, activate);
> - kvm_make_all_cpus_request(kvm, KVM_REQ_APICV_UPDATE);
> +
> + /*
> + * Sending request to update APICV for all other vcpus,
> + * while update the calling vcpu immediately instead of
> + * waiting for another #VMEXIT to handle the request.
> + */
> + kvm_make_all_cpus_request_except(kvm, KVM_REQ_APICV_UPDATE,
> + except);
> + if (except)
> + kvm_vcpu_update_apicv(except);

Can you use kvm_get_running_vcpu() instead of touching all callers?
Also a slightly better subject would be "KVM: SVM: Disable AVIC before
setting V_IRQ".

Paolo