From: Stephen Hemminger <stephen@networkplumber.org>
To: scott.k.mitch1@gmail.com
Cc: dev@dpdk.org, mb@smartsharesystems.com, bruce.richardson@intel.com
Subject: Re: [PATCH v8] eal: RTE_PTR_ADD/SUB char* for compiler optimizations
Date: Fri, 16 Jan 2026 18:44:28 -0800 [thread overview]
Message-ID: <20260116184428.49e45dd4@phoenix.local> (raw)
In-Reply-To: <20260116231907.13895-1-scott.k.mitch1@gmail.com>
On Fri, 16 Jan 2026 15:19:07 -0800
scott.k.mitch1@gmail.com wrote:
> From: Scott Mitchell <scott.k.mitch1@gmail.com>
>
> Modify RTE_PTR_ADD and RTE_PTR_SUB to use char* pointer arithmetic
> on Clang instead of uintptr_t casts. Benefits of this approach:
> - API compatibility: works for both integer and pointer inputs
> - Retains simple macros: no pragmas, no _Generic
> - Enables Clang optimizations: Clang can now unroll and vectorize
> pointer loops. GCC uses uintptr_t to avoid false positive warnings.
>
> Example use case which benefits is __rte_raw_cksum. Performance
> results from cksum_perf_autotest on Intel Xeon (Cascade Lake,
> AVX-512) built with Clang 18.1 (TSC cycles/byte):
> Block size Before After Improvement
> 100 0.40 0.24 ~40%
> 1500 0.50 0.06 ~8x
> 9000 0.49 0.06 ~8x
>
> Signed-off-by: Scott Mitchell <scott.k.mitch1@gmail.com>
>
> ---
Looks good to me and not too complex.
AI code review had some additional comments.
## Patch Review: eal: RTE_PTR_ADD/SUB char* for compiler optimizations (v8)
### ✅ PASS Items
**Commit Message - Subject Line:**
- Length: ~52 characters (✓ under 60 limit)
- Prefix: `eal:` is correct for EAL changes
- No trailing period
- Imperative mood
**Commit Message - Body:**
- Well-documented rationale with clear performance data
- Does NOT start with "It" ✓
- Performance table shows concrete improvements (~40% to ~8x)
- Line wrapping appears within 75-character limit
**Tags:**
- `Signed-off-by:` present with real name and valid email ✓
- Tag order is correct
**SPDX/License (new file `test_ptr_add_sub.c`):**
- SPDX identifier on first line ✓
- Copyright follows SPDX ✓
- Blank line after copyright ✓
- BSD-3-Clause appropriate for `app/test` ✓
**Tests:**
- Comprehensive test coverage for integer and pointer types ✓
- Uses `TEST_ASSERT_EQUAL` macros ✓
- Uses `REGISTER_FAST_TEST` infrastructure ✓
- Tests both ADD and SUB with round-trip verification ✓
- Named constants (`TEST_INITVAL`, `TEST_INCREMENT`) instead of magic numbers ✓
**Code Quality:**
- Macro implementation is well-documented with explanatory comment
- Conditional compilation (`#ifdef RTE_CC_CLANG`) is clean
- No forbidden terminology
---
### ⚠️ WARNING Items
**1. Include Order (test_ptr_add_sub.c lines 161-164):**
```c
#include "test.h"
#include <stdint.h>
#include <rte_common.h>
```
Per AGENTS.md, order should be: (1) system includes, (2) EAL includes, (3) misc DPDK includes, (4) application-specific. Should be:
```c
#include <stdint.h>
#include <rte_common.h>
#include "test.h"
```
**2. Subject Line Contains Underscores:**
The subject `eal: RTE_PTR_ADD/SUB char* for compiler optimizations` includes underscores (code identifiers after the colon). Per AGENTS.md: "Underscores after the colon (indicates code in subject)" is flagged. Consider:
```
eal: use char pointer arithmetic for Clang optimizations
```
**3. Missing Release Notes:**
This is a notable performance optimization (~8x improvement in some cases). Per AGENTS.md, "significant changes" should update release notes in `doc/guides/rel_notes/`. Consider adding a note about the checksum performance improvement.
**4. Doxygen Documentation:**
The existing Doxygen comments for `RTE_PTR_ADD` and `RTE_PTR_SUB` remain minimal:
```c
/**
* add a byte-value offset to a pointer
*/
```
Consider adding `@param` and `@return` documentation, especially noting that `ptr` can be either a pointer or integer type.
---
### ℹ️ INFO Items (Minor Suggestions)
**1. Variable Declaration Style:**
In `test_ptr_add_sub_integer_types()`, variables are declared at point-of-use (C99 style), which is acceptable per AGENTS.md. However, `void *result` is declared at function start while type-specific variables are inline—this mixing is fine but slightly inconsistent.
**2. Test Structure:**
The tests don't use `unit_test_suite_runner` infrastructure (they use direct function calls in `test_ptr_add_sub()`). While functional, AGENTS.md suggests using `unit_test_suite_runner` for "proper integration with the DPDK test framework." This is optional since `REGISTER_FAST_TEST` is used correctly.
**3. Comment Placement:**
The implementation comment explaining Clang vs GCC behavior is placed between the Doxygen comment and the macro. This works, but having implementation notes inside a `/* ... */` block separate from Doxygen is good practice (which this patch does correctly).
---
### Summary
| Category | Status |
|----------|--------|
| Commit message format | ✅ Pass (minor subject line concern) |
| SPDX/License | ✅ Pass |
| Code style | ⚠️ Include order should be fixed |
| Tests | ✅ Pass - comprehensive |
| Documentation | ⚠️ Consider release notes |
| Compilation | Should verify independently |
**Overall Assessment:** This is a well-crafted v8 patch with solid test coverage and clear performance benefits. The main actionable items are fixing the include order and considering release notes for this optimization. The subject line concern about underscores is minor since `RTE_PTR_ADD/SUB` are canonical macro names in DPDK.
next prev parent reply other threads:[~2026-01-17 2:44 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 [this message]
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-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=20260116184428.49e45dd4@phoenix.local \
--to=stephen@networkplumber.org \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=scott.k.mitch1@gmail.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