On Thu, Nov 20, 2025, at 5:23 PM, Jason Gunthorpe wrote:
> On Thu, Nov 20, 2025 at 05:04:13PM -0700, Alex Williamson wrote:
>
>> @@ -2501,7 +2501,7 @@ static int vfio_pci_dev_set_hot_reset(struct
>> vfio_device_set *dev_set,
>> err_undo:
>> list_for_each_entry_from_reverse(vdev, &dev_set->device_list,
>> vdev.dev_set_list) {
>> - if (__vfio_pci_memory_enabled(vdev))
>> + if (vdev->vdev.open_count && __vfio_pci_memory_enabled(vdev))
>> vfio_pci_dma_buf_move(vdev, false);
>> up_write(&vdev->memory_lock);
>> }
>>
>> Any other suggestions? This should be the only reset path with this
>> nuance of affecting non-opened devices. Thanks,
>
> Seems reasonable, but should it be in __vfio_pci_memory_enabled() just
> to be robust?
__vfio_pci_memory_enabled() currently only requires holding memory_lock, I
don't think we want to create a dependency on dev_set->lock for this unique
call path. Thanks,
Alex