On Fri, Jan 9, 2026 at 4:08 AM Morten Brørup <[email protected]> wrote:
>
> +Aaron, please read up on this discussion, and step in if you can help.
>
> (Aaron is the DPDK Project testing leader, and works at Red Hat.)
>
> > From: Scott Mitchell [mailto:[email protected]]
> > Sent: Friday, 9 January 2026 05.58
> >
> > On Thu, Jan 8, 2026 at 7:01 PM Stephen Hemminger
> > <[email protected]> wrote:
> > >
> > > On Thu, 8 Jan 2026 16:19:37 -0500
> > > Scott Mitchell <[email protected]> wrote:
> > >
> > > > On Thu, Jan 8, 2026 at 11:12 AM Stephen Hemminger
> > > > <[email protected]> wrote:
> > > > >
> > > > > On Thu,  8 Jan 2026 01:13:38 -0500
> > > > > [email protected] wrote:
> > > > >
> > > > > > +#ifdef RTE_CC_GCC
> > > > > > +     /* Suppress GCC -Wmaybe-uninitialized false positive. No
> > assembly/runtime impacts. */
> > > > > > +     asm volatile("" : "+m" (psd_hdr));
> > > > > > +#endif
> > > > > >
> > > > >
> > > > > Maybe rte_compiler_barrier() will do same thing?
> > > >
> > > > Agreed it feels like a compiler bug but looking for advice if I'm
> > > > missing something :)
> > > >
> > > > My initial concern with rte_compiler_barrier is its a general
> > barrier
> > > > which may have broader impacts on
> > > > optimizations and compiled code. Will that be an issue in this
> > case? I
> > > > wasn't sure and the approach
> > > > in the patch is targeted at a specific variable and assembly from
> > > > clang/gcc was the same. I will
> > > > introduce a macro to make it cleaner and I can replace it with
> > > > rte_compiler_barrier if preferred.
> > >
> > > Maybe try with -fanalyzer and it might tell you more.
> > > I suspect some of the aliasing setting are causing issues.
> > > Some drivers are turning on no-strict-aliasing
> >
> > I have more evidence this is a GCC optimizer bug.
> > The RTE_SUPPRESS_UNINITIALIZED_WARNING approach serves
> > as a workaround to avoid the bug. I created a more minimal reproducer:
> > https://gist.github.com/Scottmitch/bf23748b4588e68c9bdb8d124f92f1bd
> >
> > Your suspicion was correct, -fno-strict-aliasing avoids the bug but I
> > don't
> > think it is desirable to enable this broadly for DPDK when we have a
> > more targeted workaround.
> >
> > I will reach out to RH to confirm but in the interim I suggest we keep
> > RTE_SUPPRESS_UNINITIALIZED_WARNING (or similar alternative).
>
> If this is a GCC compiler bug limited to the GCC version offered by RHEL 11, 
> I prefer splitting the patch into a series with the following steps:
> Patch 1/2: Add the optimization and new test cases in their minimal form, 
> designed to work on normal compilers. Disregard bugs/warnings from the weird 
> RHEL 11 compiler.
> I.e. don't modify lib/eal/include/rte_common.h, lib/net/rte_ip6.h, 
> lib/net/rte_ip4.h, drivers/net/hinic/hinic_pmd_tx.c, 
> drivers/net/mlx5/mlx5_flow_dv.c.
> Patch 2/2: Add the workarounds required by the RHEL 11 compiler.
>
> Also, the change to drivers/net/hinic/hinic_pmd_tx.c should be moved to a 
> patch independent of this series.
> It's not directly related to this series, so let's not add more to the 
> discussion than we need to. ;-)
> And the implementation in the driver only considers RTE_MBUF_F_TX_TCP_SEG, 
> whereas the DPDK function also considers RTE_MBUF_F_TX_UDP_SEG, so it 
> warrants a separate discussion; it possibly fixes a bug.
>
> Maybe even move the RHEL 11 related patches (my suggested patch 2/2) into a 
> separate series, for the same conceptual reasons as moving the HINIC driver 
> patch into a separate series.
> You can use the Depends-On tag 
> (https://doc.dpdk.org/guides/contributing/patches.html#patch-dependencies) 
> for the follow-on changes to __rte_raw_cksum().
>

General strategy makes sense!

The GCC bug showed up on dpdk CI on non-RH platforms too
https://github.com/ovsrobot/dpdk/actions/runs/20744990187/job/59560072349.

There is also a ubsan warning flagged while running the new fuzz test
(https://github.com/ovsrobot/dpdk/actions/runs/20821548318/job/59811205423).
Seems like a false positive and I added __rte_no_ubsan_alignment to
get a clean build.

I'll restructure the changes following this approach:
Series: "net: optimize raw checksum computation" (3 patches)
1/3: net: optimize __rte_raw_cksum and add tests
2/3: add workaround for UBSAN alignment false positive
3/3: add workaround for GCC optimization bug

I'll defer the hinic refactoring (switching to common checksum functions) to
a separate follow-up series as suggested, since it's independent of the core

Reply via email to