[Intel-gfx] [PATCH v6 20/24] vfio: Add cdev for vfio_device

Liu, Yi L yi.l.liu at intel.com
Fri Mar 10 09:59:18 UTC 2023


> From: Tian, Kevin <kevin.tian at intel.com>
> Sent: Friday, March 10, 2023 4:49 PM
> 
> > From: Liu, Yi L <yi.l.liu at intel.com>
> > Sent: Wednesday, March 8, 2023 9:29 PM
> >
> > +	/*
> > +	 * Placing it before vfio_device_put_registration() to prevent
> > +	 * new registration refcount increment by
> > VFIO_GROUP_GET_DEVICE_FD
> > +	 * during the unregister time.
> > +	 */
> > +	vfio_device_group_unregister(device);
> > +
> > +	/*
> > +	 * Balances vfio_device_add() in the register path. Placing it before
> > +	 * vfio_device_put_registration() to prevent new registration
> refcount
> > +	 * increment by the device cdev open during the unregister time.
> > +	 */
> > +	vfio_device_del(device);
> > +
> 
> What about below?
> 
> 	/*
> 	 * Cleanup to pair with the register path. Must be done
> 	 * before vfio_device_put_registration () to avoid racing with
> 	 * a new registration.
> 	 */
> 	vfio_device_group_unregister(device);
> 	vfio_device_del(device);

new registration is bit confusing. Maybe "new registration refcount
increment by userspace".

Regards,
Yi Liu 


More information about the Intel-gfx mailing list