From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] eal: fix 64bit address alignment in 32-bit builds Date: Fri, 28 Apr 2017 11:21:27 +0200 Message-ID: <2039188.oPr2FiSFIW@xps> References: <20170428081551.28954-1-bruce.richardson@intel.com> <1797441.atIi8ZZIaG@xps> <20170428090306.GA25692@bricha3-MOBL3.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, olivier.matz@6wind.com To: Bruce Richardson Return-path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id E6FCF2C18 for ; Fri, 28 Apr 2017 11:21:29 +0200 (CEST) In-Reply-To: <20170428090306.GA25692@bricha3-MOBL3.ger.corp.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 28/04/2017 11:03, Bruce Richardson: > On Fri, Apr 28, 2017 at 10:56:56AM +0200, Thomas Monjalon wrote: > > 28/04/2017 10:15, Bruce Richardson: > > > On i686 builds, the uint64_t type is 64-bits in size but is aligned to > > > 32-bits only. This causes mbuf fields for rearm_data to not be 16-byte > > > aligned on 32-bit builds, which causes errors with some vector PMDs which > > > expect the rearm data to be aligned as on 64-bit. > > > > > > Given that we cannot use the extra space in the data structures anyway, as > > > it's already used on 64-bit builds, we can just force alignment of physical > > > address structure members to 8-bytes in all cases. This has no effect on > > > 64-bit systems, but fixes the updated PMDs on 32-bit. > > > > I agree to align on 64-bit in mbuf. > > > > > Fixes: f4356d7ca168 ("net/i40e: eliminate mbuf write on rearm") > > > Fixes: f160666a1073 ("net/ixgbe: eliminate mbuf write on rearm") > > [...] > > > --- a/lib/librte_eal/common/include/rte_memory.h > > > +++ b/lib/librte_eal/common/include/rte_memory.h > > > -typedef uint64_t phys_addr_t; /**< Physical address definition. */ > > > +/** Physical address definition. */ > > > +typedef uint64_t phys_addr_t __rte_aligned(sizeof(uint64_t)); > > > > Why setting this constraint for everyone? > > > Well, it only has an effect on 32-bit builds, and unless there is a > problem, I don't see why not always align them to the extra 8 bytes. If > this does cause an issue, I'm happy enough to use #ifdefs, but in the > absense of a confirmed problem, I'd rather keep the code clean. Is it expected for everyone to have every physical addresses aligned on 64? I think it can be weird for some applications. Why do you think it is cleaner than adding the alignment to the mbuf fields? PS: It is yet another macro which is not rte_ prefixed.