patch 'net/gve: fix mbuf allocation memory leak for DQ Rx' has been queued to stable release 23.11.3
Xueming Li
xuemingl at nvidia.com
Mon Nov 11 07:28:14 CET 2024
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 <xuemingl at nvidia.com>
---
>From 4c28c4f7677e0841e37ab4cf4e6db264e41ad8df Mon Sep 17 00:00:00 2001
From: Joshua Washington <joshwash at google.com>
Date: Tue, 1 Oct 2024 16:48:52 -0700
Subject: [PATCH] net/gve: fix mbuf allocation memory leak for DQ Rx
Cc: Xueming Li <xuemingl at nvidia.com>
[ 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 <joshwash at google.com>
Reviewed-by: Rushil Gupta <rushilg at google.com>
Reviewed-by: Praveen Kaligineedi <pkaligineedi at google.com>
---
.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 <pradeep at us.ibm.com>
Prashant Bhole <bhole_prashant_q7 at lab.ntt.co.jp>
Prashant Upadhyaya <prashant.upadhyaya at aricent.com> <praupadhyaya at gmail.com>
Prateek Agarwal <prateekag at cse.iitb.ac.in>
+Praveen Kaligineedi <pkaligineedi at google.com>
Praveen Shetty <praveen.shetty at intel.com>
Pravin Pathak <pravin.pathak at intel.com>
Prince Takkar <ptakkar at marvell.com>
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 <xuemingl at nvidia.com>
+
+[ upstream commit 265daac8a53aaaad89f562c201bc6c269d7817fc ]
@@ -12 +14,0 @@
-Cc: stable at dpdk.org
@@ -23 +25 @@
-index 6e72362ebc..7b3a20af68 100644
+index 674384cfc5..c26a1acf7a 100644
@@ -26 +28,2 @@
-@@ -1193,6 +1193,7 @@ Prashant Bhole <bhole_prashant_q7 at lab.ntt.co.jp>
+@@ -1141,6 +1141,7 @@ Pradeep Satyanarayana <pradeep at us.ibm.com>
+ Prashant Bhole <bhole_prashant_q7 at lab.ntt.co.jp>
@@ -29 +31,0 @@
- Prathisna Padmasanan <prathisna.padmasanan at intel.com>
@@ -35 +37 @@
-index d8e9eee4a8..81a68f0c7e 100644
+index a56cdbf11b..855c06dc11 100644
@@ -38 +40 @@
-@@ -395,34 +395,36 @@ static int
+@@ -335,34 +335,36 @@ static int
More information about the stable
mailing list