Skip to content

deprecate rte_atomicNN family

Stephen Hemminger dpdk-dev 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest27 patches 11 repliesIn review
  2. v3 posting 2/227 patches 1 replySuperseded
  3. v3 posting 1/29 of 27 patches 4 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 RFC11 patches2 repliesSuperseded
v1 RFC7 patches2 repliesSuperseded

Changes in v4 from the cover letter

================

- lib/ring: keep the existing C11 element-access code; the earlier rewrite regressed ring_perf 20-30% on x86 with GCC's handling of atomic_compare_exchange_weak_explicit(). v4 keeps the original structure and adds a wrapper for the one performance-sensitive CAS.

- lib/bpf: keep the BPF_ST_ATOMIC_REG macro structure rather than open-coding the converted callers; the macro body is rewritten to use stdatomic.

- Compilation fixes across the driver conversions caught during review (CAS expected-value types, format-string specifiers, dpaax HWDEBUG path).

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/27eal: use intrinsics for rte_atomic on all platformslib/eal/arm/include/rte_atomic_32.h lib/eal/arm/include/rte_atomic_64.h lib/eal/include/generic/rte_atomic.h +6 more+6 -7761 reply
2/27eal: reimplement rte_smp_*mb with rte_atomic_thread_fencedevtools/checkpatches.sh doc/guides/rel_notes/deprecation.rst lib/eal/arm/include/rte_atomic_32.h +6 more+37 -1721 reply
3/27ring: unify memory model on C11, remove atomic32lib/ring/meson.build lib/ring/rte_ring_c11_pvt.h lib/ring/rte_ring_elem_pvt.h +2 more+158 -1204 replies
4/27bpf: use C11 atomics in BPF_ST_ATOMIC_REGlib/bpf/bpf_exec.c+7 -61 reply
5/27net/bonding: use stdatomicdrivers/net/bonding/eth_bond_8023ad_private.h drivers/net/bonding/rte_eth_bond_8023ad.c+17 -240 replies
6/27net/nbl: remove unused rte_atomic16 fielddrivers/net/nbl/nbl_hw/nbl_resource.h+0 -10 replies
7/27net/ena: replace use of rte_atomicNNdrivers/net/ena/base/ena_plat_dpdk.h drivers/net/ena/ena_ethdev.c drivers/net/ena/ena_ethdev.h+18 -240 replies
8/27net/failsafe: convert to stdatomicdrivers/net/failsafe/failsafe_ops.c drivers/net/failsafe/failsafe_private.h drivers/net/failsafe/failsafe_rxtx.c+22 -210 replies
9/27net/enic: do not use deprecated rte_atomic64drivers/net/enic/enic.h drivers/net/enic/enic_compat.h drivers/net/enic/enic_main.c +2 more+18 -240 replies
10/27net/pfe: use ethdev linkstatus helpersdrivers/net/pfe/pfe_ethdev.c+2 -300 replies
11/27net/sfc: replace rte_atomic with stdatomicdrivers/net/sfc/sfc.c drivers/net/sfc/sfc.h drivers/net/sfc/sfc_port.c +1 more+9 -131 reply
12/27crypto/ccp: replace use of rte_atomic64 with stdatomicdrivers/crypto/ccp/ccp_crypto.c drivers/crypto/ccp/ccp_crypto.h drivers/crypto/ccp/ccp_dev.c +1 more+16 -110 replies
13/27bus/dpaa: replace rte_atomic16 with stdatomicdrivers/bus/dpaa/base/qbman/qman.c+6 -30 replies
14/27drivers: replace rte_atomic16 with stdatomicdrivers/bus/fslmc/portal/dpaa2_hw_dpbp.c drivers/bus/fslmc/portal/dpaa2_hw_dpci.c drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +2 more+33 -180 replies
15/27net/netvsc: replace rte_atomic32 with stdatomicdrivers/net/netvsc/hn_rndis.c drivers/net/netvsc/hn_rxtx.c drivers/net/netvsc/hn_var.h+29 -173 replies
16/27event/sw: convert from rte_atomic32 to stdatomicdrivers/event/sw/sw_evdev.c drivers/event/sw/sw_evdev.h drivers/event/sw/sw_evdev_worker.c+18 -100 replies
17/27bus/vmbus: convert from rte_atomic to stdatomicdrivers/bus/vmbus/private.h drivers/bus/vmbus/vmbus_bufring.c+23 -180 replies
18/27common/dpaax: use stdatomic instead of rte_atomicdrivers/common/dpaax/compat.h+8 -130 replies
19/27net/bnx2x: convert from rte_atomic32 to stdatomicdrivers/net/bnx2x/bnx2x.c drivers/net/bnx2x/bnx2x.h drivers/net/bnx2x/ecore_sp.c+7 -70 replies
20/27bus/fslmc: replace rte_atomic32 with stdatomicdrivers/bus/fslmc/qbman/include/compat.h+8 -130 replies
21/27drivers/event: replace rte_atomic32 in selftestsdrivers/event/dpaa2/dpaa2_eventdev_selftest.c drivers/event/octeontx/ssovf_evdev_selftest.c+47 -400 replies
22/27net/hinic: replace rte_atomic32 with stdatomicdrivers/net/hinic/base/hinic_compat.h drivers/net/hinic/base/hinic_pmd_hwdev.c drivers/net/hinic/base/hinic_pmd_hwdev.h+17 -130 replies
23/27net/txgbe: replace rte_atomic32 with stdatomicdrivers/net/txgbe/base/txgbe_mng.c drivers/net/txgbe/base/txgbe_type.h+3 -30 replies
24/27net/vhost: use stdatomic instead of rte_atomic32drivers/net/vhost/rte_eth_vhost.c+65 -380 replies
25/27vdpa/ifc: replace rte_atomic32 with stdatomicdrivers/vdpa/ifc/ifcvf_vdpa.c+19 -180 replies
26/27test/atomic: suppress deprecation warnings for legacy APIsapp/test/test_atomic.c+12 -00 replies
27/27eal: mark rte_atomicNN as deprecateddevtools/checkpatches.sh doc/guides/rel_notes/deprecation.rst doc/guides/rel_notes/release_26_07.rst +2 more+62 -560 replies

