RE: [RFC 07/12] vfio: Block device access via device fd until device is opened

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

 



> From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> Sent: Monday, December 19, 2022 4:47 PM
> 
> Allow the vfio_device file to be in a state where the device FD is
> opened but the device is not opened. This inbetween state is not used

'but the device cannot be used by userspace (i.e. its .open_device()
hasn't been called)"

> when the device FD is spawned from the group FD, however when we create
> the device FD directly by opening a cdev it will be opened in the
> blocked state.
> 
> In the blocked state, currently only the bind operation is allowed,
> other device accesses are not allowed. Completing bind will allow user
> to further access the device.
> 
> This is implemented by adding a flag in struct vfio_device_file to mark
> the blocked state and using a simple smp_load_acquire() to obtain the
> flag value and serialize all the device setup with the thread accessing
> this device.
> 
> Due to this scheme it is not possible to unbind the FD, once it bound it
> remains bound until the FD is closed.

Could you elaborate why it's impossible to unbind the fd with this scheme?

> 
> +	/* Paired with smp_store_release() in vfio_device_open/close() */
> +	access = smp_load_acquire(&df->access_granted);
> +	if (!access)
> +		return -EINVAL;
> +

-EPERM?




[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