On 07/11/2016 19:28, Alex Williamson wrote: > > > 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 gets a reference to kvm, but there's no guarantee that the > association of that kvm reference to the group stays valid. Once we're > outside of that mutex, we might as well consider that kvm:group > association stale. > > > > 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? > > The only release callback through vfio is when the user closes the > device, the code in this series is the full extent of vfio awareness of > kvm. Thanks, Maybe there should be an mdev callback at the point of association and deassociation between VFIO and KVM. Then the vendor driver can just use the same mutex for association, deassociation and usage. I'm not even sure that these patches are necessary once you have that callback. 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