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 5A57143B12; Tue, 13 Feb 2024 20:27:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D357E402D1; Tue, 13 Feb 2024 20:27:58 +0100 (CET) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 6B92840273 for ; Tue, 13 Feb 2024 20:27:57 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id 3B1F02088F; Tue, 13 Feb 2024 20:27:57 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH v2] mbuf: replace GCC marker extension with C11 anonymous unions X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Tue, 13 Feb 2024 20:27:52 +0100 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F213@smartserver.smartshare.dk> In-Reply-To: <20240213184818.GA20546@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH v2] mbuf: replace GCC marker extension with C11 anonymous unions Thread-Index: AdperTaXw8RMFglrTn+YZPDl12RoYAABHX/A References: <1706657173-26166-2-git-send-email-roretzla@linux.microsoft.com> <1707806741-29694-1-git-send-email-roretzla@linux.microsoft.com> <1707806741-29694-2-git-send-email-roretzla@linux.microsoft.com> <98CBD80474FA8B44BF855DF32C47DC35E9F20F@smartserver.smartshare.dk> <20240213184818.GA20546@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Tyler Retzlaff" Cc: , "Andrew Boyer" , "Andrew Rybchenko" , "Bruce Richardson" , "Chenbo Xia" , "Konstantin Ananyev" , "Maxime Coquelin" 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 > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com] > Sent: Tuesday, 13 February 2024 19.48 >=20 > On Tue, Feb 13, 2024 at 05:58:21PM +0100, Morten Br=F8rup wrote: > > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com] > > > Sent: Tuesday, 13 February 2024 07.46 > > > > > > Replace the use of RTE_MARKER with C11 anonymous unions to > improve > > > code portability between toolchains. > > > > How about combining the cacheline 0 marker and padding, like this: >=20 > this seems like a good suggestion i will evaluate it. at least it gets > rid of all the extra nesting if there are no unforseen problems. >=20 > > > > struct rte_mbuf { > > - RTE_MARKER cacheline0; > > + union { > > + char cacheline0[RTE_CACHE_LINE_MIN_SIZE]; > > > > + struct { > > - void *buf_addr; /**< Virtual address of segment buffer. > */ > > + void *buf_addr; /**< Virtual address of segment > buffer. */ > > #if RTE_IOVA_IN_MBUF > > > > > > You could do the same with the cacheline1 marker: >=20 > yeah, i wondered if i should. i'll do it since it does seem more > consistent to just pad out both cachelines explicitly instead of just > doing all but the last. >=20 > we probably don't need to align struct rte_mbuf type if we do since it > will cause it to be naturally aligned to RTE_CACHE_LINE_MIN_SIZE. We still need to align struct rte_mbuf to cache line size. RTE_CACHE_LINE_MIN_SIZE is 64, like the cache line size on Intel arch, but cache line size is 128 byte on POWER architecture and Apple M2.