On Sun, 11 Oct 2026 18:21:57 +0000 Marat Khalili <[email protected]> wrote:
> The callback handle member cb of struct bpf_eth_cbi is concurrently > cleared by the control plane on unload and read by the datapath to > decide whether to execute the BPF filter program. Without atomic typing, > this concurrent access constitutes a data race in the C11 memory model, > even though hardware pointer accesses are single-copy atomic and untorn. > > Change cb to RTE_ATOMIC and use rte_atomic_load_explicit() and > rte_atomic_store_explicit() with rte_memory_order_relaxed for all its > accesses. On modern architectures this produces the exact same machine > code while eliminating undefined behavior. > > In addition, marking cb as atomic improves code self-documentation by > making it immediately evident that cb is an active part of the cross- > thread synchronization mechanism on par with use. > > Signed-off-by: Marat Khalili <[email protected]> > --- Since inuse and cb are inter-related would be easier to squash the mb conversion and the bool and the atomic cb into one patch.

