DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/testpmd : fix testpmd quit error
@ 2022-02-09 10:42 wenxuanx.wu
  2022-02-11  7:12 ` Singh, Aman Deep
  0 siblings, 1 reply; 3+ messages in thread
From: wenxuanx.wu @ 2022-02-09 10:42 UTC (permalink / raw)
  To: xiaoyun.li, aman.deep.singh; +Cc: dev, junfeng.guo, qiming.yang

From: Wenxuan Wu <wenxuanx.wu@intel.com>

when testpmd startup with pf and vfs, it is ok when running, while
exiting, it will result in heap-free-after-use which means pf is
released but vf is still accessing.

Change the logic of func port_is_bonding_slave ,this func
eth_dev_info_get_print_err while pf is released would result in this error.

Fixes: 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array")
Cc: stable@dpdk.org

Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
 app/test-pmd/testpmd.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e1da961311..7fa1944d78 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3824,19 +3824,10 @@ void clear_port_slave_flag(portid_t slave_pid)
 uint8_t port_is_bonding_slave(portid_t slave_pid)
 {
 	struct rte_port *port;
-	struct rte_eth_dev_info dev_info;
-	int ret;
 
 	port = &ports[slave_pid];
-	ret = eth_dev_info_get_print_err(slave_pid, &dev_info);
-	if (ret != 0) {
-		TESTPMD_LOG(ERR,
-			"Failed to get device info for port id %d,"
-			"cannot determine if the port is a bonded slave",
-			slave_pid);
-		return 0;
-	}
-	if ((*dev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE) || (port->slave_flag == 1))
+
+	if (port->slave_flag == 1)
 		return 1;
 	return 0;
 }
-- 
2.25.1


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

* Re: [PATCH] app/testpmd : fix testpmd quit error
  2022-02-09 10:42 [PATCH] app/testpmd : fix testpmd quit error wenxuanx.wu
@ 2022-02-11  7:12 ` Singh, Aman Deep
  0 siblings, 0 replies; 3+ messages in thread
From: Singh, Aman Deep @ 2022-02-11  7:12 UTC (permalink / raw)
  To: wenxuanx.wu, xiaoyun.li; +Cc: dev, junfeng.guo, qiming.yang

[-- Attachment #1: Type: text/plain, Size: 1708 bytes --]

Hi Wenxuan Wu,

On 2/9/2022 4:12 PM, wenxuanx.wu@intel.com wrote:
> From: Wenxuan Wu<wenxuanx.wu@intel.com>
>
> when testpmd startup with pf and vfs, it is ok when running, while
> exiting, it will result in heap-free-after-use which means pf is
> released but vf is still accessing.
>
> Change the logic of func port_is_bonding_slave ,this func
> eth_dev_info_get_print_err while pf is released would result in this error.

Removing call to func eth_dev_info_get_print_err, seems like a quick fix to the problem.
Can you try root causing further, where pf is released. And can the order be fixed,
first free vf and then the pf.

>
> Fixes: 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array")
> Cc:stable@dpdk.org
>
> Signed-off-by: Wenxuan Wu<wenxuanx.wu@intel.com>
> ---
>   app/test-pmd/testpmd.c | 13 ++-----------
>   1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index e1da961311..7fa1944d78 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -3824,19 +3824,10 @@ void clear_port_slave_flag(portid_t slave_pid)
>   uint8_t port_is_bonding_slave(portid_t slave_pid)
>   {
>   	struct rte_port *port;
> -	struct rte_eth_dev_info dev_info;
> -	int ret;
>   
>   	port = &ports[slave_pid];
> -	ret = eth_dev_info_get_print_err(slave_pid, &dev_info);
> -	if (ret != 0) {
> -		TESTPMD_LOG(ERR,
> -			"Failed to get device info for port id %d,"
> -			"cannot determine if the port is a bonded slave",
> -			slave_pid);
> -		return 0;
> -	}
> -	if ((*dev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE) || (port->slave_flag == 1))
> +
> +	if (port->slave_flag == 1)
>   		return 1;
>   	return 0;
>   }

[-- Attachment #2: Type: text/html, Size: 2477 bytes --]

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

* [PATCH] app/testpmd : fix testpmd quit error
@ 2022-02-09 10:38 wenxuanx.wu
  0 siblings, 0 replies; 3+ messages in thread
From: wenxuanx.wu @ 2022-02-09 10:38 UTC (permalink / raw)
  To: xiaoyun.li, aman.deep.singh; +Cc: dev, junfeng.guo, qiming.yang

From: Wenxuan Wu <wenxuanx.wu@intel.com>

when testpmd starup with pf and vfs, it is ok when running, while
exiting, it will result in heap-free-after-use which means pf is
released but vf is still accessing.

Change the logic of func port_is_bonding_slave ,this func
eth_dev_info_get_print_err while pf is released would result in this error.

Fixes: 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array")
Cc: stable@dpdk.org

Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
 app/test-pmd/testpmd.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e1da961311..7fa1944d78 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3824,19 +3824,10 @@ void clear_port_slave_flag(portid_t slave_pid)
 uint8_t port_is_bonding_slave(portid_t slave_pid)
 {
 	struct rte_port *port;
-	struct rte_eth_dev_info dev_info;
-	int ret;
 
 	port = &ports[slave_pid];
-	ret = eth_dev_info_get_print_err(slave_pid, &dev_info);
-	if (ret != 0) {
-		TESTPMD_LOG(ERR,
-			"Failed to get device info for port id %d,"
-			"cannot determine if the port is a bonded slave",
-			slave_pid);
-		return 0;
-	}
-	if ((*dev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE) || (port->slave_flag == 1))
+
+	if (port->slave_flag == 1)
 		return 1;
 	return 0;
 }
-- 
2.25.1


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

end of thread, other threads:[~2022-02-11  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 10:42 [PATCH] app/testpmd : fix testpmd quit error wenxuanx.wu
2022-02-11  7:12 ` Singh, Aman Deep
  -- strict thread matches above, loose matches on Subject: below --
2022-02-09 10:38 wenxuanx.wu

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).