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>,
	"Konstantin Ananyev" <konstantin.v.ananyev@yandex.ru>,
	"Wathsala Vithanage" <wathsala.vithanage@arm.com>
Cc: "Bruce Richardson" <bruce.richardson@intel.com>
Subject: RE: [PATCH v2 0/5] eal: RTE_PTR_ADD qualifiers and real unaligned types
Date: Sun, 6 Sep 2026 22:14:10 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65A36@smartserver.smartshare.dk> (raw)
In-Reply-To: <20260906171142.3503868-1-stephen@networkplumber.org>

+TO: RING maintainers
+CC: Bruce, you might be able to recall something

> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Sunday, 6 September 2026 19.10
> 
> This series started with Scott Mitchell's patch to preserve pointer
> qualifications across RTE_PTR_ADD and RTE_PTR_SUB. Reviewing it
> turned up two further problems.
> 
> The first is that unaligned_uintNN_t only had alignment 1 on armv8
> aarch32, the one target setting RTE_ARCH_STRICT_ALIGN. Everywhere
> else they were ordinary aligned types, so code using them to read
> or write at arbitrary offsets was still undefined behaviour and was
> reported by UBSAN. Giving them alignment 1 on all architectures
> fixes that, and once mlx5 no longer needs its strict alignment
> path, RTE_ARCH_STRICT_ALIGN has no users left and is removed.
> 
> The second is the jhash test, which declared its key as a byte
> array and cast it to unaligned_uint32_t * to pass to a function
> taking const uint32_t *. That is fixed first in the series so the
> alignment change does not introduce a new clang warning.
> 
> Only patch 1 should go to stable.
> 
> Note for reviewers: unaligned_uintNN_t is in an installed header,
> so applications embedding one of these types in a structure will
> see its layout change. That is called out in the release notes.
> 
> The types are also used in the hash key compare path
> (rte_cuckoo_hash.c, rte_cmp_generic.h) and for 8 byte ring elements
> (rte_ring_elem_pvt.h). Scalar code generation is unchanged on x86,
> but the compiler can no longer assume alignment when combining
> adjacent accesses, so hash and ring perf results would be welcome,
> particularly on arm.

Is there a real reason why rings support unaligned objects?
Or was the "unaligned" just slapped on due to some old habit, like packing structs?

If there's no good reason, let's converge towards normal alignment in the ring library.

-Morten


  parent reply	other threads:[~2026-09-06 20:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 22:09 [RFC 0/3] eal: make unaligned types really unaligned Stephen Hemminger
2026-09-04 22:09 ` [RFC 1/3] eal: make unaligned " Stephen Hemminger
2026-09-04 22:09 ` [RFC 2/3] net/mlx5: drop unnecessary STRICT_ALIGN Stephen Hemminger
2026-09-05 10:00   ` Morten Brørup
2026-09-04 22:09 ` [RFC 3/3] arm: remove no longer used RTE_ARCH_STRICT_ALIGN Stephen Hemminger
2026-09-06 17:09 ` [PATCH v2 0/5] eal: RTE_PTR_ADD qualifiers and real unaligned types Stephen Hemminger
2026-09-06 17:09   ` [PATCH v2 1/5] test: fix jhash 32 bit key type Stephen Hemminger
2026-09-06 17:09   ` [PATCH v2 2/5] eal: RTE_PTR_ADD/SUB API improvements Stephen Hemminger
2026-09-06 17:09   ` [PATCH v2 3/5] eal: make unaligned really unaligned Stephen Hemminger
2026-09-06 17:09   ` [PATCH v2 4/5] net/mlx5: drop unnecessary STRICT_ALIGN Stephen Hemminger
2026-09-06 17:09   ` [PATCH v2 5/5] arm: remove no longer used RTE_ARCH_STRICT_ALIGN Stephen Hemminger
2026-09-06 20:14   ` Morten Brørup [this message]
2026-09-07 18:31 ` [PATCH v3 0/5] eal: RTE_PTR_ADD and fix unaligned types Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 1/5] test: fix jhash 32 bit key type Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 2/5] eal: RTE_PTR_ADD/SUB API improvements Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 3/5] eal: make unaligned really unaligned Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 4/5] net/mlx5: drop unnecessary STRICT_ALIGN Stephen Hemminger
2026-09-07 18:31   ` [PATCH v3 5/5] arm: remove no longer used RTE_ARCH_STRICT_ALIGN Stephen Hemminger

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=98CBD80474FA8B44BF855DF32C47DC35F65A36@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=stephen@networkplumber.org \
    --cc=wathsala.vithanage@arm.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