[Intel-gfx] [PATCH v6 09/24] vfio/pci: Only need to check opened devices in the dev_set for hot reset
Tian, Kevin
kevin.tian at intel.com
Fri Mar 10 05:00:09 UTC 2023
> From: Liu, Yi L <yi.l.liu at intel.com>
> Sent: Wednesday, March 8, 2023 9:29 PM
>
> @@ -2429,10 +2429,23 @@ static int vfio_pci_dev_set_hot_reset(struct
> vfio_device_set *dev_set,
>
> list_for_each_entry(cur_vma, &dev_set->device_list,
> vdev.dev_set_list) {
> /*
> - * Test whether all the affected devices are contained by the
> + * Test whether all the affected devices can be reset by the
> + * user. The affected devices may already been opened or
> not
> + * yet.
> + *
> + * For the devices not opened yet, user can reset them as it
> + * reason is that the hot reset is done under the protection
> + * of the dev_set->lock, and device open is also under this
> + * lock. During the hot reset, such devices can not be opened
> + * by other users.
> + *
> + * For the devices that have been opened, needs to check the
> + * ownership. If the user provides a set of group fds, test
> + * whether all the opened affected devices are contained by
> the
> * set of groups provided by the user.
> */
* Test whether all the affected devices can be reset by the
* user.
*
* Resetting an unused device (not opened) is safe, because
* dev_set->lock is held in hot reset path so this device
* cannot race being opened by another user simultaneously.
*
* Otherwise all opened devices in the dev_set must be
* contained by the set of groups provided by the user.
the rest looks good:
Reviewed-by: Kevin Tian <kevin.tian at intel.com>
More information about the Intel-gfx
mailing list