Re: [PATCH v2] KVM: vgic: Use wrapper function to lock/unlock all vcpus in kvm_vgic_create()

From: linmiaohe
Date: Thu Nov 28 2019 - 06:16:33 EST


Steven Price wrote:
>>
>> if (irqchip_in_kernel(kvm))
>> @@ -92,11 +92,8 @@ int kvm_vgic_create(struct kvm *kvm, u32 type)
>Extra context:
>
> /*
> * Any time a vcpu is run, vcpu_load is called which tries to grab the
> * vcpu->mutex. By grabbing the vcpu->mutex of all VCPUs we ensure
>> * that no other VCPUs are run while we create the vgic.
>> */
>
>That comment no longer makes sense here - there's a very similar one already in lock_all_vcpus(). With that removed:
>
>Reviewed-by: Steven Price <steven.price@xxxxxxx>
>
Many thanks for your review. That comment no longer makes sense as you figured out. I will
remove that. Thanks again.

>> ret = -EBUSY;
>> - kvm_for_each_vcpu(i, vcpu, kvm) {
>> - if (!mutex_trylock(&vcpu->mutex))
>> - goto out_unlock;
>> - vcpu_lock_idx = i;