From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 95786A034C; Wed, 22 Jun 2022 23:31:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70B7D4069C; Wed, 22 Jun 2022 23:31:26 +0200 (CEST) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by mails.dpdk.org (Postfix) with ESMTP id 4E43F400D6; Wed, 22 Jun 2022 23:31:24 +0200 (CEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 787E03200754; Wed, 22 Jun 2022 17:31:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 22 Jun 2022 17:31:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1655933481; x= 1656019881; bh=NVKrigAwoeWfu9Yw2xjEjBpFfMF5FEgm9RdnPVCV/2g=; b=S ESlSjt7lFSrBP8KfCysdI/+wFhlU9P2Ptn+KwcX2xuG0GnCj/1qdc5PqxUAn5tuO pdtEZewxw8UF7fkVeKtTd2ppeC21sKHoOqhIolxT5Y+IEVKVD46Uj++kBURgIseO 0E6lHOp166kT6UR9Vr0RDiT5YdPlMaqcBmMAuQCjRCd+W/zqrJMlD0rj11KLomH1 Q//QZqcsv1XZQMIg48r0gGuflET7C+sJ1fFauEfJJLp6OVKqOHq2WJ+C3UrBbcYj hwT+06kiofbL2CSgu2UO49uidrGNDb+/6O3ZKP4eZnYJ3eXNWldKri7rw+/Ex1VC Gz9et6h7uPEWax7LYFE8w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1655933481; x= 1656019881; bh=NVKrigAwoeWfu9Yw2xjEjBpFfMF5FEgm9RdnPVCV/2g=; b=F Ppxluk8kfeey5Jf+kYLGYCsqh/A1Ed+mM1uzpHbhNCIqGT52R24QtaMnToczbThI q4phQ96tc49GtfAhYkD/cgt6aJqYidIOCVPRNTmhTlFF8Uf2eziPSsR/U1MoP05C 537wwdst1H6+tjYGCROvpLZoMvmuqfHaWIlWZoBCX2NIqooT24Q6r4fUjgMRc74o vmxdpb9WE5bYUloXHOPJx6CZkyH7Z8SzAE15f5Bp6oDm/R3KL6mq8gvyEpMX/wKD a+DdRknU9K5l0gVUME+3Ltqcwic7RaO+Dqs5VHfo9SzA+snDMNkPThMRqxjD9Pic L7uZG1j8SQDtIJrPn9hlQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudefhedgudeigecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkfgjfhgggfgtsehtqhertddttdejnecuhfhrohhmpefvhhho mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne cuggftrfgrthhtvghrnhepgedttdeljeejgeffkeekkedtjeevtdehvedtkeeivdeuuedv ieduvdelveejueejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Jun 2022 17:31:20 -0400 (EDT) From: Thomas Monjalon To: Ke Zhang Cc: dev@dpdk.org, stable@dpdk.org, xiaoyun.li@intel.com, aman.deep.singh@intel.com, yuying.zhang@intel.com, Ferruh Yigit Subject: Re: [PATCH v2] app/testpmd: fix quit testpmd with vfs and pf Date: Wed, 22 Jun 2022 23:31:18 +0200 Message-ID: <4030713.XrmoMso0CX@thomas> In-Reply-To: References: <20220322071833.199619-1-ke1x.zhang@intel.com> <20220621092453.185583-1-ke1x.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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. > >=20 > > The solution is two steps: > > 1. Fetch the valid port value from RTE_ETH_FOREACH_DEV. > > 2. free the port in reverse order. > >=20 > > Fixes: 08fd782b8454 ("app/testpmd: fix quit to stop all ports before cl= ose") > > Cc: stable@dpdk.org > >=20 > > Signed-off-by: Ke Zhang >=20 > Acked-by: Aman Singh > Acked-by: Ferruh Yigit >=20 > Applied to dpdk-next-net/main, thanks. >=20 >=20 > > --- > > app/test-pmd/testpmd.c | 26 +++++++++++++++++++++----- > > 1 file changed, 21 insertions(+), 5 deletions(-) > >=20 > > 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 !=3D NULL) { > > + portid_t ethports[RTE_MAX_ETHPORTS]; > > + int count =3D 0; > > + int index =3D 0; > > no_link_check =3D 1; >=20 > No need to initialize 'index'. >=20 > And better to have an empty line after deceleration block. >=20 > > + > > + /* Fetch the valid port id from port list*/ > > RTE_ETH_FOREACH_DEV(pt_id) { > > - printf("\nStopping port %d...\n", pt_id); > > + ethports[count] =3D pt_id; > > + count++; > > + } > > + > > + /* > > + * Free the port from Reverse order, as general, > > + * PF port < VF port=EF=BC=8C 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 =3D count - 1 ; index >=3D 0 ; index--) { >=20 > Space is not needed after ';'. >=20 >=20 > Since these are minor, I will fix while merging.