diff mbox series

[7/9,v2] mempool/dpaa2: panic on endless loop in mbuf release

Message ID 20191017124403.26734-8-nipun.gupta@nxp.com
State Superseded
Headers show
Series DPAA and FSLMC driver fixes and cleanup | expand

Commit Message

Nipun Gupta Oct. 17, 2019, 12:44 p.m. UTC
From: Radu Bulie <radu-andrei.bulie@nxp.com>


When BMAN is not able to accept more buffers, it could be that
there are no FBPR's (internal mem provided to bman) left.
Panic in such conditions.

Fixes: 5dc43d22b5ad ("mempool/dpaa2: add hardware offloaded mempool")
Cc: stable@dpdk.org

Signed-off-by: Radu Bulie <radu-andrei.bulie@nxp.com>

---
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

-- 
2.17.1

Comments

Thomas Monjalon Oct. 23, 2019, 11:08 p.m. UTC | #1
17/10/2019 14:44, Nipun Gupta:
> From: Radu Bulie <radu-andrei.bulie@nxp.com>

> +				rte_panic("bman release retry exceeded, low fbpr?\n");


You are not supposed to call rte_panic in a library.
Please replace with a smoother abort.
Nipun Gupta Oct. 30, 2019, 12:17 p.m. UTC | #2
Hi Thomas,

> -----Original Message-----

> From: Thomas Monjalon <thomas@monjalon.net>

> Sent: Thursday, October 24, 2019 4:39 AM

> To: Nipun Gupta <nipun.gupta@nxp.com>; Radu-andrei Bulie <radu-

> andrei.bulie@nxp.com>

> Cc: stable@dpdk.org; dev@dpdk.org; ferruh.yigit@intel.com; Hemant

> Agrawal <hemant.agrawal@nxp.com>; Sachin Saxena

> <sachin.saxena@nxp.com>

> Subject: Re: [dpdk-stable] [PATCH 7/9 v2] mempool/dpaa2: panic on endless

> loop in mbuf release

> 

> 17/10/2019 14:44, Nipun Gupta:

> > From: Radu Bulie <radu-andrei.bulie@nxp.com>

> > +				rte_panic("bman release retry exceeded, low

> fbpr?\n");

> 

> You are not supposed to call rte_panic in a library.

> Please replace with a smoother abort.


Agree. Will add a log and return.

> 

> 

> 

>
diff mbox series

Patch

diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index f26c30b00..7e815a1ce 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -192,7 +192,7 @@  rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
 	struct qbman_release_desc releasedesc;
 	struct qbman_swp *swp;
 	int ret;
-	int i, n;
+	int i, n, retry_count;
 	uint64_t bufs[DPAA2_MBUF_MAX_ACQ_REL];
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -225,9 +225,13 @@  rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
 	}
 
 	/* feed them to bman */
-	do {
-		ret = qbman_swp_release(swp, &releasedesc, bufs, n);
-	} while (ret == -EBUSY);
+	retry_count = 0;
+	while ((ret = qbman_swp_release(swp, &releasedesc, bufs, n)) ==
+			-EBUSY) {
+		retry_count++;
+		if (retry_count > DPAA2_MAX_TX_RETRY_COUNT)
+			rte_panic("bman release retry exceeded, low fbpr?\n");
+	}
 
 aligned:
 	/* if there are more buffers to free */
@@ -243,10 +247,13 @@  rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
 #endif
 		}
 
-		do {
-			ret = qbman_swp_release(swp, &releasedesc, bufs,
-						DPAA2_MBUF_MAX_ACQ_REL);
-		} while (ret == -EBUSY);
+		retry_count = 0;
+		while ((ret = qbman_swp_release(swp, &releasedesc, bufs,
+					DPAA2_MBUF_MAX_ACQ_REL)) == -EBUSY) {
+			retry_count++;
+			if (retry_count > DPAA2_MAX_TX_RETRY_COUNT)
+				rte_panic("bman release retry exceeded, low fbpr?\n");
+		}
 		n += DPAA2_MBUF_MAX_ACQ_REL;
 	}
 }