DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/virtio: unmap PCI device in secondary process
@ 2022-04-21 11:15 Yuan Wang
  2022-04-22  9:25 ` Ling, WeiX
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yuan Wang @ 2022-04-21 11:15 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, jiayu.hu, xingguang.he, yuanx.wang

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
based on virtio_rempa_pci().

Fixes: 36a7a2e7a53 ("net/virtio: move PCI device init in dedicated file")

Signed-off-by: Yuan Wang <yuanx.wang@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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] net/virtio: unmap PCI device in secondary process
  2022-04-21 11:15 [PATCH] net/virtio: unmap PCI device in secondary process Yuan Wang
@ 2022-04-22  9:25 ` Ling, WeiX
  2022-05-30  2:49 ` Xia, Chenbo
  2022-06-06 15:55 ` [PATCH v2] " Yuan Wang
  2 siblings, 0 replies; 8+ messages in thread
From: Ling, WeiX @ 2022-04-22  9:25 UTC (permalink / raw)
  To: Wang, YuanX, maxime.coquelin, Xia, Chenbo
  Cc: dev, Hu, Jiayu, He, Xingguang, Wang, YuanX

> -----Original Message-----
> From: Yuan Wang <yuanx.wang@intel.com>
> Sent: Thursday, April 21, 2022 7:16 PM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> <xingguang.he@intel.com>; Wang, YuanX <yuanx.wang@intel.com>
> Subject: [PATCH] net/virtio: unmap PCI device in secondary process
> 
Tested-by: Wei Ling <weix.ling@intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] net/virtio: unmap PCI device in secondary process
  2022-04-21 11:15 [PATCH] net/virtio: unmap PCI device in secondary process Yuan Wang
  2022-04-22  9:25 ` Ling, WeiX
@ 2022-05-30  2:49 ` Xia, Chenbo
  2022-05-30 10:03   ` Wang, YuanX
  2022-06-06 15:55 ` [PATCH v2] " Yuan Wang
  2 siblings, 1 reply; 8+ messages in thread
From: Xia, Chenbo @ 2022-05-30  2:49 UTC (permalink / raw)
  To: Wang, YuanX, maxime.coquelin; +Cc: dev, Hu, Jiayu, He, Xingguang

> -----Original Message-----
> From: Wang, YuanX <yuanx.wang@intel.com>
> Sent: Thursday, April 21, 2022 7:16 PM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> <xingguang.he@intel.com>; Wang, YuanX <yuanx.wang@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@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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] net/virtio: unmap PCI device in secondary process
  2022-05-30  2:49 ` Xia, Chenbo
@ 2022-05-30 10:03   ` Wang, YuanX
  0 siblings, 0 replies; 8+ messages in thread
From: Wang, YuanX @ 2022-05-30 10:03 UTC (permalink / raw)
  To: Xia, Chenbo, maxime.coquelin; +Cc: dev, Hu, Jiayu, He, Xingguang

Hi Chenbo,

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Monday, May 30, 2022 10:49 AM
> To: Wang, YuanX <yuanx.wang@intel.com>; maxime.coquelin@redhat.com
> Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> <xingguang.he@intel.com>
> Subject: RE: [PATCH] net/virtio: unmap PCI device in secondary process
> 
> > -----Original Message-----
> > From: Wang, YuanX <yuanx.wang@intel.com>
> > Sent: Thursday, April 21, 2022 7:16 PM
> > To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> > Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> > <xingguang.he@intel.com>; Wang, YuanX <yuanx.wang@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, will fix it in next version.

Regards,
Yuan

> 
> Thanks,
> Chenbo
> 
> >
> > Signed-off-by: Yuan Wang <yuanx.wang@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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2] net/virtio: unmap PCI device in secondary process
  2022-06-06 15:55 ` [PATCH v2] " Yuan Wang
@ 2022-06-06  9:24   ` Ling, WeiX
  2022-06-20  3:37   ` Xia, Chenbo
  1 sibling, 0 replies; 8+ messages in thread
From: Ling, WeiX @ 2022-06-06  9:24 UTC (permalink / raw)
  To: Wang, YuanX, maxime.coquelin, Xia, Chenbo, dev
  Cc: Hu, Jiayu, He, Xingguang, stable

> -----Original Message-----
> From: Wang, YuanX <yuanx.wang@intel.com>
> Sent: Monday, June 6, 2022 11:56 PM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>;
> dev@dpdk.org
> Cc: Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> <xingguang.he@intel.com>; Ling, WeiX <weix.ling@intel.com>; Wang, YuanX
> <yuanx.wang@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] 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 unmaps PCI device at secondary process uninitialization based on
> virtio_rempa_pci.
> 
> Fixes: 36a7a2e7a53 ("net/virtio: move PCI device init in dedicated file")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> Tested-by: Wei Ling <weix.ling@intel.com>
> ---

Tested-by: Wei Ling <weix.ling@intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] net/virtio: unmap PCI device in secondary process
  2022-04-21 11:15 [PATCH] net/virtio: unmap PCI device in secondary process Yuan Wang
  2022-04-22  9:25 ` Ling, WeiX
  2022-05-30  2:49 ` Xia, Chenbo
@ 2022-06-06 15:55 ` Yuan Wang
  2022-06-06  9:24   ` Ling, WeiX
  2022-06-20  3:37   ` Xia, Chenbo
  2 siblings, 2 replies; 8+ messages in thread
