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 69F9645CE3 for ; Mon, 11 Nov 2024 07:38:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6115540E1B; Mon, 11 Nov 2024 07:38:12 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) by mails.dpdk.org (Postfix) with ESMTP id 5C4584067A for ; Mon, 11 Nov 2024 07:38:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eoC1IiDwFuz2u6PIkUtxQPN1SS2NkYqBTc8B6ldnU09yVxvfeFiqKl2eJY6cJHwCtrkG2ZCiB3HS/ymrSvd6Alp49JwYglajDHDxtIg3EVulOply9VTYVFo+aN7ZOn79xbTjsU2fAHsuRxes7kkmsoE+NJ4OIUlikSuxIKVO1De7SRtIGqe3GU4MW7yvp0FderVAsw/kR+FCBuIu31W44qGDTzPSK/gBac2MYZ4fsKkQ7/csKva5Sl0LYPgswhTjTVhR0duFElvm9EdlIZdL45j8F+6WRScWTXxoARGdb4/Z0wEfQulLlUOXy5FUg8MlWm81UN+5IX4sE+w6eLOHNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uGS5a8Vlj8iqfuXfq1Ytq42adVPSop3VetfYi7/eih8=; b=En7pGyngzwCoN4M0Dub/Jdn9i1KLsK28rooSK3rrTj4ssY8V1cCtU9V3rD1ktEcQspgdn5sAyExrfmhUQ1894ekFycVzPwm6nHCvvEU7w6m+E8SejJc6WRMyt+++vIJOZyWpsbvUKuv9TGNTLFK/EUsUAWV/e6K89asmUJ2L06w+3zW6QqEru0vgBTN1JXJ9DSCA/7EpkL+cNRSujNRsMXIAY894WgVnZi5KbrBnT08VsoFdygChejfBlOvIv9Q3Cxc9uxHqJLj/6d/3WYOKkUut8Q+RRi529wBBZvfJL87d604Jm0KXhHt5CsLQ2W/PiWEl2UsW0un5Zb107Iro/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=google.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=uGS5a8Vlj8iqfuXfq1Ytq42adVPSop3VetfYi7/eih8=; b=cnbEyv2bSI7CEK4q+bv2GOV/74/wa2c8MeBlqpdyKoDSPT28fHRU/IM3wg7ArKT3/jZe3DE37eUSFnGfGBy+FupxOOyt7oyBAAx+ngMO4HPlDuX6w5GjsWeZF4b4lR+RYtJh4MVDqcZUQl3punj0C2QkhSDQ5Y3lgzjSWYi2FbdfnhLqD2NcMwNwhXDBVgiuH2ULXyA4dqtY7zNs0vC6bT2kPvJrBAO1RFBkfyv+qlZfwSxC/s/2O8IpGtSqkn40xAyKuN09ytH1PkQMvDsQcvKoug0dzjxhedVIw6Jjr8eVY0/xKHnblS1IZj24gXAZWTkqnfGhPwrPmPk37ks8+A== Received: from SN4PR0501CA0108.namprd05.prod.outlook.com (2603:10b6:803:42::25) by MN0PR12MB5786.namprd12.prod.outlook.com (2603:10b6:208:375::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.25; Mon, 11 Nov 2024 06:38:07 +0000 Received: from SN1PEPF0002636C.namprd02.prod.outlook.com (2603:10b6:803:42:cafe::16) by SN4PR0501CA0108.outlook.office365.com (2603:10b6:803:42::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Mon, 11 Nov 2024 06:38:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF0002636C.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.14 via Frontend Transport; Mon, 11 Nov 2024 06:38:07 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 10 Nov 2024 22:37:57 -0800 Received: from nvidia.com (10.126.230.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.1544.4; Sun, 10 Nov 2024 22:37:55 -0800 From: Xueming Li To: Joshua Washington CC: , Rushil Gupta , "Praveen Kaligineedi" , dpdk stable Subject: patch 'net/gve: fix mbuf allocation memory leak for DQ Rx' has been queued to stable release 23.11.3 Date: Mon, 11 Nov 2024 14:28:14 +0800 Message-ID: <20241111062847.216344-89-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241111062847.216344-1-xuemingl@nvidia.com> References: <20241111062847.216344-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.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: SN1PEPF0002636C:EE_|MN0PR12MB5786:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fc07893-c2f7-4b0e-669e-08dd021b6750 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?WWsxiDSe3gddq7aKAW9bXH8/ZXgpao0XhudvjX4sFUeIVJKvmTpp3YBdFR/4?= =?us-ascii?Q?7l+TFKmuaDxp6ObgyfSIkXFleoojfpBzoc7KH3PNf9AA/b3gc7DS9d9GlLLV?= =?us-ascii?Q?XafGBgwt8h9B3jPw0tuoMLg/loW747BJ1mXvc7ME5BJ+lNLMIdsYZg3m97zC?= =?us-ascii?Q?aEV9836YR3bwgv4Kp+iLfQO6/AbutKK7LXcGJv6OoMK8Mla59w7cQ6I6SVfY?= =?us-ascii?Q?z4pzG2SePGKsFzTZpkx5GBb2lXUmY1VBmy+MxuZqmtQNsHxtW1LKaQSsYjDz?= =?us-ascii?Q?fqDG738JLRc3+RYeExOwIFYvzdU9jpMEvw/rPTEAf6tt2uz8C3siPI3I/bhF?= =?us-ascii?Q?DEUMn565WUhT+M0NSx9/6C1NdORou0+tFLhzjDbPD3GCkzmzAyUOelAYbNkf?= =?us-ascii?Q?J6UNA7sNheldTAF7eN2nTjqb0ncYePCHKEk2ceXN0zoQdoVTCg5nWe0r1/Kw?= =?us-ascii?Q?PkhYRhSVb65Fejc38FwRYBW43bsipaQJHYyV4wQKE+hvAk8EtX9PD8eY7F9s?= =?us-ascii?Q?Xsd2t4YXD9J9kXVmGVAy6aGt29989dLdB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efront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 06:38:07.5923 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fc07893-c2f7-4b0e-669e-08dd021b6750 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5786 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.3 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/30/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=4c28c4f7677e0841e37ab4cf4e6db264e41ad8df Thanks. Xueming Li --- >From 4c28c4f7677e0841e37ab4cf4e6db264e41ad8df Mon Sep 17 00:00:00 2001 From: Joshua Washington Date: Tue, 1 Oct 2024 16:48:52 -0700 Subject: [PATCH] net/gve: fix mbuf allocation memory leak for DQ Rx Cc: Xueming Li [ upstream commit 265daac8a53aaaad89f562c201bc6c269d7817fc ] Currently, gve_rxq_mbufs_alloc_dqo() allocates RING_SIZE buffers, but only posts RING_SIZE - 1 of them, inevitably leaking a buffer every time queues are stopped/started. This could eventually lead to running out of mbufs if an application stops/starts traffic enough. Fixes: b044845bb015 ("net/gve: support queue start/stop") Signed-off-by: Joshua Washington Reviewed-by: Rushil Gupta Reviewed-by: Praveen Kaligineedi --- .mailmap | 1 + drivers/net/gve/gve_rx_dqo.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.mailmap b/.mailmap index 674384cfc5..c26a1acf7a 100644 --- a/.mailmap +++ b/.mailmap @@ -1141,6 +1141,7 @@ Pradeep Satyanarayana Prashant Bhole Prashant Upadhyaya Prateek Agarwal +Praveen Kaligineedi Praveen Shetty Pravin Pathak Prince Takkar diff --git a/drivers/net/gve/gve_rx_dqo.c b/drivers/net/gve/gve_rx_dqo.c index a56cdbf11b..855c06dc11 100644 --- a/drivers/net/gve/gve_rx_dqo.c +++ b/drivers/net/gve/gve_rx_dqo.c @@ -335,34 +335,36 @@ static int gve_rxq_mbufs_alloc_dqo(struct gve_rx_queue *rxq) { struct rte_mbuf *nmb; + uint16_t rx_mask; uint16_t i; int diag; - diag = rte_pktmbuf_alloc_bulk(rxq->mpool, &rxq->sw_ring[0], rxq->nb_rx_desc); + rx_mask = rxq->nb_rx_desc - 1; + diag = rte_pktmbuf_alloc_bulk(rxq->mpool, &rxq->sw_ring[0], + rx_mask); if (diag < 0) { rxq->stats.no_mbufs_bulk++; - for (i = 0; i < rxq->nb_rx_desc - 1; i++) { + for (i = 0; i < rx_mask; i++) { nmb = rte_pktmbuf_alloc(rxq->mpool); if (!nmb) break; rxq->sw_ring[i] = nmb; } if (i < rxq->nb_rx_desc - 1) { - rxq->stats.no_mbufs += rxq->nb_rx_desc - 1 - i; + rxq->stats.no_mbufs += rx_mask - i; return -ENOMEM; } } - for (i = 0; i < rxq->nb_rx_desc; i++) { - if (i == rxq->nb_rx_desc - 1) - break; + for (i = 0; i < rx_mask; i++) { nmb = rxq->sw_ring[i]; rxq->rx_ring[i].buf_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(nmb)); rxq->rx_ring[i].buf_id = rte_cpu_to_le_16(i); } + rxq->rx_ring[rx_mask].buf_id = rte_cpu_to_le_16(rx_mask); rxq->nb_rx_hold = 0; - rxq->bufq_tail = rxq->nb_rx_desc - 1; + rxq->bufq_tail = rx_mask; rte_write32(rxq->bufq_tail, rxq->qrx_tail); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-11 14:23:09.130822358 +0800 +++ 0088-net-gve-fix-mbuf-allocation-memory-leak-for-DQ-Rx.patch 2024-11-11 14:23:05.232192837 +0800 @@ -1 +1 @@ -From 265daac8a53aaaad89f562c201bc6c269d7817fc Mon Sep 17 00:00:00 2001 +From 4c28c4f7677e0841e37ab4cf4e6db264e41ad8df Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 265daac8a53aaaad89f562c201bc6c269d7817fc ] @@ -12 +14,0 @@ -Cc: stable@dpdk.org @@ -23 +25 @@ -index 6e72362ebc..7b3a20af68 100644 +index 674384cfc5..c26a1acf7a 100644 @@ -26 +28,2 @@ -@@ -1193,6 +1193,7 @@ Prashant Bhole +@@ -1141,6 +1141,7 @@ Pradeep Satyanarayana + Prashant Bhole @@ -29 +31,0 @@ - Prathisna Padmasanan @@ -35 +37 @@ -index d8e9eee4a8..81a68f0c7e 100644 +index a56cdbf11b..855c06dc11 100644 @@ -38 +40 @@ -@@ -395,34 +395,36 @@ static int +@@ -335,34 +335,36 @@ static int