From: scott.k.mitch1@gmail.com
To: dev@dpdk.org
Cc: mb@smartsharesystems.com, stephen@networkplumber.org,
bruce.richardson@intel.com, Scott <scott.k.mitch1@gmail.com>
Subject: [PATCH v17 0/2] eal: RTE_PTR_ADD/SUB API improvements
Date: Sun, 1 Feb 2026 21:24:40 -0800 [thread overview]
Message-ID: <20260202052442.92192-1-scott.k.mitch1@gmail.com> (raw)
In-Reply-To: <20260127052900.68045-1-scott.k.mitch1@gmail.com>
From: Scott <scott.k.mitch1@gmail.com>
This series addresses two issues:
1. Removes the semantically incorrect __rte_alloc_size attribute from
rte_lcore_var_alloc which was causing FORTIFY_SOURCE failures on
Ubuntu 24.04 CI. The attribute was incorrect because the function
returns a handle to per-lcore variables, not a direct pointer to
'size' bytes.
2. Improves RTE_PTR_ADD/SUB macros to preserve pointer type qualifiers
(const/volatile) and use pointer arithmetic instead of integer casts
to enable compiler optimizations and maintain pointer provenance.
The bugfix (patch 1) is placed first so it can be backported independently
to stable branches.
---
v17:
- Improved release notes to explicitly list macro names for search/indexing
- eal_common_fbarray.c RTE_ASSERT to runtime NULL check
v16:
- Fixed test_common.c: parenthesize PTR_DIFF in RTE_INT_PTR tests
v15:
- Fixed __rte_alloc_size, spilt into 2 patch series
- Replaced RTE_INT_PTR_ADD/SUB with simpler RTE_INT_PTR(val) macro
users do int arithmetic directly: RTE_INT_PTR(addr + offset)
v14:
- fixed cpp compiler error, avoiding array pointer decay
which is implicitly done in cpp (but not c)
- fixed MALLOC_ELEM_TRAILER const preservation compile error
v13:
- Added release notes documenting API changes
- Fixed alignment in test file: use alignas(uint32_t) for buffer
- Fixed NULL pointer handling in cdx_vfio.c: check base_va before RTE_PTR_ADD
- Added GCC array-bounds diagnostic suppression in malloc_elem_from_data()
- Added bug tracker reference for volatile cast issue in idxd_pci.c
- Improved __rte_auto_type documentation: added C++11 and C23 support
- Moved doxygen rationale for void* return type to @return blocks
- Fixed MALLOC_ELEM_TRAILER to use RTE_PTR_UNQUAL for write operations
v12:
- void* return type to avoid optimizations assuming
aligned access which isn't generally safe/true.
v11:
- Split API into PTR and INT_PTR variants, update all usage
of PTR API for new APIs.
v10:
- Use unit_test_suite_runner for easier subtest failure identification
v9:
- Fix include order: system includes, then DPDK includes, then application includes
- Use NOHUGE_OK and ASAN_OK constants in REGISTER_FAST_TEST (instead of true, true)
v8:
- Remove tests for types < 32-bit (bool, char, short, uint8_t, uint16_t)
- Merge test_ptr_add_sub_typedefs() into test_ptr_add_sub_integer_types()
- Separate RTE_PTR_ADD and RTE_PTR_SUB documentation
- Move Clang/GCC implementation note from Doxygen to regular comment
- Tests verify both intermediate ADD result and SUB round-trip
- Use uintptr_t cast consistently for all integer-to-pointer conversions
- Make TEST_RETVAL calculated from TEST_INITVAL + TEST_INCREMENT
v7:
- Fix tests: use TEST_BUFFER_SIZE macro for buffer allocation
- Fix tests: ADD then SUB same amount to avoid out-of-bounds pointer arithmetic
- All RTE_PTR_SUB tests now verify round-trip (ADD+SUB returns to original)
v6:
- Make char* optimization Clang-only to avoid GCC false positive warnings
- Improve tests: use named constants instead of magic numbers
- Improve tests: use void* casts on expected values instead of uintptr_t on results
v5:
- Initial implementation with char* arithmetic for all compilers
v4:
- Used _Generic for type-based dispatch with char* casts
- Had warnings on both Clang and GCC due to _Generic type-checking all branches
Scott Mitchell (2):
eal: remove alloc_size from rte_lcore_var_alloc
eal: RTE_PTR_ADD/SUB API improvements
app/test-pmd/cmdline_flow.c | 4 +-
app/test/meson.build | 1 +
app/test/test_common.c | 20 +-
app/test/test_ptr_add_sub.c | 199 +++++++++++++++++
doc/guides/rel_notes/release_26_03.rst | 14 ++
drivers/bus/cdx/cdx_vfio.c | 13 +-
drivers/bus/pci/linux/pci.c | 6 +-
drivers/bus/vmbus/linux/vmbus_uio.c | 6 +-
drivers/common/cnxk/roc_cpt_debug.c | 4 +-
drivers/common/cnxk/roc_ml.c | 4 +-
drivers/common/cnxk/roc_nix_bpf.c | 2 +-
drivers/common/cnxk/roc_nix_inl.h | 4 +-
drivers/common/cnxk/roc_nix_inl_dp.h | 8 +-
drivers/common/cnxk/roc_platform.h | 2 +
drivers/common/mlx5/mlx5_common_mr.c | 2 +-
drivers/dma/idxd/idxd_pci.c | 11 +-
drivers/dma/odm/odm_dmadev.c | 4 +-
drivers/event/cnxk/cn10k_worker.c | 32 +--
drivers/event/cnxk/cn20k_worker.c | 32 +--
drivers/mempool/bucket/rte_mempool_bucket.c | 7 +-
drivers/mempool/dpaa/dpaa_mempool.c | 2 +-
drivers/net/cxgbe/sge.c | 4 +-
drivers/net/ena/ena_ethdev.c | 9 +-
drivers/net/intel/fm10k/fm10k.h | 6 +-
drivers/net/intel/fm10k/fm10k_rxtx_vec.c | 12 +-
drivers/net/mlx4/mlx4_txq.c | 3 +-
lib/eal/common/eal_common_fbarray.c | 3 +-
lib/eal/common/eal_common_memory.c | 32 ++-
lib/eal/common/eal_common_options.c | 2 +-
lib/eal/common/malloc_elem.h | 34 ++-
lib/eal/freebsd/eal_memory.c | 4 +
lib/eal/include/rte_common.h | 231 ++++++++++++++++++--
lib/eal/include/rte_lcore_var.h | 2 +-
lib/eal/linux/eal_memalloc.c | 6 +
lib/eal/linux/eal_memory.c | 7 +
lib/eal/windows/eal_memalloc.c | 6 +
lib/graph/rte_graph.h | 4 +-
lib/latencystats/rte_latencystats.c | 3 +
lib/mbuf/rte_mbuf.c | 1 +
lib/mbuf/rte_mbuf.h | 2 +
lib/member/rte_xxh64_avx512.h | 6 +-
lib/mempool/rte_mempool.c | 8 +-
lib/mempool/rte_mempool.h | 3 +
lib/mempool/rte_mempool_ops_default.c | 2 +-
lib/pdcp/pdcp_entity.h | 8 +-
lib/vhost/vhost_user.c | 13 +-
46 files changed, 652 insertions(+), 136 deletions(-)
create mode 100644 app/test/test_ptr_add_sub.c
--
2.39.5 (Apple Git-154)
next prev parent reply other threads:[~2026-02-02 5:24 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 16:07 [PATCH v6] eal: RTE_PTR_ADD/SUB char* for compiler optimizations scott.k.mitch1
2026-01-14 21:56 ` [PATCH v7] " scott.k.mitch1
2026-01-16 11:39 ` Morten Brørup
2026-01-16 22:38 ` Scott Mitchell
2026-01-16 23:19 ` [PATCH v8] " scott.k.mitch1
2026-01-17 2:44 ` Stephen Hemminger
2026-01-17 21:07 ` Scott Mitchell
2026-01-17 21:03 ` [PATCH v9] " scott.k.mitch1
2026-01-18 6:12 ` Stephen Hemminger
2026-01-23 16:20 ` Scott Mitchell
2026-01-20 12:59 ` Morten Brørup
2026-01-23 16:27 ` [PATCH v10] " scott.k.mitch1
2026-01-24 7:58 ` Morten Brørup
2026-01-24 8:59 ` Scott Mitchell
2026-01-24 22:59 ` Scott Mitchell
2026-01-24 9:11 ` [PATCH v11] eal: RTE_PTR_ADD/SUB API improvements scott.k.mitch1
2026-01-25 11:11 ` scott.k.mitch1
2026-01-25 11:12 ` [PATCH v12] " scott.k.mitch1
2026-01-25 19:36 ` [REVIEW] " Stephen Hemminger
2026-01-25 22:24 ` Scott Mitchell
2026-01-26 8:19 ` Morten Brørup
2026-01-25 22:30 ` [PATCH v13] " scott.k.mitch1
2026-01-26 8:03 ` [PATCH v14] " scott.k.mitch1
2026-01-26 14:35 ` Morten Brørup
2026-01-26 21:29 ` Scott Mitchell
2026-01-27 5:11 ` Scott Mitchell
2026-01-27 2:02 ` [PATCH v15 0/2] " scott.k.mitch1
2026-01-27 2:02 ` [PATCH v15 1/2] eal: remove alloc_size from rte_lcore_var_alloc scott.k.mitch1
2026-01-27 2:02 ` [PATCH v15 2/2] eal: RTE_PTR_ADD/SUB API improvements scott.k.mitch1
2026-01-27 5:28 ` [PATCH v16 0/2] " scott.k.mitch1
2026-01-27 5:28 ` [PATCH v16 1/2] eal: remove alloc_size from rte_lcore_var_alloc scott.k.mitch1
2026-01-27 11:16 ` Mattias Rönnblom
2026-01-27 14:07 ` Stephen Hemminger
2026-01-27 5:29 ` [PATCH v16 2/2] eal: RTE_PTR_ADD/SUB API improvements scott.k.mitch1
2026-02-02 5:24 ` scott.k.mitch1 [this message]
2026-02-02 5:24 ` [PATCH v17 1/2] eal: remove alloc_size from rte_lcore_var_alloc scott.k.mitch1
2026-02-03 8:24 ` Morten Brørup
2026-02-03 9:48 ` David Marchand
2026-02-02 5:24 ` [PATCH v17 2/2] eal: RTE_PTR_ADD/SUB API improvements scott.k.mitch1
2026-02-03 9:08 ` Morten Brørup
2026-02-03 16:24 ` Scott Mitchell
2026-02-03 9:51 ` David Marchand
2026-02-03 16:25 ` Scott Mitchell
2026-02-03 21:18 ` [PATCH v18 0/2] " scott.k.mitch1
2026-02-03 21:18 ` [PATCH v18 1/2] eal: remove alloc_size from rte_lcore_var_alloc scott.k.mitch1
2026-02-03 21:18 ` [PATCH v18 2/2] eal: RTE_PTR_ADD/SUB API improvements scott.k.mitch1
2026-02-04 2:46 ` [PATCH v19] " scott.k.mitch1
2026-02-04 5:20 ` Scott Mitchell
2026-02-04 6:12 ` [PATCH v20] " scott.k.mitch1
2026-02-04 22:47 ` Morten Brørup
2026-02-05 6:53 ` Scott Mitchell
2026-02-05 7:03 ` [PATCH v21] " scott.k.mitch1
2026-02-05 7:50 ` Morten Brørup
2026-02-06 1:04 ` Scott Mitchell
2026-02-06 1:01 ` [PATCH v22] " scott.k.mitch1
2026-02-06 4:28 ` [PATCH v23] " scott.k.mitch1
2026-02-06 16:09 ` Stephen Hemminger
2026-02-07 1:45 ` [PATCH v24] " scott.k.mitch1
2026-01-27 20:28 ` [REVIEW] " Stephen Hemminger
2026-02-02 5:17 ` Scott Mitchell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260202052442.92192-1-scott.k.mitch1@gmail.com \
--to=scott.k.mitch1@gmail.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox