[dpdk-stable] patch 'net/af_xdp: avoid deadlock due to empty fill queue' has been queued to stable release 19.11.6

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Oct 28 11:43:47 CET 2020


Hi,

FYI, your patch has been queued to stable release 19.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/30/20. 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.

Thanks.

Luca Boccassi

---
>From d412170b226f6f5de3d6799697fd242e28f5b7b6 Mon Sep 17 00:00:00 2001
From: RongQing Li <lirongqing at baidu.com>
Date: Fri, 18 Sep 2020 19:32:31 +0800
Subject: [PATCH] net/af_xdp: avoid deadlock due to empty fill queue

[ upstream commit ab7ed23a2f3e74f1341de76b19256842c4cdc7f2 ]

While receiving packets, it is possible to fail to reserve
fill queue, since buffer ring is shared between tx and rx,
and maybe not available temporary. As a result both fill
queue and Rx queue will be empty.

Then kernel side will not be able to receive packets due to
empty fill queue, and dpdk will not be able to reserve fill
queue because dpdk doesn't have packets to receive, finally
deadlock will happen.

So move reserve fill queue before xsk_ring_cons__peek to fix it.

Signed-off-by: RongQing Li <lirongqing at baidu.com>
Signed-off-by: Dongsheng Rong <rongdongsheng at baidu.com>
Acked-by: Ciara Loftus <ciara.loftus at intel.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index fbc95e5483..c5c906ff96 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -305,22 +305,23 @@ af_xdp_rx_cp(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	uint32_t free_thresh = fq->size >> 1;
 	struct rte_mbuf *mbufs[ETH_AF_XDP_RX_BATCH_SIZE];
 
-	if (unlikely(rte_pktmbuf_alloc_bulk(rxq->mb_pool, mbufs, nb_pkts) != 0))
-		return 0;
-
-	rcvd = xsk_ring_cons__peek(rx, nb_pkts, &idx_rx);
-	if (rcvd == 0) {
-#if defined(XDP_USE_NEED_WAKEUP)
-		if (xsk_ring_prod__needs_wakeup(fq))
-			(void)poll(rxq->fds, 1, 1000);
-#endif
-
-		goto out;
-	}
-
 	if (xsk_prod_nb_free(fq, free_thresh) >= free_thresh)
 		(void)reserve_fill_queue(umem, ETH_AF_XDP_RX_BATCH_SIZE, NULL);
 
+
+	if (unlikely(rte_pktmbuf_alloc_bulk(rxq->mb_pool, mbufs, nb_pkts) != 0))
+		return 0;
+
+	rcvd = xsk_ring_cons__peek(rx, nb_pkts, &idx_rx);
+	if (rcvd == 0) {
+#if defined(XDP_USE_NEED_WAKEUP)
+		if (xsk_ring_prod__needs_wakeup(fq))
+			(void)poll(rxq->fds, 1, 1000);
+#endif
+
+		goto out;
+	}
+
 	for (i = 0; i < rcvd; i++) {
 		const struct xdp_desc *desc;
 		uint64_t addr;
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-10-28 10:35:13.876590801 +0000
+++ 0068-net-af_xdp-avoid-deadlock-due-to-empty-fill-queue.patch	2020-10-28 10:35:11.540830553 +0000
@@ -1,8 +1,10 @@
-From ab7ed23a2f3e74f1341de76b19256842c4cdc7f2 Mon Sep 17 00:00:00 2001
+From d412170b226f6f5de3d6799697fd242e28f5b7b6 Mon Sep 17 00:00:00 2001
 From: RongQing Li <lirongqing at baidu.com>
 Date: Fri, 18 Sep 2020 19:32:31 +0800
 Subject: [PATCH] net/af_xdp: avoid deadlock due to empty fill queue
 
+[ upstream commit ab7ed23a2f3e74f1341de76b19256842c4cdc7f2 ]
+
 While receiving packets, it is possible to fail to reserve
 fill queue, since buffer ring is shared between tx and rx,
 and maybe not available temporary. As a result both fill
@@ -15,8 +17,6 @@
 
 So move reserve fill queue before xsk_ring_cons__peek to fix it.
 
-Cc: stable at dpdk.org
-
 Signed-off-by: RongQing Li <lirongqing at baidu.com>
 Signed-off-by: Dongsheng Rong <rongdongsheng at baidu.com>
 Acked-by: Ciara Loftus <ciara.loftus at intel.com>
@@ -25,10 +25,10 @@
  1 file changed, 14 insertions(+), 13 deletions(-)
 
 diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
-index b65ee449fc..00de671841 100644
+index fbc95e5483..c5c906ff96 100644
 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
 +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
-@@ -304,22 +304,23 @@ af_xdp_rx_cp(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
+@@ -305,22 +305,23 @@ af_xdp_rx_cp(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
  	uint32_t free_thresh = fq->size >> 1;
  	struct rte_mbuf *mbufs[ETH_AF_XDP_RX_BATCH_SIZE];
  


More information about the stable mailing list