DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
	"Anatoly Burakov" <anatoly.burakov@intel.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>,
	"David Christensen" <drc@linux.vnet.ibm.com>,
	"Harry van Haaren" <harry.van.haaren@intel.com>,
	"Konstantin Ananyev" <konstantin.v.ananyev@yandex.ru>,
	"Min Zhou" <zhoumin@loongson.cn>,
	"Ruifeng Wang" <ruifeng.wang@arm.com>,
	"Stanislaw Kardach" <kda@semihalf.com>,
	thomas@monjalon.net
Subject: Re: [PATCH] RFC: use C11 alignas instead of GCC attribute aligned
Date: Thu, 25 Jan 2024 10:37:13 -0800	[thread overview]
Message-ID: <20240125183713.GA27715@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> (raw)
In-Reply-To: <1700069997-4399-1-git-send-email-roretzla@linux.microsoft.com>

ping.

Please review this thread if you have time, the main point of discussion
I would like to receive consensus on the following questions.

1. Should we continue to expand common alignments behind an __rte_macro

  i.e. what do we prefer to appear in code

  alignas(RTE_CACHE_LINE_MIN_SIZE)

  -- or --

  __rte_cache_aligned

One of the benefits of dropping the macro is it provides a clear visual
indicator that it is not placed in the same location or get applied
to types as is done with __attribute__((__aligned__(n))).

2. where should we place alignas(n) or __rte_macro (if we use a macro)

Should it be on the same line as the variable or field or on the
preceeding line?

  /* same line example struct */
  struct T {
      /* alignas(64) applies to field0 *not* struct T type declaration */
      alignas(64) void *field0;
      void *field1;

      ... other fields ...

      alignas(64) uint64_t field5;
      uint32_t field6;

      ... more fields ...

  };

  /* same line example array */
  alignas(64) static const uint32_t array[4] = { ... };

  -- or --

  /* preceeding line example struct */
  struct T {
      /* alignas(64) applies to field0 *not* struct T type declaration */
      alignas(64)
      void *field0;
      void *field1;

      ... other fields ...

      alignas(64)
      uint64_t field5;
      uint32_t field6;

      ... more fields ...

  };

  /* preceeding line example array */
  alignas(64)
  static const uint32_t array[4] = { ... };


I'll submit patches for lib/* once the discussion is concluded.

thanks folks

On Wed, Nov 15, 2023 at 09:39:56AM -0800, Tyler Retzlaff wrote:
> Now that we require a C11 conformant toolchain we are able to improve
> portability by further adoption of C11 features.
> 
> Adapt EAL to use C11 alignas replacing __rte_cache_aligned and
> __rte_aligned(a) that expand to __attribute__((__aligned__(a))).
> 
> Note: it appears that use of alignas has exposed a bug in
>       lib/eal/riscv/include/rte_vect.h where the alignment
>       specified was reduced to 8 for xmm_t.
> 
> Please comment, subject to the outcome I will submit further series for
> lib/*
> 
> Thanks
> 
> Tyler Retzlaff (1):
>   eal: use C11 alignas instead of GCC attribute aligned
> 
>  lib/eal/arm/include/rte_vect.h       | 4 +++-
>  lib/eal/common/malloc_elem.h         | 4 +++-
>  lib/eal/common/malloc_heap.h         | 4 +++-
>  lib/eal/common/rte_keepalive.c       | 4 +++-
>  lib/eal/common/rte_random.c          | 5 ++++-
>  lib/eal/common/rte_service.c         | 7 +++++--
>  lib/eal/include/generic/rte_atomic.h | 4 +++-
>  lib/eal/loongarch/include/rte_vect.h | 7 +++++--
>  lib/eal/ppc/include/rte_vect.h       | 5 ++++-
>  lib/eal/riscv/include/rte_vect.h     | 4 +++-
>  lib/eal/x86/include/rte_vect.h       | 4 +++-
>  lib/eal/x86/rte_power_intrinsics.c   | 8 ++++++--
>  12 files changed, 45 insertions(+), 15 deletions(-)
> 
> -- 
> 1.8.3.1

  parent reply	other threads:[~2024-01-25 18:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 17:39 Tyler Retzlaff
2023-11-15 17:39 ` [PATCH] eal: " Tyler Retzlaff
2023-11-15 18:13   ` Bruce Richardson
2023-11-15 18:27     ` Tyler Retzlaff
2023-11-15 20:08   ` Morten Brørup
2023-11-15 21:03     ` Tyler Retzlaff
2023-11-15 22:43       ` Stanisław Kardach
2023-11-16 10:12   ` Mattias Rönnblom
2024-01-25 18:37 ` Tyler Retzlaff [this message]
2024-01-25 22:53   ` [PATCH] RFC: " Morten Brørup
2024-01-25 23:31     ` Tyler Retzlaff
2024-01-26 10:05     ` Mattias Rönnblom
2024-01-26 10:18       ` Morten Brørup
2024-01-27 19:15         ` Mattias Rönnblom
2024-01-28  8:57           ` Morten Brørup
2024-01-28 10:00             ` Mattias Rönnblom
2024-01-29 19:43               ` Tyler Retzlaff
2024-01-30  8:08                 ` Mattias Rönnblom
2024-01-30 17:39                   ` Tyler Retzlaff
2024-01-30 17:59                     ` Bruce Richardson
2024-01-30 18:01                       ` Bruce Richardson
2024-01-30 18:04                       ` Tyler Retzlaff
2024-01-30 18:18                       ` Mattias Rönnblom
2024-01-31 16:04                     ` Mattias Rönnblom
2024-01-30  8:09                 ` Morten Brørup
2024-01-30  9:28                   ` Mattias Rönnblom
2024-01-30 10:17                     ` Morten Brørup
2024-01-30 13:00                       ` Morten Brørup
2024-01-30 17:54                   ` Tyler Retzlaff

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=20240125183713.GA27715@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net \
    --to=roretzla@linux.microsoft.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.vnet.ibm.com \
    --cc=harry.van.haaren@intel.com \
    --cc=kda@semihalf.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=ruifeng.wang@arm.com \
    --cc=thomas@monjalon.net \
    --cc=zhoumin@loongson.cn \
    /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;
as well as URLs for NNTP newsgroup(s).