* [Bug 882] ixgbe dirver may resue some unreleased mbufs
@ 2021-11-12 16:20 bugzilla
2022-02-02 14:45 ` [Bug 882] ixgbe dirver may cause some unreleased mbufs be reused by application bugzilla
0 siblings, 1 reply; 2+ messages in thread
From: bugzilla @ 2021-11-12 16:20 UTC (permalink / raw)
To: dev
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: dev@dpdk.org
Reporter: zhengbin.89740@bytedance.com
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:
959
nb_rx_desc: 1024 RDH: 1004 RDT: 1023 rxrearm_nb: 991 rxrearm_start: 0 rx_tail:
991
nb_rx_desc: 1024 RDH: 12 RDT: 31 rxrearm_nb: 991 rxrearm_start: 32 rx_tail:
1023
nb_rx_desc: 1024 RDH: 31 RDT: 63 rxrearm_nb: 960 rxrearm_start: 64 rx_tail: 0
nb_rx_desc: 1024 RDH: 95 RDT: 95 rxrearm_nb: 1016 rxrearm_start: 96 rx_tail: 88
nb_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:
895
nb_rx_desc: 1024 RDH: 940 RDT: 959 rxrearm_nb: 991 rxrearm_start: 960 rx_tail:
927
nb_rx_desc: 1024 RDH: 980 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail:
959
nb_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.
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index 1eed949495..648ad9eadd 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -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!
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug 882] ixgbe dirver may cause some unreleased mbufs be reused by application
2021-11-12 16:20 [Bug 882] ixgbe dirver may resue some unreleased mbufs bugzilla
@ 2022-02-02 14:45 ` bugzilla
0 siblings, 0 replies; 2+ messages in thread
From: bugzilla @ 2022-02-02 14:45 UTC (permalink / raw)
To: dev
https://bugs.dpdk.org/show_bug.cgi?id=882
Thomas Monjalon (thomas@monjalon.net) changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from Thomas Monjalon (thomas@monjalon.net) ---
Resolved in http://git.dpdk.org/dpdk/commit/?id=c59f93d9a1
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-02 14:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 16:20 [Bug 882] ixgbe dirver may resue some unreleased mbufs bugzilla
2022-02-02 14:45 ` [Bug 882] ixgbe dirver may cause some unreleased mbufs be reused by application bugzilla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).