From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7E450439C4; Thu, 25 Jan 2024 19:37:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F1920402D7; Thu, 25 Jan 2024 19:37:15 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 84EF5402AB for ; Thu, 25 Jan 2024 19:37:14 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id D1E5720E56B9; Thu, 25 Jan 2024 10:37:13 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D1E5720E56B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1706207833; bh=Rxf9InW11XR0Z5MqZqPuRlNpw2zUkPmqX6yvxLECBAw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NSIbr6X9pqVNT+xNplawx8FEUPjMcLRXizZiazxYBarHbt7fXj4ks3K0pT6wk/1sH 9QjmsdtE8OsJnsIuy9Hoq7vfoU/u2zhTC4YXS5p5LyKGHiWnE+qYnxZWVLzyZUdrqD h1cNMuFeh9hxkm2Jho9tCLSVYJk4nVZ4SAU1tbAU= Date: Thu, 25 Jan 2024 10:37:13 -0800 From: Tyler Retzlaff To: dev@dpdk.org Cc: Mattias =?iso-8859-1?Q?R=F6nnblom?= , Anatoly Burakov , Bruce Richardson , David Christensen , Harry van Haaren , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Stanislaw Kardach , thomas@monjalon.net Subject: Re: [PATCH] RFC: use C11 alignas instead of GCC attribute aligned Message-ID: <20240125183713.GA27715@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1700069997-4399-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1700069997-4399-1-git-send-email-roretzla@linux.microsoft.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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