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 B1E6543B7D for ; Tue, 5 Mar 2024 10:57:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8D5D42E45; Tue, 5 Mar 2024 10:57:50 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2071.outbound.protection.outlook.com [40.107.223.71]) by mails.dpdk.org (Postfix) with ESMTP id 33A8B4014F for ; Tue, 5 Mar 2024 10:57:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EChyR38FVy+OwgUASnVMjUk1RKxvmmEIfwnhMi5LQ1B++AwaeQBWpfJ/E/1MfNNxgSzSvVjpUI5nH2PIXF1vOinl3vaIP7DvnKx8r9dK9LaWd2FY6XlgctEXdpWm8kGXX5PiFDgEXXtgjl/4lzPgZXpdXp6sKWG4IQ6nwd0aKG+rvwYRVXMw/qZ1L5lKcwzc6Cj4qg8KG0992OZB44CW5iBifjDPtac6QTrQc5a3NNaxBZVc6/uZWQxhwo0FIAzxoazBufiMdYZa5ww1Y+EzAVfn1R/jsS2KrZdmF9SYHdsyvS+ZkN+lSqQK+8X/LhZqog6YGmSRAmJMu0XDgjr/AA== 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=XxZM/Q9p700uArYvGdx/6sNumIySWeWfTyKs+C5P43Y=; b=OXkHSHLUZR9OUIgj8it8jCP6TxJZcFTTE1de94jdUgX9S9vwwyK1fq7uEdZIV/fNifRjSKajCcX4pdavxmTAi4IQW/K5hEolNQ6trYf5MFgvPSXcHsM/MVoNl8nTUG88NJ9DRlV2LC/fSK4zuBANgXFsGcCMMSXZWk3q9Z7ULweYhKCJ71ZJNp80RIMpnupdEB+6OETq7euErzBRs9/yFO1Z9Z44LD0iHndkqeMcegtDevNcMnmaIyyOYr3w6Oa7ScWLWDaOKTgZzpp0/ajQVD1LYstRAfREZopyWhUtpQWHFKu2QsJ5cxDh1V6buhIGj81qNcOaIvOSnMpjRg4VQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=microsoft.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=XxZM/Q9p700uArYvGdx/6sNumIySWeWfTyKs+C5P43Y=; b=h1Df/PocIUhsw5QF9yx6eYiWNbFWXfkJqg3EyBEpsyKtNPgxiEVBWbS8BR5XUGHtyUqpUKeO8UIosYFggTLE01IlNMRk9xkH22spjvL3Bn0XdF8kgySWBmyAVXRQXiwOKli72l5xb+eXFFfI7U+p5Iu8oINg/HSLcuue/e1HGyR0uJ60+yswo7EnGbTthGpK5SJWvktLwZe59zHTmQRG1/un2YjWhrW0cVhaNKThk4CJAOpvjefguW+mQgUHe9O4Hv43b+V4GTeRfvDX7LgsftlPAme459cLIoTTIZSa4iOwOpIjTmlcdXtzAaynrN0RkG59iiBlgQnAxGG2C8At/Q== Received: from MW4PR04CA0082.namprd04.prod.outlook.com (2603:10b6:303:6b::27) by DM4PR12MB8558.namprd12.prod.outlook.com (2603:10b6:8:187::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Tue, 5 Mar 2024 09:57:47 +0000 Received: from CO1PEPF000042AC.namprd03.prod.outlook.com (2603:10b6:303:6b:cafe::92) by MW4PR04CA0082.outlook.office365.com (2603:10b6:303:6b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Tue, 5 Mar 2024 09:57:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000042AC.mail.protection.outlook.com (10.167.243.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 09:57:46 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 5 Mar 2024 01:57:32 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 5 Mar 2024 01:57:31 -0800 From: Xueming Li To: Long Li CC: dpdk stable Subject: patch 'net/mana: fix memory leak on MR allocation' has been queued to stable release 23.11.1 Date: Tue, 5 Mar 2024 17:47:26 +0800 Message-ID: <20240305094757.439387-106-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305094757.439387-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042AC:EE_|DM4PR12MB8558:EE_ X-MS-Office365-Filtering-Correlation-Id: c97e4110-2f7f-413c-a159-08dc3cfab5cb X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ujfTA/d4qeNqDaC7gTIzprRFFnBgkT3Q6CNwuOMZHgD4k/c+zhUnyFUUb8C+tiBCBUIyFo3Wuhut0VQZB1jS/Bsr3u7PutK24uQhvHNAhajhNvikIZxRb6B62tmuLzl1JeuhXzwXvDo7np2sfhkYbxTHldIiQadRORUElouvrz4E8fuCA9Vvb/q+F2v49xJkUu9tTu3JawDDI4xEOJwLiqXkOELLxXt1V3TasUWvm2RjbnKT8toYVYR4zd3mVmfgPzW7yys3gtpiO3W/GoK7Cb3KO0oxQvnxlb7KnUw0bl5fI/ULigHffszFuNIiBu/WyGagg5hMwU7x9KhXIlSo1JQ8Itl8qJwTZcB7FlQcDeZSkXPB6qM0GGyLr8GQIVrFPdlFeGKiAnzprK5eIwyd3yR7f2tQ6Kf5Wgtw0mGG6PIYbsq4I8BBY7h5c4zB6zMo7mWYacrrK3EyY5kM6CuGpdx9YXiFdlvAaZ9dfNMoNH0y4FM3t3ERE0yBr9GQLgQiSgj6OCsaSHKtCDplSv34Ly3Ln/UgCnGOLiYM0ucoSQ2MdJ54gNiSNn1zHxcc+pxIvjpdmgxsTaL6HwkrR7ag5BG2Y3W9Lcw+96VRl8mlyqx6dwqDiuQMQ1xoYv6k4346vr+fBXi6ChvkumOq+ugNL5j4zjzf78GXD+sCdQ9XNWk6ikyV6XYc6G8YSOeGyIW2OuFwoPZkWWIYm4FUdRmcxyjsaY8CHmOCSEWljWpSvQS6h2qlzdCAoZOAdtZPqjxZ X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(376005)(82310400014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 09:57:46.7717 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c97e4110-2f7f-413c-a159-08dc3cfab5cb X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042AC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8558 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 Hi, FYI, your patch has been queued to stable release 23.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/31/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=6679de7a8f35b249bc00f264807bdaf0b90651d9 Thanks. Xueming Li --- >From 6679de7a8f35b249bc00f264807bdaf0b90651d9 Mon Sep 17 00:00:00 2001 From: Long Li Date: Thu, 8 Feb 2024 16:05:03 -0800 Subject: [PATCH] net/mana: fix memory leak on MR allocation Cc: Xueming Li [ upstream commit 9d61fe41acaaf6bf88c173acce2b3165ddf0eb9d ] Use a MR on the stack instead of allocating it. This fixes the memory leak in the code where a MR is allocated but never freed. Fixes: 0f5db3c68ba7 ("net/mana: implement memory registration") Signed-off-by: Long Li --- drivers/net/mana/mr.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/net/mana/mr.c b/drivers/net/mana/mr.c index b8e6ea0bbf..dfb2412834 100644 --- a/drivers/net/mana/mr.c +++ b/drivers/net/mana/mr.c @@ -40,7 +40,7 @@ mana_new_pmd_mr(struct mana_mr_btree *local_tree, struct mana_priv *priv, struct ibv_mr *ibv_mr; struct mana_range ranges[pool->nb_mem_chunks]; uint32_t i; - struct mana_mr_cache *mr; + struct mana_mr_cache mr; int ret; rte_mempool_mem_iter(pool, mana_mempool_chunk_cb, ranges); @@ -75,14 +75,13 @@ mana_new_pmd_mr(struct mana_mr_btree *local_tree, struct mana_priv *priv, DP_LOG(DEBUG, "MR lkey %u addr %p len %zu", ibv_mr->lkey, ibv_mr->addr, ibv_mr->length); - mr = rte_calloc("MANA MR", 1, sizeof(*mr), 0); - mr->lkey = ibv_mr->lkey; - mr->addr = (uintptr_t)ibv_mr->addr; - mr->len = ibv_mr->length; - mr->verb_obj = ibv_mr; + mr.lkey = ibv_mr->lkey; + mr.addr = (uintptr_t)ibv_mr->addr; + mr.len = ibv_mr->length; + mr.verb_obj = ibv_mr; rte_spinlock_lock(&priv->mr_btree_lock); - ret = mana_mr_btree_insert(&priv->mr_btree, mr); + ret = mana_mr_btree_insert(&priv->mr_btree, &mr); rte_spinlock_unlock(&priv->mr_btree_lock); if (ret) { ibv_dereg_mr(ibv_mr); @@ -90,7 +89,7 @@ mana_new_pmd_mr(struct mana_mr_btree *local_tree, struct mana_priv *priv, return ret; } - ret = mana_mr_btree_insert(local_tree, mr); + ret = mana_mr_btree_insert(local_tree, &mr); if (ret) { /* Don't need to clean up MR as it's already * in the global tree -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 17:39:34.152729805 +0800 +++ 0105-net-mana-fix-memory-leak-on-MR-allocation.patch 2024-03-05 17:39:30.893566497 +0800 @@ -1 +1 @@ -From 9d61fe41acaaf6bf88c173acce2b3165ddf0eb9d Mon Sep 17 00:00:00 2001 +From 6679de7a8f35b249bc00f264807bdaf0b90651d9 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 9d61fe41acaaf6bf88c173acce2b3165ddf0eb9d ] @@ -10 +12,0 @@ -Cc: stable@dpdk.org @@ -18 +20 @@ -index d6a5ad1460..c9d0f7ef5a 100644 +index b8e6ea0bbf..dfb2412834 100644