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

From: Suravee Suthikulpanit
Date: Wed May 06 2020 - 21:29:30 EST




On 5/6/20 11:29 PM, Paolo Bonzini wrote:
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


Right, that's better idea. I'll send out V2 separately.

Thanks,
Suravee