RE: [RFC 13/32] ring: replace SMP read barrier with C11 acquire fence
Morten Brørup <[email protected]> Fri, 31 Jul 2026 16:47:39 +0200
| Newsgroups | org.dpdk.dev |
|---|---|
| Message-ID | <[email protected]> |
> From: Stephen Hemminger [mailto:[email protected]] > Sent: Wednesday, 29 July 2026 19.54 >=20 > rte_smp_rmb() is deprecated. The acquire fence generates the same > code everywhere the gcc implementation is used: a compiler barrier > on x86 and dmb ishld on ThunderX. >=20 > The gcc implementation itself is kept: unlike the lock-free stack, > the in-tree comment records a 10% x86 performance drop with the > C11 version, which needs re-measuring with current compilers > before RTE_USE_C11_MEM_MODEL can be removed. >=20 > Signed-off-by: Stephen Hemminger <[email protected]> > --- > lib/ring/rte_ring_gcc_pvt.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/ring/rte_ring_gcc_pvt.h b/lib/ring/rte_ring_gcc_pvt.h > index 340ece28c7..9c2c58824d 100644 > --- a/lib/ring/rte_ring_gcc_pvt.h > +++ b/lib/ring/rte_ring_gcc_pvt.h > @@ -55,10 +55,10 @@ __rte_ring_headtail_move_head_st(struct > rte_ring_headtail *d, >=20 > *old_head =3D d->head; >=20 > - /* add rmb barrier to avoid load/load reorder in weak > - * memory model. It is noop on x86 > + /* Acquire fence to avoid load/load reorder in weak > + * memory model. It is noop on x86. > */ > - rte_smp_rmb(); > + rte_atomic_thread_fence(rte_memory_order_acquire); >=20 > /* > * The subtraction is done between two unsigned 32bits value > -- > 2.53.0 Acked-by: Morten Br=F8rup <[email protected]>