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 C2EDEA034D for ; Wed, 23 Feb 2022 12:54:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B59DE426E4; Wed, 23 Feb 2022 12:54:21 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id C1717426DA; Wed, 23 Feb 2022 12:54:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645617259; x=1677153259; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3tAP066+qUm1txzhau/ztjq5I+QzVl0U5otMRsuFTPY=; b=ma3LsOJnWJtnj1TH9RK6hySWdJrVYQ4tsvRboyzNrLW8/tUyYBsSVCUk GvvXni0HRJC5F4Nba2eClHj1HEofP2R8FYrbWhgK9Yy2xEfoFFO+i14ep VmaMIqSyzdr2pTGn3CtRyYAwt92thlraBZV/Rfy8tTLAxNeb0v10vIo7S xzpoQWS17yKutlr9lpLxQS6/JqB1DIXchIfHR1Ogl2QU+LM5D4af/2d/S BppCKvjY5olKoJ1J5Vd18RAHE5QPDvjOdD6autKPt1i+WwfygT4TbcVCo Il4l+I9fFthtr5cK+e1IAWOMd++OVo6qv3l231gXQjZD+3GV8g4XEJ84Z A==; X-IronPort-AV: E=McAfee;i="6200,9189,10266"; a="315172518" X-IronPort-AV: E=Sophos;i="5.88,390,1635231600"; d="scan'208";a="315172518" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 03:54:17 -0800 X-IronPort-AV: E=Sophos;i="5.88,390,1635231600"; d="scan'208";a="532651306" Received: from unknown (HELO localhost.localdomain) ([10.239.251.3]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 03:54:15 -0800 From: wenxuanx.wu@intel.com To: xiaoyun.li@intel.com, ferruh.yigit@intel.com, dev@dpdk.org Cc: wenxuan wu , stable@dpdk.org Subject: [PATCH v2 2/2] app/testpmd:fix testpmd quit failure Date: Wed, 23 Feb 2022 19:32:51 +0800 Message-Id: <20220223113251.723692-3-wenxuanx.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223113251.723692-1-wenxuanx.wu@intel.com> References: <20220223113251.723692-1-wenxuanx.wu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: wenxuan wu When testpmd start ed with 1 pf and 2 vfs, testpmd quited while vfs were still alive would result in failure. Root cause is that pf had been released already but vfs were still accessing by func rte_eth_dev_info_get, which would result in heap-free-after-use error. By quitting our ports in reverse order to avoid this.And the order is guaranteed that vf are created after pfs. Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM") Cc: stable@dpdk.org Signed-off-by: wenxuan wu --- 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) { 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); -- 2.25.1