Reviews trailers per patch

4 of 27 patches have a Reviewed-by or Acked-by.

PatchMarat KhaliliAndrew RybchenkoKonstantin Ananyev
1/27A-b
2/27A-b
3/27
4/27R-b
5/27
6/27
7/27
8/27
9/27
10/27
11/27R-b
12/27
13/27
14/27
15/27
16/27
17/27
18/27
19/27
20/27
21/27
22/27
23/27
24/27
25/27
26/27
27/27

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/27] deprecate rte_atomicNN family

The rte_atomicNN_* family was flagged for deprecation in 2021 by commit 3ec965b6de12 ("doc: update atomic operation deprecation") but enforcement never landed and in-tree usage continued to grow. This series finishes converting every remaining in-tree caller to the C11-style rte_atomic_*_explicit() / RTE_ATOMIC() API, then marks the legacy functions __rte_deprecated so future in-tree and out-of-tree uses are caught at compile time.

Performance: ran the DPDK perf-tests suite (mempool, hash, stack, ring, distributor, rcu_qsbr, etc.) on the full series; only lib/ring showed a regression, addressed by the wrapper in patch 03.

Patch organisation
==================

01-02 EAL: drop the inline-asm fallback paths now that intrinsics
work on all platforms; reimplement rte_smp_*mb on top of rte_atomic_thread_fence.

03-04 lib/ring and lib/bpf -- the last legacy callers in lib/.

05-25 Drivers and selftests, one patch per directory.

26 Suppress deprecation warnings in app/test/test_atomic.c,
which exercises the legacy API until it goes away.

27 Mark rte_atomicNN_* with __rte_deprecated and drop the
corresponding checkpatch grep; new uses are now caught at compile time.

Changes since v3
================

- lib/ring: keep the existing C11 element-access code; the earlier rewrite regressed ring_perf 20-30% on x86 with GCC's handling of atomic_compare_exchange_weak_explicit(). v4 keeps the original structure and adds a wrapper for the one performance-sensitive CAS.

- lib/bpf: keep the BPF_ST_ATOMIC_REG macro structure rather than open-coding the converted callers; the macro body is rewritten to use stdatomic.

- Compilation fixes across the driver conversions caught during review (CAS expected-value types, format-string specifiers, dpaax HWDEBUG path).

Targeting 26.11 rather than the next release. The driver conversions touch many maintainers' code and several are likely to need cycles of review/respin; a longer review window avoids rushing contested orderings into an earlier release.

Feedback wanted
===============

- vmbus producer commit-order pattern (patch 17)
- the ring CAS GCC bug workaround might be needed on other similar uses of ring buffers in vmbus and netvsc.
- Dekker-style seq_cst handshake in net/vhost (patch 24), which also closes a pre-existing ordering hole on weakly-ordered ISAs
- netvsc rndis_pending claim/timeout/clear cmpxchg orderings

    (patch 15)

Stephen Hemminger (27):
eal: use intrinsics for rte_atomic on all platforms
eal: reimplement rte_smp_*mb with rte_atomic_thread_fence
ring: unify memory model on C11, remove atomic32
bpf: use C11 atomics in BPF_ST_ATOMIC_REG net/bonding: use stdatomic
net/nbl: remove unused rte_atomic16 field net/ena: replace use of rte_atomicNN net/failsafe: convert to stdatomic
net/enic: do not use deprecated rte_atomic64 net/pfe: use ethdev linkstatus helpers
net/sfc: replace rte_atomic with stdatomic crypto/ccp: replace use of rte_atomic64 with stdatomic bus/dpaa: replace rte_atomic16 with stdatomic
drivers: replace rte_atomic16 with stdatomic net/netvsc: replace rte_atomic32 with stdatomic event/sw: convert from rte_atomic32 to stdatomic bus/vmbus: convert from rte_atomic to stdatomic common/dpaax: use stdatomic instead of rte_atomic net/bnx2x: convert from rte_atomic32 to stdatomic bus/fslmc: replace rte_atomic32 with stdatomic drivers/event: replace rte_atomic32 in selftests net/hinic: replace rte_atomic32 with stdatomic net/txgbe: replace rte_atomic32 with stdatomic net/vhost: use stdatomic instead of rte_atomic32 vdpa/ifc: replace rte_atomic32 with stdatomic test/atomic: suppress deprecation warnings for legacy APIs
eal: mark rte_atomicNN as deprecated

 app/test/test_atomic.c                        |  12 +
 devtools/checkpatches.sh                      |  16 -
 doc/guides/rel_notes/deprecation.rst          |  12 +-
 doc/guides/rel_notes/release_26_07.rst        |   4 +
 drivers/bus/dpaa/base/qbman/qman.c            |   9 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c      |  10 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c      |  10 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c      |  12 +-
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h       |   8 +-
 drivers/bus/fslmc/qbman/include/compat.h      |  21 +-
 drivers/bus/vmbus/private.h                   |   2 +-
 drivers/bus/vmbus/vmbus_bufring.c             |  39 ++-
 drivers/common/dpaax/compat.h                 |  21 +-
 drivers/crypto/ccp/ccp_crypto.c               |  11 +-
 drivers/crypto/ccp/ccp_crypto.h               |   2 +-
 drivers/crypto/ccp/ccp_dev.c                  |  10 +-
 drivers/crypto/ccp/ccp_dev.h                  |   4 +-
 drivers/event/dpaa2/dpaa2_eventdev_selftest.c |  26 +-
 drivers/event/dpaa2/dpaa2_hw_dpcon.c          |  11 +-
 drivers/event/octeontx/ssovf_evdev_selftest.c |  61 ++--
 drivers/event/sw/sw_evdev.c                   |   8 +-
 drivers/event/sw/sw_evdev.h                   |   4 +-
 drivers/event/sw/sw_evdev_worker.c            |  16 +-
 drivers/net/bnx2x/bnx2x.c                     |   6 +-
 drivers/net/bnx2x/bnx2x.h                     |   2 +-
 drivers/net/bnx2x/ecore_sp.c                  |   6 +-
 drivers/net/bonding/eth_bond_8023ad_private.h |   6 +-
 drivers/net/bonding/rte_eth_bond_8023ad.c     |  35 +-
 drivers/net/ena/base/ena_plat_dpdk.h          |  14 +-
 drivers/net/ena/ena_ethdev.c                  |  21 +-
 drivers/net/ena/ena_ethdev.h                  |   7 +-
 drivers/net/enic/enic.h                       |   6 +-
 drivers/net/enic/enic_compat.h                |   1 -
 drivers/net/enic/enic_main.c                  |  17 +-
 drivers/net/enic/enic_rxtx.c                  |  14 +-
 drivers/net/enic/enic_rxtx_vec_avx2.c         |   4 +-
 drivers/net/failsafe/failsafe_ops.c           |  12 +-
 drivers/net/failsafe/failsafe_private.h       |  29 +-
 drivers/net/failsafe/failsafe_rxtx.c          |   2 +-
 drivers/net/hinic/base/hinic_compat.h         |   2 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c      |  24 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.h      |   4 +-
 drivers/net/nbl/nbl_hw/nbl_resource.h         |   1 -
 drivers/net/netvsc/hn_rndis.c                 |  28 +-
 drivers/net/netvsc/hn_rxtx.c                  |  12 +-
 drivers/net/netvsc/hn_var.h                   |   6 +-
 drivers/net/pfe/pfe_ethdev.c                  |  32 +-
 drivers/net/sfc/sfc.c                         |   9 +-
 drivers/net/sfc/sfc.h                         |   4 +-
 drivers/net/sfc/sfc_port.c                    |   7 +-
 drivers/net/sfc/sfc_stats.h                   |   2 +-
 drivers/net/txgbe/base/txgbe_mng.c            |   4 +-
 drivers/net/txgbe/base/txgbe_type.h           |   2 +-
 drivers/net/vhost/rte_eth_vhost.c             | 103 +++---
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |  37 +--
 lib/bpf/bpf_exec.c                            |  13 +-
 lib/eal/arm/include/rte_atomic_32.h           |  10 -
 lib/eal/arm/include/rte_atomic_64.h           |  10 -
 lib/eal/include/generic/rte_atomic.h          | 306 +++++-------------
 lib/eal/include/rte_common.h                  |   2 +
 lib/eal/loongarch/include/rte_atomic.h        |  10 -
 lib/eal/ppc/include/rte_atomic.h              | 179 ----------
 lib/eal/riscv/include/rte_atomic.h            |  10 -
 lib/eal/x86/include/rte_atomic.h              | 205 +-----------
 lib/eal/x86/include/rte_atomic_32.h           | 188 -----------
 lib/eal/x86/include/rte_atomic_64.h           | 157 ---------
 lib/ring/meson.build                          |   2 +-
 lib/ring/rte_ring_c11_pvt.h                   |  75 ++---
 lib/ring/rte_ring_elem_pvt.h                  | 125 ++++++-
 ..._ring_generic_pvt.h => rte_ring_x86_pvt.h} |  61 +---
 lib/ring/soring.c                             |  15 +-
 71 files changed, 667 insertions(+), 1489 deletions(-)
 rename lib/ring/{rte_ring_generic_pvt.h => rte_ring_x86_pvt.h} (60%)
Signature · 1 line
2.53.0