Re: [PATCH v8 7/9] KVM: Move kvm_arch_vcpu_precreate() under kvm->lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 15, 2022, Sean Christopherson wrote:
> > It's safe to invoke kvm_arch_vcpu_precreate() within the protection of
> > kvm->lock directly rather than take into account in the implementation for
> > each architecture.
> 
> This absolutely needs to explain _why_ it's safe, e.g. only arm64, x86, and s390
> have non-nop implementations and they're all simple and short with no tendrils
> into other code that might take kvm->lock.
> 
> And as before, I suspect arm64 needs this protection, the vgic_initialized()
> check looks racy.  Though it's hard to tell if doing the check under kvm->lock
> actually fixes anything.

Ah, I bet this code in vgic_init() provides the necessary protection.

	/* Are we also in the middle of creating a VCPU? */
	if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus))
		return -EBUSY;



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux