[Intel-gfx] [igt-dev] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Fri Feb 18 17:08:41 UTC 2022
Hi Chris,
On Friday, 18 February 2022 17:03:01 CET Chris Wilson wrote:
> Quoting Janusz Krzysztofik (2022-02-18 15:19:35)
> > @@ -206,15 +229,19 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
> > igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
> > pci_addr.domain, pci_addr.bus,
> > pci_addr.device, pci_addr.function);
> > - return NULL;
> > + goto cleanup;
> > }
> >
> > if (pci_device_probe(pci_dev)) {
> > igt_warn("Couldn't probe PCI device\n");
> > - return NULL;
> > + goto cleanup;
> > }
> >
> > return pci_dev;
> > +
> > +cleanup:
> > + pci_system_cleanup();
>
> This is a global cleanup of libpciaccess iirc, such that if anyone else
> was using the library they would be affected.
Right, but shouldn't we also drop pci_system_init() from here and request
users to manage initialization and cleanup of that data themselves? On each
call pci_system_init() abandons existing data and overwrites a pointer to it
with that of newly allocated memory, then tests calling
igt_device_get_pci_device() multiple times are going to suffer from
significant memory leaking.
Thanks,
Janusz
>
> > + return NULL;
> > }
>
More information about the Intel-gfx
mailing list