From: Bruce Richardson <bruce.richardson@intel.com>
To: Tyler Retzlaff <roretzla@linux.microsoft.com>
Cc: dev@dpdk.org, "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
"Anatoly Burakov" <anatoly.burakov@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>
Subject: Re: [PATCH] eal: use C11 alignas instead of GCC attribute aligned
Date: Wed, 15 Nov 2023 18:13:55 +0000 [thread overview]
Message-ID: <ZVUKYxI9egswsNBO@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <1700069997-4399-2-git-send-email-roretzla@linux.microsoft.com>
On Wed, Nov 15, 2023 at 09:39:57AM -0800, Tyler Retzlaff wrote:
> Now that we have enabled C11 replace the use of __rte_cache_aligned
> and __rte_aligned(n) with alignas(RTE_CACHE_LINE_SIZE) and
> __rte_aligned(n) respectively.
alignas(n)
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
> 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(-)
>
> diff --git a/lib/eal/arm/include/rte_vect.h b/lib/eal/arm/include/rte_vect.h
> index 8cfe4bd..c7a3b2e 100644
> --- a/lib/eal/arm/include/rte_vect.h
> +++ b/lib/eal/arm/include/rte_vect.h
> @@ -5,6 +5,7 @@
> #ifndef _RTE_VECT_ARM_H_
> #define _RTE_VECT_ARM_H_
>
> +#include <stdalign.h>
> #include <stdint.h>
> #include "generic/rte_vect.h"
> #include "rte_debug.h"
> @@ -25,13 +26,14 @@
> #define XMM_MASK (XMM_SIZE - 1)
>
> typedef union rte_xmm {
> + alignas(16)
> xmm_t x;
> uint8_t u8[XMM_SIZE / sizeof(uint8_t)];
This may seem minor but I really don't like the indentation style used for
these alignas statements. To a casual glance they look like elements in the
struct. The previous macros were nice is that it was hard to mistake them
for anything other than additional info on the struct.
Couple of suggestions:
1. Put them on the same line as the definition of the first element. The
downside is that we lose the (as here) implication that it's the struct
being aligned more than just the first element.
2. Alternatively, how about putting the alignas on the same line as the
struct/union e.g.
struct rte_xyz { alignas(16)
...
}
In this case, or perhaps generally, perhaps we want to define
rte_aliases with underscores for these alignas to further visually separate
them.
Thoughts?
/Bruce
next prev parent reply other threads:[~2023-11-15 18:14 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-15 17:39 [PATCH] RFC: " Tyler Retzlaff
2023-11-15 17:39 ` [PATCH] eal: " Tyler Retzlaff
2023-11-15 18:13 ` Bruce Richardson [this message]
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 ` [PATCH] RFC: " Tyler Retzlaff
2024-01-25 22:53 ` 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=ZVUKYxI9egswsNBO@bricha3-MOBL.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=anatoly.burakov@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=roretzla@linux.microsoft.com \
--cc=ruifeng.wang@arm.com \
--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).