DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Stephen Hemminger" <stephen@networkplumber.org>, <dev@dpdk.org>,
	"Scott Mitchell" <scott.k.mitch1@gmail.com>
Cc: "Ori Kam" <orika@nvidia.com>,
	"Aman Singh" <aman.deep.singh@intel.com>,
	"Nipun Gupta" <nipun.gupta@amd.com>,
	"Nikhil Agarwal" <nikhil.agarwal@amd.com>,
	"Chenbo Xia" <chenbox@nvidia.com>,
	"Long Li" <longli@microsoft.com>, "Wei Hu" <weh@microsoft.com>,
	"Nithin Dabilpuram" <ndabilpuram@marvell.com>,
	"Kiran Kumar K" <kirankumark@marvell.com>,
	"Sunil Kumar Kori" <skori@marvell.com>,
	"Satha Rao" <skoteshwar@marvell.com>,
	"Harman Kalra" <hkalra@marvell.com>,
	"Srikanth Yalavarthi" <syalavarthi@marvell.com>,
	"Dariusz Sosnowski" <dsosnowski@nvidia.com>,
	"Viacheslav Ovsiienko" <viacheslavo@nvidia.com>,
	"Bing Zhao" <bingz@nvidia.com>,
	"Suanming Mou" <suanmingm@nvidia.com>,
	"Matan Azrad" <matan@nvidia.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>,
	"Kevin Laatz" <kevin.laatz@intel.com>,
	"Gowrishankar Muthukrishnan" <gmuthukrishn@marvell.com>,
	"Vidya Sagar Velumuri" <vvelumuri@marvell.com>,
	"Pavan Nikhilesh" <pbhagavatula@marvell.com>,
	"Shijith Thotton" <sthotton@marvell.com>,
	"Artem V. Andreev" <artem.andreev@oktetlabs.ru>,
	"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
	"Potnuri Bharat Teja" <bharat@chelsio.com>,
	"Shai Brandes" <shaibran@amazon.com>,
	"Evgeny Schemeilin" <evgenys@amazon.com>,
	"Amit Bernstein" <amitbern@amazon.com>,
	"Wajeeh Atrash" <atrwajee@amazon.com>,
	"Anatoly Burakov" <anatoly.burakov@intel.com>,
	"Dmitry Kozlyuk" <dmitry.kozliuk@gmail.com>,
	"Jerin Jacob" <jerinj@marvell.com>,
	"Zhirun Yan" <yanzhirun_163@163.com>,
	"Reshma Pattan" <reshma.pattan@intel.com>,
	"Konstantin Ananyev" <konstantin.ananyev@huawei.com>,
	"Yipeng Wang" <yipeng1.wang@intel.com>,
	"Sameh Gobriel" <sameh.gobriel@intel.com>,
	"Anoob Joseph" <anoobj@marvell.com>,
	"Volodymyr Fialko" <vfialko@marvell.com>,
	"Maxime Coquelin" <maxime.coquelin@redhat.com>
Subject: RE: [PATCH v25] eal: RTE_PTR_ADD/SUB API improvements
Date: Fri, 4 Sep 2026 09:29:11 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65A2E@smartserver.smartshare.dk> (raw)
In-Reply-To: <20260903231201.871509-1-stephen@networkplumber.org>

> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Friday, 4 September 2026 01.05
> 
> From: Scott Mitchell <scott.k.mitch1@gmail.com>
> 
> RTE_PTR_ADD and RTE_PTR_SUB APIs have a few limitations:
> 1. ptr cast to uintptr_t drops pointer provenance and
> prevents compiler optimizations
> 2. return cast discards qualifiers (const, volatile)
> which may hide correctness/concurrency issues.
> 3. Accepts both "pointers" and "integers as pointers" which
> overloads the use case and constrains the implementation
> to address other challenges.
> 
> This patch deprecates support for integer types which allows
> addressing each of the challenges above.
> 
> Examples:
> 1. Clang is able to optimize and improve __rte_raw_cksum
> (which uses RTE_PTR_ADD) by ~40% (100 bytes) to ~8x (1.5k bytes)
> TSC cycles/byte.
> 2. Refactoring discovered cases that dropped qualifiers (volatile)
> that the new API exposes.
> 
> Signed-off-by: Scott Mitchell <scott.k.mitch1@gmail.com>
> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> Changes from the original v24 submission (rebased to 26.11):
> 
> * Rebased on main: release notes moved to release_26_11.rst,
> and roc_cpt_debug.c updated for the cpt_cn10k_frag_info_s rename.
> 
> * Release notes: state that RTE_PTR_ADD/SUB reject integer arguments
> while RTE_PTR_ALIGN* still compile with them as deprecated usage.
> There are still some in-tree uses of integer arguments in mlx5.
> 
> * test_common.c: aligned uint16/32/64 dereference tests now also
> require increment to be a multiple of the type size, avoiding
> misaligned typed access.
> 
> * ena: BAR NULL check logs at DEBUG rather than ERR since the memory
> BAR is legitimately absent on non-LLQ devices.
> 
> * idxd: drop RTE_PTR_UNQUAL and FIXME on portal assignment, and the
> redundant (volatile void *) casts, since the fields are already
> volatile-qualified upstream.
> 
> * eal_common_memory.c: drop unrelated volatile qualifier on local elem
> pointer.
> * eal_common_fbarray.c: drop unused rte_debug.h include.
> * eal_memalloc.c (linux, windows): move base_va NULL check before
>   the allocation loop and return -1 instead of goto out.
> 
> * rte_mbuf.h, rte_mempool.h: drop __rte_assume() on pointers that
> are dereferenced immediately after; compiler already infers that
> form the immediate dereference.  keep RTE_ASSERT.
> 

That's a lot of code.
Thank you for working on this, Scott and Stephen.
Stronger typing is a valuable improvement.

I have reviewed selectively, so it's not a full review, but a big ack.

Acked-by: Morten Brørup <mb@smartsharesystems.com>


  reply	other threads:[~2026-09-04  7:29 UTC|newest]

Thread overview: 63+ 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                     ` [PATCH v17 0/2] " scott.k.mitch1
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-04-28 10:04                                     ` Morten Brørup
2026-09-03 23:05                                     ` [PATCH v25] " Stephen Hemminger
2026-09-04  7:29                                       ` Morten Brørup [this message]
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=98CBD80474FA8B44BF855DF32C47DC35F65A2E@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=aman.deep.singh@intel.com \
    --cc=amitbern@amazon.com \
    --cc=anatoly.burakov@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=anoobj@marvell.com \
    --cc=artem.andreev@oktetlabs.ru \
    --cc=atrwajee@amazon.com \
    --cc=bharat@chelsio.com \
    --cc=bingz@nvidia.com \
    --cc=bruce.richardson@intel.com \
    --cc=chenbox@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=dsosnowski@nvidia.com \
    --cc=evgenys@amazon.com \
    --cc=gmuthukrishn@marvell.com \
    --cc=hkalra@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kevin.laatz@intel.com \
    --cc=kirankumark@marvell.com \
    --cc=konstantin.ananyev@huawei.com \
    --cc=longli@microsoft.com \
    --cc=matan@nvidia.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=ndabilpuram@marvell.com \
    --cc=nikhil.agarwal@amd.com \
    --cc=nipun.gupta@amd.com \
    --cc=orika@nvidia.com \
    --cc=pbhagavatula@marvell.com \
    --cc=reshma.pattan@intel.com \
    --cc=sameh.gobriel@intel.com \
    --cc=scott.k.mitch1@gmail.com \
    --cc=shaibran@amazon.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=stephen@networkplumber.org \
    --cc=sthotton@marvell.com \
    --cc=suanmingm@nvidia.com \
    --cc=syalavarthi@marvell.com \
    --cc=vfialko@marvell.com \
    --cc=viacheslavo@nvidia.com \
    --cc=vvelumuri@marvell.com \
    --cc=weh@microsoft.com \
    --cc=yanzhirun_163@163.com \
    --cc=yipeng1.wang@intel.com \
    /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