ixgbe dirver may resue some unreleased mbufs
https://bugs.dpdk.org/show_bug.cgi?id=882
Bug ID: 882
Summary: ixgbe dirver may resue some unreleased mbufs
Product: DPDK
Version: 20.11
Hardware: x86
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: ethdev
Assignee: [email protected]
Reporter: [email protected]Target Milestone: ---
Created attachment 174
--> https://bugs.dpdk.org/attachment.cgi?id=174&action=edit
this demo can reproduce this bug
file: drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c:334
func: _recv_raw_pkts_vec()
This bug will appear when the following conditions are met:
1. arg nb_pkts is greater than the RTE_IXGBE_RXQ_REARM_THRESH
2. the application holds mbuf instead of releasing it immediately
On _recv_raw_pkts_vec(), if nb_pkts is greater than the RTE_IXGBE_RXQ_REARM_THRESH and rx_tail wrap back to zero,
in this case rx_tail may advance faster than rxrearm_start, which may cause some unreleased mbufs be reused.
e.g.
nb_rx_desc: 1024 RDH: 972 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail:
959nb_rx_desc: 1024 RDH: 1004 RDT: 1023 rxrearm_nb: 991 rxrearm_start: 0 rx_tail:
991nb_rx_desc: 1024 RDH: 12 RDT: 31 rxrearm_nb: 991 rxrearm_start: 32 rx_tail:
1023nb_rx_desc: 1024 RDH: 31 RDT: 63 rxrearm_nb: 960 rxrearm_start: 64 rx_tail: 0nb_rx_desc: 1024 RDH: 95 RDT: 95 rxrearm_nb: 1016 rxrearm_start: 96 rx_tail: 88nb_rx_desc: 1024 RDH: 95 RDT: 127 rxrearm_nb: 991 rxrearm_start: 128 rx_tail:
95
...nb_rx_desc: 1024 RDH: 908 RDT: 927 rxrearm_nb: 991 rxrearm_start: 928 rx_tail:
895nb_rx_desc: 1024 RDH: 940 RDT: 959 rxrearm_nb: 991 rxrearm_start: 960 rx_tail:
927nb_rx_desc: 1024 RDH: 980 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail:
959nb_rx_desc: 1024 RDH: 991 RDT: 991 rxrearm_nb: 1026 rxrearm_start: 992 rx_tail:
994
when rx_tail catches up with rxrearm_start, 2(994 - 992) unreleased mbuf be reused!
The simplest solution is to limit the size of nb_pkts to no more than RTE_IXGBE_RXQ_REARM_THRESH.
However, this method may affect the packet receiving speed of the application.
Just like it.
(quoted diff) +0 -0
b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index 1eed949495..648ad9eadd 100644
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +0 -0
@@ -364,6 +364,12 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct
rte_mbuf **rx_pkts,
uint8_t vlan_flags;
uint16_t udp_p_flag = 0; /* Rx Descriptor UDP header present */
+ /*
+ * If nb_pkts is greater than the threshold,
+ * it may cause some unreleased mbuf be reused.
+ */
+ nb_pkts = RTE_MIN(nb_pkts, RTE_IXGBE_RXQ_REARM_THRESH);
+
/* nb_pkts has to be floor-aligned to RTE_IXGBE_DESCS_PER_LOOP */
nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, RTE_IXGBE_DESCS_PER_LOOP);The attachment has a corresponding demo to reproduce this bug.
Thanks!
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
[Bug 882] ixgbe dirver may cause some unreleased mbufs be reused by application
https://bugs.dpdk.org/show_bug.cgi?id=882
Thomas Monjalon ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED--- Comment #1 from Thomas Monjalon ([email protected]) --- Resolved in http://git.dpdk.org/dpdk/commit/?id=c59f93d9a1
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.