Re: [v3 4/5] vfio: implement APIs to set/put kvm to/from vfio group

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

 




On 07/11/2016 19:04, Alex Williamson wrote:
>> > +struct kvm *vfio_group_get_kvm(struct vfio_group *group)
>> > +{
>> > +	struct kvm *kvm = NULL;
> Unnecessary initialization.
> 
>> > +
>> > +	mutex_lock(&group->udata.lock);
>> > +
>> > +	kvm = group->udata.kvm;
>> > +	if (kvm)
>> > +		kvm_get_kvm(kvm);
>> > +
>> > +	mutex_unlock(&group->udata.lock);
>> > +
>> > +	return kvm;
>> > +}
>> > +EXPORT_SYMBOL_GPL(vfio_group_get_kvm);
>
> How are kvm references acquired through vfio_group_get_kvm() ever
> released?

They are released with kvm_put_kvm, but it's done in the vendor driver
so that VFIO core doesn't have a dependency on kvm.ko.

> Can the reference become invalid?

No, this is guaranteed by virt/kvm/vfio.c + the udata.lock mutex (which
probably should be renamed...).

> The caller may still hold
> a kvm references, but couldn't the group be detached from one kvm
> instance and re-attached to another?

Can this be handled by the vendor driver?  Does it get a callback when
it's detached from a KVM instance?

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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