From: Yuan Wang @ 2022-06-06 15:55 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia, dev
  Cc: jiayu.hu, xingguang.he, weix.ling, Yuan Wang, stable

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 unmaps PCI device at secondary process uninitialization
based on virtio_rempa_pci.

Fixes: 36a7a2e7a53 ("net/virtio: move PCI device init in dedicated file")
Cc: stable@dpdk.org

Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
Tested-by: Wei Ling <weix.ling@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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2] net/virtio: unmap PCI device in secondary process
  2022-06-06 15:55 ` [PATCH v2] " Yuan Wang
  2022-06-06  9:24   ` Ling, WeiX
@ 2022-06-20  3:37   ` Xia, Chenbo
  2022-06-20  9:53     ` Wang, YuanX
  1 sibling, 1 reply; 8+ messages in thread
From: Xia, Chenbo @ 2022-06-20  3:37 UTC (permalink / raw)
  To: Wang, YuanX, maxime.coquelin, dev
  Cc: Hu, Jiayu, He, Xingguang, Ling, WeiX, stable

> -----Original Message-----
> From: Wang, YuanX <yuanx.wang@intel.com>
> Sent: Monday, June 6, 2022 11:56 PM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>;
> dev@dpdk.org
> Cc: Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang <xingguang.he@intel.com>;
> Ling, WeiX <weix.ling@intel.com>; Wang, YuanX <yuanx.wang@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2] 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 unmaps PCI device at secondary process uninitialization
> based on virtio_rempa_pci.
> 
> Fixes: 36a7a2e7a53 ("net/virtio: move PCI device init in dedicated file")

This should be 12 digits, not 11

With this fixed:

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

> Cc: stable@dpdk.org
> 
> Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> Tested-by: Wei Ling <weix.ling@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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2] net/virtio: unmap PCI device in secondary process
  2022-06-20  3:37   ` Xia, Chenbo
@ 2022-06-20  9:53     ` Wang, YuanX
  0 siblings, 0 replies; 8+ messages in thread
From: Wang, YuanX @ 2022-06-20  9:53 UTC (permalink / raw)
  To: Xia, Chenbo, maxime.coquelin, dev
  Cc: Hu, Jiayu, He, Xingguang, Ling, WeiX, stable

Hi Chenbo,

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Monday, June 20, 2022 11:38 AM
> To: Wang, YuanX <yuanx.wang@intel.com>; maxime.coquelin@redhat.com;
> dev@dpdk.org
> Cc: Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> <xingguang.he@intel.com>; Ling, WeiX <weix.ling@intel.com>;
> stable@dpdk.org
> Subject: RE: [PATCH v2] net/virtio: unmap PCI device in secondary process
> 
> > -----Original Message-----
> > From: Wang, YuanX <yuanx.wang@intel.com>
> > Sent: Monday, June 6, 2022 11:56 PM
> > To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>;
> > dev@dpdk.org
> > Cc: Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> > <xingguang.he@intel.com>; Ling, WeiX <weix.ling@intel.com>; Wang,
> > YuanX <yuanx.wang@intel.com>; stable@dpdk.org
> > Subject: [PATCH v2] 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 unmaps PCI device at secondary process uninitialization
> > based on virtio_rempa_pci.
> >
> > Fixes: 36a7a2e7a53 ("net/virtio: move PCI device init in dedicated
> > file")
> 
> This should be 12 digits, not 11

Thanks, will be fixed at the next version.

Thanks,
Yuan
> 
> With this fixed:
> 
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
> 
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> > Tested-by: Wei Ling <weix.ling@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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-06-20  9:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 11:15 [PATCH] net/virtio: unmap PCI device in secondary process Yuan Wang
2022-04-22  9:25 ` Ling, WeiX
2022-05-30  2:49 ` Xia, Chenbo
2022-05-30 10:03   ` Wang, YuanX
2022-06-06 15:55 ` [PATCH v2] " Yuan Wang
2022-06-06  9:24   ` Ling, WeiX
2022-06-20  3:37   ` Xia, Chenbo
2022-06-20  9:53     ` Wang, YuanX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).