[PATCH] net/virtio: unmap PCI device in secondary process
Xia, Chenbo
chenbo.xia at intel.com
Mon May 30 04:49:07 CEST 2022
> -----Original Message-----
> From: Wang, YuanX <yuanx.wang at intel.com>
> Sent: Thursday, April 21, 2022 7:16 PM
> To: maxime.coquelin at redhat.com; Xia, Chenbo <chenbo.xia at intel.com>
> Cc: dev at dpdk.org; Hu, Jiayu <jiayu.hu at intel.com>; He, Xingguang
> <xingguang.he at intel.com>; Wang, YuanX <yuanx.wang at intel.com>
> Subject: [PATCH] net/virtio: unmap PCI device in secondary process
>
> In multi-process, the secondary process will remap PCI during
> initialization, but the mapping is not removed in the uninit path,
> the device is not closed, and the device busy error will be reported
> when the device is hotplugged.
>
> This patch unmap PCI device at secondary process uninitialization
unmaps
> based on virtio_rempa_pci().
Virtio_remap_pci
>
> Fixes: 36a7a2e7a53 ("net/virtio: move PCI device init in dedicated file")
Miss cc-stable tag. Patch LGTM
Thanks,
Chenbo
>
> Signed-off-by: Yuan Wang <yuanx.wang at intel.com>
> ---
> drivers/net/virtio/virtio_pci_ethdev.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio/virtio_pci_ethdev.c
> b/drivers/net/virtio/virtio_pci_ethdev.c
> index 54645dc62e..1f6bdeddda 100644
> --- a/drivers/net/virtio/virtio_pci_ethdev.c
> +++ b/drivers/net/virtio/virtio_pci_ethdev.c
> @@ -122,10 +122,20 @@ static int
> eth_virtio_pci_uninit(struct rte_eth_dev *eth_dev)
> {
> int ret;
> + struct virtio_pci_dev *dev;
> + struct virtio_hw *hw;
> PMD_INIT_FUNC_TRACE();
>
> - if (rte_eal_process_type() == RTE_PROC_SECONDARY)
> + if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
> + dev = eth_dev->data->dev_private;
> + hw = &dev->hw;
> +
> + if (dev->modern)
> + rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
> + else
> + vtpci_legacy_ioport_unmap(hw);
> return 0;
> + }
>
> ret = virtio_dev_stop(eth_dev);
> virtio_dev_close(eth_dev);
> --
> 2.25.1
More information about the dev
mailing list