From: Ferruh Yigit <ferruh.yigit@intel.com>
To: <wenxuanx.wu@intel.com>, <qiming.yang@intel.com>,
<qi.z.zhang@intel.com>, <xiaoyun.li@intel.com>,
<aman.deep.singh@intel.com>, <yuying.zhang@intel.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH 1/2] app/testpmd: fix quit testpmd with vfs and pf
Date: Fri, 18 Feb 2022 16:58:47 +0000 [thread overview]
Message-ID: <35f1a3db-5575-bb10-ca35-b440e86e4fa8@intel.com> (raw)
In-Reply-To: <20220217101428.385751-2-wenxuanx.wu@intel.com>
On 2/17/2022 10:14 AM, wenxuanx.wu@intel.com wrote:
> From: wenxuan wu <wenxuanx.wu@intel.com>
>
> When testpmd startups with pf and vfs,this error occurs when quitting,
> results in pf is released before vfs ,so the vf would access an
> freed heap memory.
>
> The solution is that release our allocated ports in reverse
> order,add two macros RTE_ETH_FOREACH_DEV_REVERSE_OWNED_BY and
> RTE_ETH_FOREACH_DEV_REVERSE,which would be used in quit procedure of
> testpmd, error is fixed.
>
> Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM")
> Cc: stable@dpdk.org
>
> Signed-off-by: wenxuan wu <wenxuanx.wu@intel.com>
> ---
> app/test-pmd/testpmd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index e1da961311..698b6d8cc4 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -3384,12 +3384,12 @@ pmd_test_exit(void)
> #endif
> if (ports != NULL) {
> no_link_check = 1;
> - RTE_ETH_FOREACH_DEV(pt_id) {
> + RTE_ETH_FOREACH_DEV_REVERSE(pt_id) {
This fix assumes PF is always probed before VFs (so PF has smaller
port id than VF).
I am not sure if this is guaranteed, ports ported based on scan
in the sysfs folder.
Instead, what do you think PF port stop/close fail when there
are still VFs probed? I think PF driver can know if there are
VFs ported.
> printf("\nStopping port %d...\n", pt_id);
> fflush(stdout);
> stop_port(pt_id);
> }
> - RTE_ETH_FOREACH_DEV(pt_id) {
> + RTE_ETH_FOREACH_DEV_REVERSE(pt_id) {
> printf("\nShutting down port %d...\n", pt_id);
> fflush(stdout);
> close_port(pt_id);
next prev parent reply other threads:[~2022-02-18 16:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-17 10:14 [PATCH 0/2] " wenxuanx.wu
2022-02-17 10:14 ` [PATCH 1/2] " wenxuanx.wu
2022-02-18 8:40 ` Zhang, Yuying
2022-02-18 16:58 ` Ferruh Yigit [this message]
2022-02-17 10:14 ` [PATCH 2/2] lib/ethdev: add reverse macro to quit testpmd wenxuanx.wu
2022-02-18 8:34 ` Zhang, Yuying
2022-02-18 17:04 ` Ferruh Yigit
2022-02-23 11:32 ` [PATCH 0/2] app/testpmd: fix testpmd quit with pf and vfs wenxuanx.wu
2022-02-23 11:32 ` [PATCH v2 1/2] lib/ethdev: add reverse macro to quit testpmd wenxuanx.wu
2022-02-23 11:32 ` [PATCH v2 2/2] app/testpmd:fix testpmd quit failure wenxuanx.wu
2022-02-23 12:09 ` Ferruh Yigit
2022-03-03 13:22 ` Wu, WenxuanX
2022-03-04 16:15 ` Ferruh Yigit
2022-03-09 3:07 ` Wu, WenxuanX
2022-03-10 7:02 ` Wu, WenxuanX
2022-02-24 11:04 ` [PATCH 2/2] lib/ethdev: add reverse macro to quit testpmd Wu, WenxuanX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35f1a3db-5575-bb10-ca35-b440e86e4fa8@intel.com \
--to=ferruh.yigit@intel.com \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=wenxuanx.wu@intel.com \
--cc=xiaoyun.li@intel.com \
--cc=yuying.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).