[PATCH v2 4/9] bpf: remove redundant memory barrier on unload

Marat Khalili qm2k21 at gmail.com
Mon Oct 12 23:09:11 CEST 2026


From: Stephen Hemminger <stephen at networkplumber.org>

In bpf_eth_cbi_unload(), rte_smp_mb() was called immediately before
bpf_eth_cbi_wait(), which itself starts with rte_smp_mb().

Remove the redundant rte_smp_mb() call from bpf_eth_cbi_unload() and
update the unload sequence diagram accordingly.

Originally proposed by Stephen Hemminger as part of a series replacing
deprecated SMP barriers with C11 fences.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Signed-off-by: Marat Khalili <qm2k21 at gmail.com>
---
 lib/bpf/bpf_pkt.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lib/bpf/bpf_pkt.c b/lib/bpf/bpf_pkt.c
index eab85f7417..b1e25e4e7c 100644
--- a/lib/bpf/bpf_pkt.c
+++ b/lib/bpf/bpf_pkt.c
@@ -62,8 +62,6 @@
  *     |                      |               |              |              |                |
  *   rte_smp_mb()             |               |              |              |                |
  *     |                      |               |              |              |                |
- *   rte_smp_mb()             |               |              |              |                |
- *     |                      |               |              |              |                |
  *     +-if use is odd        |               |              |              | if cb not NULL-+
  *     | |                    |               |              |              |              | |
  *     | +------------ fetch odd ------------>|              |              |<-- execute --+ |
@@ -502,7 +500,6 @@ bpf_eth_cbi_unload(struct bpf_eth_cbi *bc)
 {
 	/* mark this cbi as empty */
 	bc->cb = NULL;
-	rte_smp_mb();
 
 	/* make sure datapath doesn't use bpf anymore, then destroy bpf */
 	bpf_eth_cbi_wait(bc);
-- 
2.43.0



More information about the dev mailing list