[dpdk-stable] patch 'ethdev: fix PCI device release in secondary process' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:31:07 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/89980fc3cec1259a81bd3c3fb53624b24fa26046

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 89980fc3cec1259a81bd3c3fb53624b24fa26046 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong at huawei.com>
Date: Thu, 21 Oct 2021 10:24:21 +0800
Subject: [PATCH] ethdev: fix PCI device release in secondary process
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 17faaed85449b58b209150906d2ad2cbfd853150 ]

In secondary process, rte_eth_dev_close() doesn't clear eth_dev->data.
If calling rte_dev_remove() after rte_eth_dev_close(), in
rte_eth_dev_pci_generic_remove() function, the released eth device still
can be found by its name in shared memory. As a result, the eth device
will be released repeatedly. The state of the eth device is modified to
RTE_ETH_DEV_UNUSED after rte_eth_dev_close(). So this state can be used
to avoid this problem.

Fixes: dcd5c8112bc3 ("ethdev: add PCI driver helpers")

Signed-off-by: Huisong Li <lihuisong at huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 lib/librte_ethdev/rte_ethdev_pci.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h
index bf715896ae..0eba781917 100644
--- a/lib/librte_ethdev/rte_ethdev_pci.h
+++ b/lib/librte_ethdev/rte_ethdev_pci.h
@@ -151,6 +151,16 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev,
 	if (!eth_dev)
 		return 0;
 
+	/*
+	 * In secondary process, a released eth device can be found by its name
+	 * in shared memory.
+	 * If the state of the eth device is RTE_ETH_DEV_UNUSED, it means the
+	 * eth device has been released.
+	 */
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
+	    eth_dev->state == RTE_ETH_DEV_UNUSED)
+		return 0;
+
 	if (dev_uninit) {
 		ret = dev_uninit(eth_dev);
 		if (ret)
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:10.048414506 +0800
+++ 0183-ethdev-fix-PCI-device-release-in-secondary-process.patch	2021-11-10 14:17:01.990745109 +0800
@@ -1 +1 @@
-From 17faaed85449b58b209150906d2ad2cbfd853150 Mon Sep 17 00:00:00 2001
+From 89980fc3cec1259a81bd3c3fb53624b24fa26046 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 17faaed85449b58b209150906d2ad2cbfd853150 ]
@@ -15 +17,0 @@
-Cc: stable at dpdk.org
@@ -20 +22 @@
- lib/ethdev/ethdev_pci.h | 10 ++++++++++
+ lib/librte_ethdev/rte_ethdev_pci.h | 10 ++++++++++
@@ -23,4 +25,4 @@
-diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
-index 12015b6b87..59c5d7b40f 100644
---- a/lib/ethdev/ethdev_pci.h
-+++ b/lib/ethdev/ethdev_pci.h
+diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h
+index bf715896ae..0eba781917 100644
+--- a/lib/librte_ethdev/rte_ethdev_pci.h
++++ b/lib/librte_ethdev/rte_ethdev_pci.h


More information about the stable mailing list