From: Thomas Monjalon <thomas@monjalon.net>
To: Ke Zhang <ke1x.zhang@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org, xiaoyun.li@intel.com,
aman.deep.singh@intel.com, yuying.zhang@intel.com,
Ferruh Yigit <ferruh.yigit@xilinx.com>,
bruce.richardson@intel.com, david.marchand@redhat.com,
qi.z.zhang@intel.com
Subject: Re: [PATCH v2] app/testpmd: fix quit testpmd with vfs and pf
Date: Thu, 23 Jun 2022 08:41:15 +0200 [thread overview]
Message-ID: <8178369.aoefvbuG5b@thomas> (raw)
In-Reply-To: <4030713.XrmoMso0CX@thomas>
Adding more about this patch:
testpmd is a test application. It allows you to find some issues
in some scenarios. It seems you found an issue and you decided
to hide it in the test application. That's really wrong!
This kind of issue should be solved in the API or in the driver.
In this case, I believe it should be handled in the driver
which should release dependent ports.
22/06/2022 23:31, Thomas Monjalon:
> Sorry, this patch looks really wrong, I cannot pull it into the main branch.
> See below for an explanation.
>
>
> 21/06/2022 12:43, Ferruh Yigit:
> > On 6/21/2022 10:24 AM, Ke Zhang wrote:
> > > 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 two steps:
> > > 1. Fetch the valid port value from RTE_ETH_FOREACH_DEV.
> > > 2. free the port in reverse order.
> > >
> > > Fixes: 08fd782b8454 ("app/testpmd: fix quit to stop all ports before close")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
> >
> > Acked-by: Aman Singh <aman.deep.singh@intel.com>
> > Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
> >
> > Applied to dpdk-next-net/main, thanks.
> >
> >
> > > ---
> > > app/test-pmd/testpmd.c | 26 +++++++++++++++++++++-----
> > > 1 file changed, 21 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> > > index 04c39adc21..c01ecf7279 100644
> > > --- a/app/test-pmd/testpmd.c
> > > +++ b/app/test-pmd/testpmd.c
> > > @@ -3492,16 +3492,32 @@ pmd_test_exit(void)
> > > }
> > > #endif
> > > if (ports != NULL) {
> > > + portid_t ethports[RTE_MAX_ETHPORTS];
> > > + int count = 0;
> > > + int index = 0;
> > > no_link_check = 1;
> >
> > No need to initialize 'index'.
> >
> > And better to have an empty line after deceleration block.
> >
> > > +
> > > + /* Fetch the valid port id from port list*/
> > > RTE_ETH_FOREACH_DEV(pt_id) {
> > > - printf("\nStopping port %d...\n", pt_id);
> > > + ethports[count] = pt_id;
> > > + count++;
> > > + }
> > > +
> > > + /*
> > > + * Free the port from Reverse order, as general,
> > > + * PF port < VF port, VF should be free before PF
> > > + * be free.
>
> No sorry, this is wrong.
> The port ID says nothing.
> If a port is closed before creating a VF,
> it can be VF < PF.
>
> > > + */
> > > + for (index = count - 1 ; index >= 0 ; index--) {
> >
> > Space is not needed after ';'.
> >
> >
> > Since these are minor, I will fix while merging.
next prev parent reply other threads:[~2022-06-23 6:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220322071833.199619-1-ke1x.zhang@intel.com>
2022-06-21 9:03 ` Ke Zhang
2022-06-21 9:20 ` Ferruh Yigit
2022-06-21 9:24 ` Ke Zhang
2022-06-21 10:43 ` Ferruh Yigit
2022-06-22 21:31 ` Thomas Monjalon
2022-06-23 6:41 ` Thomas Monjalon [this message]
2022-07-13 7:11 ` [PATCH v3] " Ke Zhang
2022-07-13 9:15 ` Thomas Monjalon
2022-07-15 9:03 ` [PATCH v4] net/i40e: fix the issue caused by PF and VF release order Ke Zhang
2022-08-02 2:16 ` Zhang, Yuying
2022-08-08 0:06 ` Zhang, Qi Z
2022-08-08 0:30 ` Zhang, Qi Z
2022-08-04 9:50 ` [PATCH v5] " Ke Zhang
2022-08-08 0:30 ` Zhang, Qi Z
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=8178369.aoefvbuG5b@thomas \
--to=thomas@monjalon.net \
--cc=aman.deep.singh@intel.com \
--cc=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@xilinx.com \
--cc=ke1x.zhang@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=stable@dpdk.org \
--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).