[dpdk-dev] [PATCH 1/3] bus/pci: update device devargs on each rescan
Gaëtan Rivet
gaetan.rivet at 6wind.com
Mon Nov 5 15:10:33 CET 2018
Hi Darek,
On Mon, Nov 05, 2018 at 08:04:45AM +0100, Darek Stojaczyk wrote:
> Bus rescan is done e.g. during the device hotplug,
> where devargs are re-allocated. By not updating the
> rte_device->devargs pointer we potentially make it
> a dangling one, as previous devargs could have been
> (or will be soon) freed.
>
> Fixes: 55e411b301c3 ("bus/pci: fix resource mapping override")
> Cc: qi.z.zhang at intel.com
>
> Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk at intel.com>
> ---
> drivers/bus/pci/linux/pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
> index f87533c5c..f3172960e 100644
> --- a/drivers/bus/pci/linux/pci.c
> +++ b/drivers/bus/pci/linux/pci.c
> @@ -349,10 +349,10 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
> if (ret < 0) {
> rte_pci_insert_device(dev2, dev);
> } else { /* already registered */
> + pci_name_set(dev2);
This is rather unfortunate to call pci_name_set()
to trigger the mapping devargs <-> devices.
pci_devargs_lookup could be made non-static instead,
if that's sufficient. Given that the PCI id matches because the device
is a duplicate (already registered), then the name itself probably does
not need to be updated.
> if (!rte_dev_is_probed(&dev2->device)) {
> dev2->kdrv = dev->kdrv;
> dev2->max_vfs = dev->max_vfs;
> - pci_name_set(dev2);
> memmove(dev2->mem_resource,
> dev->mem_resource,
> sizeof(dev->mem_resource));
> --
> 2.17.1
>
--
Gaëtan Rivet
6WIND
More information about the dev
mailing list