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 75A3843B14; Tue, 13 Feb 2024 21:00:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A565402D1; Tue, 13 Feb 2024 21:00:56 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C98A240273 for ; Tue, 13 Feb 2024 21:00:54 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 06832207EC9F; Tue, 13 Feb 2024 12:00:54 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 06832207EC9F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707854454; bh=NygvgnIB3iVHi/p455+NEX/rqF33kVwMpJqFrwB1hJA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VAWsIWs6IZRwUbmylNIYtCoWaBJAMwxNI1ain+LSDw+B0FblxOOsW8XbVEVybiUEP gJ4k0nrIMQc2yng2i5dfovSlbu/sxbaHC/XILDX8+bKUQHSWntQNfYnaN/rsmn9LXD njkjJNWQWtHa7Gq7nwfggi2UQLpmUn22T/poJBQo= Date: Tue, 13 Feb 2024 12:00:53 -0800 From: Tyler Retzlaff To: Morten =?iso-8859-1?Q?Br=F8rup?= Cc: dev@dpdk.org, Andrew Boyer , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Konstantin Ananyev , Maxime Coquelin Subject: Re: [PATCH v2] mbuf: replace GCC marker extension with C11 anonymous unions Message-ID: <20240213200053.GA2622@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> 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> <98CBD80474FA8B44BF855DF32C47DC35E9F213@smartserver.smartshare.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F213@smartserver.smartshare.dk> 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 On Tue, Feb 13, 2024 at 08:27:52PM +0100, Morten Brørup wrote: > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com] > > Sent: Tuesday, 13 February 2024 19.48 > > > > On Tue, Feb 13, 2024 at 05:58:21PM +0100, Morten Brørup 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: > > > > 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. > > > > > > > > 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: > > > > 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. > > > > 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. RTE_CACHE_LINE_SIZE vs RTE_CACHE_LINE_MIN_SIZE forgot about that.