[PATCH v17 10/26] vfio: split get device info from setup

Burakov, Anatoly anatoly.burakov at intel.com
Wed Sep 16 13:14:56 CEST 2026


On 9/15/2026 5:24 PM, David Marchand wrote:
> On Thu, 10 Sept 2026 at 14:54, Anatoly Burakov
> <anatoly.burakov at intel.com> wrote:
>>
>> Currently, setup gets device info as part of setup, while the separate get
>> device info API also calls setup if the fd is zero. Untangle these two APIs
>> and make each do one thing, and adjust all existing callers.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
>> ---


> 
> Not the fault of this patch, but comparing a FD against 0 is a bad sign...
> 
> 
>> -                       if (dev_vfio_get_device_info(rte_pci_get_sysfs_path(), pci_addr,
>> -                               &vfio_dev_fd, &device_info) != 0)
>> +                       if (dev_vfio_setup_device(rte_pci_get_sysfs_path(), pci_addr,
>> +                               &vfio_dev_fd) != 0)
>>                                  return -1;
>>                          /* save vfio_dev_fd so it can be used during release */
>>                          if (rte_intr_dev_fd_set(dev->intr_handle, vfio_dev_fd) != 0)
>>                                  return -1;
>> +                       if (dev_vfio_get_device_info(vfio_dev_fd, &device_info) != 0)
>> +                               return -1;
>>
>>                          if (pci_vfio_fill_regions(dev, vfio_dev_fd, &device_info) != 0)
>>                                  return -1;
> 
> And we have various leaks in case VFIO fails...
> 
> I'll make a note to fix this later as this is already present, unless
> you can have a look.
> 

Yeah, this whole "save fd in interrupt handle" is a bit suspect, I 
didn't want to touch that :D I can have a look later, but not as part of 
this patchset obviously.

-- 
Thanks,
Anatoly


More information about the dev mailing list