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 284A0A034F for ; Wed, 10 Nov 2021 07:44:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EA6F4068B; Wed, 10 Nov 2021 07:44:16 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2072.outbound.protection.outlook.com [40.107.94.72]) by mails.dpdk.org (Postfix) with ESMTP id 8DF2F4014D for ; Wed, 10 Nov 2021 07:44:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oLSzG2XMwhj0Wr/YYD0IlhVei/LgftTDvdW+bTRoklue24bfgTNS1YL9I9DM0zmGqr0+UKD+pH11UDOXSchucDRrvPc2xaWsmpo7CQYZVOc6WqqOpvB8rcV+nt4tUSYCVUkPT2pu1EogGHqqyPlFl6lVfREZokfPe7Q3z/Gy8KZ7zVHvjb4JgSGYGvqDdwtQRVIVXECqCh/E8nFd+RXcW2BLPbBOl6TIdPdWI1onwjIims6GHJCgxH1mLyhkeyolAtsxuGXQswKkcslwdWiBH/pudhhnMesKPROt4VVQaSS/qi3wkaOEFEu6SLPURv7IGNeX1GvnH5kukN1jIBYnKA== 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=rLnf8jQpnMTRoI9RmnAqfxexq+GXXGEQ/+bTdv3loVY=; b=Wjt1Ynrva/rRvqpoRBC1wFvQ2oEOVt8hQF39MrdoYj5HlDJEGTeJ2zQzJ4let8zduXB+3zPQUkVFZG2QzFja9vC8GL0VTGkVtYizg1u73iT9d8XLLjlc7Qho8VmpRjZInC6NLVY/TZ+rbgJEsrXMY7BDeSjbzSYLOJFI3nD1wEmc0zJCMSouM4VwZr3CoqcUmda41OVi4oUsawspBnqN+k1LB5hf83MDXLEig3WPoCOQ/8gKEpV3VSCGkfIJgJ6DWEV8vNLB5nmkvyF+x2n7AgVsPmVyXCuKFvKgU30bIpNgYSTAcIfXIxLKHFsxuwCtKx/TN3TGicA/tlL69xSGSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rLnf8jQpnMTRoI9RmnAqfxexq+GXXGEQ/+bTdv3loVY=; b=TL84AyueWZHHIm+/77nEKuS9F34xP4vIYkLc/0ysTTK5xfpsdcojzOP1rAzM1G0gXjjERwQv95AuHRMmCIcVpMyAUpJddzNFjrUBu6j+ou90k5yz52O0GrSLnH7/JBm5AiSytsk/LyCxNEJJz4JnIWaoc+qI2+wHQOLBzTACQL7x1NI3+c+X6NLs0SJ6yXObbERcCZlonbhKNZnHFJss6BmqWdJ6xJbeLe9ZEH0i8LZp5c1if8bbRXzHpxlLyPOnkz3L4JYT3s/7RSX2+vesXZsJQl0l2+yML6r+GEeGN0cIRKFCkxzUeHnOfo75XKGRvpI32LP0PE55//e4DAbiag== Received: from DM6PR13CA0065.namprd13.prod.outlook.com (2603:10b6:5:134::42) by BN8PR12MB3187.namprd12.prod.outlook.com (2603:10b6:408:69::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Wed, 10 Nov 2021 06:44:13 +0000 Received: from DM6NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:5:134:cafe::2c) by DM6PR13CA0065.outlook.office365.com (2603:10b6:5:134::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.7 via Frontend Transport; Wed, 10 Nov 2021 06:44:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT021.mail.protection.outlook.com (10.13.173.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 06:44:12 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:44:10 +0000 From: Xueming Li To: Yunjian Wang CC: Luca Boccassi , Haiyue Wang , dpdk stable Date: Wed, 10 Nov 2021 14:29:52 +0800 Message-ID: <20211110063216.2744012-109-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 09e50c73-e7ad-4e27-306d-08d9a415819f X-MS-TrafficTypeDiagnostic: BN8PR12MB3187: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6IQ9GMKjFFFWlsDxAM0XUJ0GQF7ANSeZhe95YFueA1wumP4Oooqj8lKLXKNpSDHg7dN5oFXaSPlktbWweX9+d7hmqyaofwN79hiScspco05zgfhw3LyYgaDeGxNPoCi9hdr/dt/Uua+U7DFeA43asNBAmMIP053K6UUe7uucJgN3d6Bcd3hAWmb8vXkhWx4xRQ9z3oqRxeT64pPier2ODm0kpD9386rSdOoStyPTWDnSF/UJJcqSAWH9buV1TdxoTSQEOer4nw5l9sgBSTm3Lm9T9DjJA0rn8ysmDd+d1m0zQawGLv3SuXhR5/3+1JLpC+SpDfZIA4LqiR78aZ+BVkEBcfO2H9Vb9/WY4l6f236IDbOdLE3WYdLKlfK0LlOGsZxUN5XqCBXpw2jzJ8k2xtxz/45nw+vyRGn7pM+I2i11BI5lO2rO9Te/4Gg5Lo5If6zkNkwEzqnEX9KuJOZLMZDWhUcpt9IWbGQEzyeOzPmFrFnoEZma5OajOpRYnWww618AMLdsaQb66+bB4kDPd14c8NwffzjOHcFYeBn6KDLQ0q4dNIDTaaFhbEuYYwvnr22bv1g8x6ywTA52yB3aDR6hX+y3gn9m7NKnz8YCeLqO/dZU2OIh86dRFEP9dRaMQiqcgpEZSd9yJ7NA0knZZ4bSpWbSsktLi94Pm0GdAZC41Is0bOUA40LLAZr46U1kV/txIP5XohYUwPz7RQ3xbepoRUWdGJWj7NLMzmXWI+gzqgS30raGSGiaKGwgyEQFQ2eP4zfGFQueaZ3lVTy7rUxbqCqY3d1RrQtuGcQKwcdH/nGGbaFf+Xnq9okbBFwJIXx/hdnuhEFpYTUx/cuVtQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(7636003)(5660300002)(1076003)(356005)(2616005)(7696005)(36906005)(186003)(26005)(336012)(70586007)(55016002)(8676002)(53546011)(47076005)(70206006)(16526019)(6916009)(8936002)(54906003)(36756003)(508600001)(426003)(40140700001)(4326008)(83380400001)(6666004)(82310400003)(6286002)(4001150100001)(2906002)(966005)(316002)(86362001)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:44:12.4428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09e50c73-e7ad-4e27-306d-08d9a415819f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3187 Subject: [dpdk-stable] patch 'net/ice: fix memzone leak on queue re-configure' has been queued to stable release 20.11.4 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/8b56d276440b7e97f35858362ae766ac4ac4a012 Thanks. Xueming Li --- >From 8b56d276440b7e97f35858362ae766ac4ac4a012 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Wed, 22 Sep 2021 21:28:36 +0800 Subject: [PATCH] net/ice: fix memzone leak on queue re-configure Cc: Xueming Li [ upstream commit d3778bf39a1dd36181b11459ad3936501ca17f4d ] Normally when closing the device the queue memzone should be freed. But the memzone will be not freed, when device setup ops like: rte_eth_bond_slave_remove -->__eth_bond_slave_remove_lock_free ---->slave_remove ------>rte_eth_dev_internal_reset -------->rte_eth_dev_rx_queue_config ---------->eth_dev_rx_queue_config ------------>ice_rx_queue_release rte_eth_dev_close -->ice_dev_close ---->ice_free_queues ------>ice_rx_queue_release (not been called due to nb_rx_queues and nb_tx_queues are 0) And when queue number is changed to small size, the BIG memzone queue index will be lost. This will lead to a memory leak. So we should release the memzone when releasing queues. Fixes: 460d1679586e ("drivers/net: delete HW rings while freeing queues") Signed-off-by: Yunjian Wang Acked-by: Haiyue Wang --- drivers/net/ice/ice_fdir_filter.c | 2 -- drivers/net/ice/ice_rxtx.c | 8 ++++++-- drivers/net/ice/ice_rxtx.h | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index bb720d1036..4a071254ce 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -659,10 +659,8 @@ ice_fdir_teardown(struct ice_pf *pf) ice_tx_queue_release(pf->fdir.txq); pf->fdir.txq = NULL; - rte_eth_dma_zone_free(eth_dev, "fdir_tx_ring", ICE_FDIR_QUEUE_ID); ice_rx_queue_release(pf->fdir.rxq); pf->fdir.rxq = NULL; - rte_eth_dma_zone_free(eth_dev, "fdir_rx_ring", ICE_FDIR_QUEUE_ID); ice_fdir_prof_rm_all(pf); ice_fdir_prof_free(hw); ice_release_vsi(vsi); diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 8ac9411083..906fca15b0 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1096,6 +1096,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, return -ENOMEM; } + rxq->mz = rz; /* Zero all the descriptors in the ring. */ memset(rz->addr, 0, ring_size); @@ -1151,6 +1152,7 @@ ice_rx_queue_release(void *rxq) q->rx_rel_mbufs(q); rte_free(q->sw_ring); + rte_memzone_free(q->mz); rte_free(q); } @@ -1297,6 +1299,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev, return -ENOMEM; } + txq->mz = tz; txq->nb_tx_desc = nb_desc; txq->tx_rs_thresh = tx_rs_thresh; txq->tx_free_thresh = tx_free_thresh; @@ -1347,6 +1350,7 @@ ice_tx_queue_release(void *txq) q->tx_rel_mbufs(q); rte_free(q->sw_ring); + rte_memzone_free(q->mz); rte_free(q); } @@ -2037,7 +2041,6 @@ ice_free_queues(struct rte_eth_dev *dev) continue; ice_rx_queue_release(dev->data->rx_queues[i]); dev->data->rx_queues[i] = NULL; - rte_eth_dma_zone_free(dev, "rx_ring", i); } dev->data->nb_rx_queues = 0; @@ -2046,7 +2049,6 @@ ice_free_queues(struct rte_eth_dev *dev) continue; ice_tx_queue_release(dev->data->tx_queues[i]); dev->data->tx_queues[i] = NULL; - rte_eth_dma_zone_free(dev, "tx_ring", i); } dev->data->nb_tx_queues = 0; } @@ -2093,6 +2095,7 @@ ice_fdir_setup_tx_resources(struct ice_pf *pf) return -ENOMEM; } + txq->mz = tz; txq->nb_tx_desc = ICE_FDIR_NUM_TX_DESC; txq->queue_id = ICE_FDIR_QUEUE_ID; txq->reg_idx = pf->fdir.fdir_vsi->base_queue; @@ -2151,6 +2154,7 @@ ice_fdir_setup_rx_resources(struct ice_pf *pf) return -ENOMEM; } + rxq->mz = rz; rxq->nb_rx_desc = ICE_FDIR_NUM_RX_DESC; rxq->queue_id = ICE_FDIR_QUEUE_ID; rxq->reg_idx = pf->fdir.fdir_vsi->base_queue; diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index e9edb7bb29..4bea2bc2be 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -88,6 +88,7 @@ struct ice_rx_queue { uint64_t xtr_ol_flag; /* Protocol extraction offload flag */ ice_rxd_to_pkt_fields_t rxd_to_pkt_fields; /* handle FlexiMD by RXDID */ ice_rx_release_mbufs_t rx_rel_mbufs; + const struct rte_memzone *mz; }; struct ice_tx_entry { @@ -132,6 +133,7 @@ struct ice_tx_queue { bool tx_deferred_start; /* don't start this queue in dev start */ bool q_set; /* indicate if tx queue has been configured */ ice_tx_release_mbufs_t tx_rel_mbufs; + const struct rte_memzone *mz; }; /* Offload features */ -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:06.787205309 +0800 +++ 0108-net-ice-fix-memzone-leak-on-queue-re-configure.patch 2021-11-10 14:17:01.870746091 +0800 @@ -1 +1 @@ -From d3778bf39a1dd36181b11459ad3936501ca17f4d Mon Sep 17 00:00:00 2001 +From 8b56d276440b7e97f35858362ae766ac4ac4a012 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit d3778bf39a1dd36181b11459ad3936501ca17f4d ] @@ -28 +30,0 @@ -Cc: stable@dpdk.org @@ -39 +41 @@ -index e0cca7cb3c..afc956e0a2 100644 +index bb720d1036..4a071254ce 100644 @@ -42 +44 @@ -@@ -651,10 +651,8 @@ ice_fdir_teardown(struct ice_pf *pf) +@@ -659,10 +659,8 @@ ice_fdir_teardown(struct ice_pf *pf) @@ -54 +56 @@ -index 3f9de55a42..7a2220daa4 100644 +index 8ac9411083..906fca15b0 100644 @@ -57 +59 @@ -@@ -1152,6 +1152,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, +@@ -1096,6 +1096,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, @@ -65 +67 @@ -@@ -1207,6 +1208,7 @@ ice_rx_queue_release(void *rxq) +@@ -1151,6 +1152,7 @@ ice_rx_queue_release(void *rxq) @@ -73 +75 @@ -@@ -1353,6 +1355,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev, +@@ -1297,6 +1299,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev, @@ -81 +83 @@ -@@ -1415,6 +1418,7 @@ ice_tx_queue_release(void *txq) +@@ -1347,6 +1350,7 @@ ice_tx_queue_release(void *txq) @@ -89 +91 @@ -@@ -2156,7 +2160,6 @@ ice_free_queues(struct rte_eth_dev *dev) +@@ -2037,7 +2041,6 @@ ice_free_queues(struct rte_eth_dev *dev) @@ -97 +99 @@ -@@ -2165,7 +2168,6 @@ ice_free_queues(struct rte_eth_dev *dev) +@@ -2046,7 +2049,6 @@ ice_free_queues(struct rte_eth_dev *dev) @@ -105 +107 @@ -@@ -2212,6 +2214,7 @@ ice_fdir_setup_tx_resources(struct ice_pf *pf) +@@ -2093,6 +2095,7 @@ ice_fdir_setup_tx_resources(struct ice_pf *pf) @@ -113 +115 @@ -@@ -2270,6 +2273,7 @@ ice_fdir_setup_rx_resources(struct ice_pf *pf) +@@ -2151,6 +2154,7 @@ ice_fdir_setup_rx_resources(struct ice_pf *pf) @@ -122 +124 @@ -index 0a38740f45..c5ec6b7d1a 100644 +index e9edb7bb29..4bea2bc2be 100644 @@ -125 +127,3 @@ -@@ -93,6 +93,7 @@ struct ice_rx_queue { +@@ -88,6 +88,7 @@ struct ice_rx_queue { + uint64_t xtr_ol_flag; /* Protocol extraction offload flag */ + ice_rxd_to_pkt_fields_t rxd_to_pkt_fields; /* handle FlexiMD by RXDID */ @@ -127,2 +130,0 @@ - uint64_t offloads; - uint32_t time_high; @@ -133 +135 @@ -@@ -137,6 +138,7 @@ struct ice_tx_queue { +@@ -132,6 +133,7 @@ struct ice_tx_queue {