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 6F722A04FD; Wed, 8 Jun 2022 14:06:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53F9F406B4; Wed, 8 Jun 2022 14:06:11 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2087.outbound.protection.outlook.com [40.107.236.87]) by mails.dpdk.org (Postfix) with ESMTP id 27DC840687 for ; Wed, 8 Jun 2022 14:06:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gDAbZ5FJ96mf4K6gXv6mdW2do6MhQL9twZrySveq0GgFRT61WCNelWTaSfvnTs/z/+k/RZkm77BC5UyPiIR4GvNsVapRWfBdYLTLwD2aF1IHGp/nxJL4S96Qfk4mVCYXcaPGvyILzUZ/Pr61ilNlFJzcnFSy9EgALqLCYiyfjBDWHW6MQhUV3YhkI3PL9+S6bPZ3c1/Mo+YGFvZSpYGoygpQwNLCUEuuO3Nyl/7NQgbeyrMNwipbTNAgK4Jx05LL0dgKSyykuPIORAzadRbrbThdzR3apDXfmPuoTbFC0suHhruOeCjUnZryAut/Yf+Umv2i8qZ2VgpvSK8kIVTUaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sbd/s8/4LQWDTMeOSIbyrccpdx2jJVBPVKgtOWbY3LM=; b=i9/Z9uUh9Ia7HKNmemW5B8bt7gZHteTe94fdq/cAkg29/ktShFV7A4M3v/wpoRPLdV/97pxoZMWxQA5Jcqhl9FCCCLbqPMWeHwIImsBYxv8qZ7uIN5u9axzwyj1JiiZmC4beQI25YeIaMp0JpTzSJEleuiaj8+kzfYj+QbkcN0D7ZlQXkkbioeKvg7wkas6h+VXGyxU2RYSf3kuWr1ujUzlgSf1L6WKZycRoXbANnD0TIWFR289zDcKhBrpz1WMMt5ACG7VyKkPWBpqMteruy6LeT65Vg0Nfh8mB+TmK5SOD+d8uZ5nNT+ldOaVr1wq6dSP67WtGtqBNApJMGyWovw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=intel.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sbd/s8/4LQWDTMeOSIbyrccpdx2jJVBPVKgtOWbY3LM=; b=jTJ6jne1bL8x/8LYqvjdHo3j96L1//93rUc6V7eQKIIn0/5VVXtoQHPjxSxdn8B3BKDXn1U9zMZHWz8aZbt7liXZeqOtelFhTwSt3xQG74xL3DUXSmUIU527jBSnZCJw09Tk5E22pudQtwDzkpigDf5A6NiqAdbk5rjk7UyBqmk= Received: from BN6PR1401CA0016.namprd14.prod.outlook.com (2603:10b6:405:4b::26) by SJ0PR02MB7390.namprd02.prod.outlook.com (2603:10b6:a03:29c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Wed, 8 Jun 2022 12:06:08 +0000 Received: from BN1NAM02FT007.eop-nam02.prod.protection.outlook.com (2603:10b6:405:4b:cafe::2d) by BN6PR1401CA0016.outlook.office365.com (2603:10b6:405:4b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12 via Frontend Transport; Wed, 8 Jun 2022 12:06:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch01.xlnx.xilinx.com; pr=C Received: from xir-pvapexch01.xlnx.xilinx.com (149.199.80.198) by BN1NAM02FT007.mail.protection.outlook.com (10.13.3.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5332.12 via Frontend Transport; Wed, 8 Jun 2022 12:06:07 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 8 Jun 2022 13:06:06 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 8 Jun 2022 13:06:06 +0100 Envelope-to: yuying.zhang@intel.com, ke1x.zhang@intel.com, xiaoyun.li@intel.com, aman.deep.singh@intel.com, dev@dpdk.org Received: from [10.71.117.247] (port=33942) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nyuRq-00087D-Dt; Wed, 08 Jun 2022 13:06:06 +0100 Message-ID: Date: Wed, 8 Jun 2022 13:06:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v3] app/testpmd: fix issue with memory leaks when quit testpmd Content-Language: en-US To: "Zhang, Yuying" , "Zhang, Ke1X" , "Li, Xiaoyun" , "Singh, Aman Deep" References: <20220314055252.392004-1-ke1x.zhang@intel.com> <20220325083555.422962-1-ke1x.zhang@intel.com> From: Ferruh Yigit CC: "dev@dpdk.org" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e94803ae-41dd-4218-8127-08da4947451a X-MS-TrafficTypeDiagnostic: SJ0PR02MB7390:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EonFM3QRxKTZjLp3ru7aFdIN/jMGfBsJwu/M/OuJJga60Sl6g120U8tSfXK+EQ5tCVyPyWlciaXZch95eq+m9PLRy1i15V5GZ9h67KsQ6Dwog8bwotkSy/AYR91s2tAzaTBJDO1ShqFnsq7KYCa9eyXV2aoi7Q7Ai+C5o9kBjLRYRI+ECCBWyv1QNqVwra9WidFF+JZNsC0270UybnXSHbYHiEKel9Oz8jtRg8wI6nFA73oaU8Jmp35JD8YX11rdIUzwBrfvSWNdTx6W53m4jeoNq4pX2i5mdsSSekIx9s7X6lWEj37BmnJ1T8vjPzglyZydVFs3sKgZxDZCQg7WiptROM5fxZpboFTiYj+SUYgbRGOVY0g6osw8ibgzBAFFzTzc4JH5gvpUWkWoEEDcAhvY/+J8FoSZCa8TbjIkgWG0AJxbK3Z/lMpQtCPLnoUbhSugusR0r4PgMR3Av3HQ778Y2/b5DNWs52sIwqlqPGZWeFOHD/5/g2JlSy0wmaJOJq09zpCjOPMElOmLQH0w+PT7Y6iOK3G9NDJ+Kv1VHWO/GVfoNQtZFhaIlPu7ZbktPNuzdID7BmY6W4RPpq0DSm0if++NRCWnHSmZ3/R3G3Yz9H0YMOQIwPd0+2As65B6mAP80x9KFDXjA4DuYQPtDtU6gT7CC9/u+ff3fzWz/ENew1nT7M7ISi7US7jhecZDMovQyeTZVkcJPdr5jLDGirIdDjvl9/ybkGdf0RbyNZw= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch01.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(426003)(36860700001)(336012)(7636003)(82310400005)(2906002)(356005)(53546011)(40460700003)(316002)(83380400001)(8676002)(110136005)(47076005)(36756003)(9786002)(508600001)(8936002)(44832011)(5660300002)(4326008)(70206006)(70586007)(2616005)(26005)(31696002)(186003)(31686004)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2022 12:06:07.5498 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e94803ae-41dd-4218-8127-08da4947451a X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT007.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB7390 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 On 4/4/2022 4:34 PM, Zhang, Yuying wrote: > Hi Ke, > >> -----Original Message----- >> From: Zhang, Ke1X >> Sent: Friday, March 25, 2022 4:36 PM >> To: Li, Xiaoyun ; Singh, Aman Deep >> ; Zhang, Yuying ; >> dev@dpdk.org >> Cc: Zhang, Ke1X >> Subject: [PATCH v3] app/testpmd: fix issue with memory leaks when quit >> testpmd >> >> A multicast address pool is allocated for a port when using mcast_addr >> testpmd commands. >> >> When closing a port or stopping testpmd, this pool was not freed, resulting in >> a leak.This issue has been caught using ASan. >> >> Free this pool when closing the port. >> >> Error info as following: >> ERROR: LeakSanitizer: detected memory leaksDirect leak of >> 192 byte(s) >> 0 0x7f6a2e0aeffe in __interceptor_realloc >> (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe) >> 1 0x565361eb340f in mcast_addr_pool_extend >> ../app/test-pmd/config.c:5162 >> 2 0x565361eb3556 in mcast_addr_pool_append >> ../app/test-pmd/config.c:5180 >> 3 0x565361eb3aae in mcast_addr_add >> ../app/test-pmd/config.c:5243 >> >> Signed-off-by: Ke Zhang > > Acked-by: Yuying Zhang > Fixes: 8fff667578a7 ("app/testpmd: new command to add/remove multicast MAC addresses") Cc: stable@dpdk.org Acked-by: Ferruh Yigit Applied to dpdk-next-net/main, thanks. <...> >> pmd/testpmd.c b/app/test-pmd/testpmd.c index fe2ce19f99..1861a02c2f >> 100644 >> --- a/app/test-pmd/testpmd.c >> +++ b/app/test-pmd/testpmd.c >> @@ -3137,6 +3137,7 @@ close_port(portid_t pid) >> } >> >> if (is_proc_primary()) { >> + mcast_addr_pool_destroy(pi); >> port_flow_flush(pi); >> port_flex_item_flush(pi); >> rte_eth_dev_close(pi); 'rte_eth_dev_close()' may fail, like if the port is not stopped, in that case mcast pool will be freed although port is not closed. This can be prevented by saving existing mcast poll and restore it if close failed, but I think it doesn't worth the complexity it brings, so OK to continue as it is.