From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 3CA612935 for ; Fri, 28 Apr 2017 10:19:19 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2017 01:19:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,387,1488873600"; d="scan'208";a="79967519" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.133]) by orsmga002.jf.intel.com with SMTP; 28 Apr 2017 01:19:17 -0700 Received: by (sSMTP sendmail emulation); Fri, 28 Apr 2017 09:19:16 +0100 Date: Fri, 28 Apr 2017 09:19:16 +0100 From: Bruce Richardson To: dev@dpdk.org Message-ID: <20170428081915.GA14292@bricha3-MOBL3.ger.corp.intel.com> References: <20170428081551.28954-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170428081551.28954-1-bruce.richardson@intel.com> Organization: Intel Research and =?iso-8859-1?Q?De=ACvel?= =?iso-8859-1?Q?opment?= Ireland Ltd. User-Agent: Mutt/1.8.0 (2017-02-23) Subject: Re: [dpdk-dev] [PATCH] eal: fix 64bit address alignment in 32-bit builds X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 08:19:20 -0000 On Fri, Apr 28, 2017 at 09:15:51AM +0100, Bruce Richardson wrote: > 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. > > Fixes: f4356d7ca168 ("net/i40e: eliminate mbuf write on rearm") > Fixes: f160666a1073 ("net/ixgbe: eliminate mbuf write on rearm") > > Signed-off-by: Bruce Richardson > --- > lib/librte_eal/common/include/rte_memory.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h > index 4aa5d1f..ad14875 100644 > --- a/lib/librte_eal/common/include/rte_memory.h > +++ b/lib/librte_eal/common/include/rte_memory.h > @@ -98,7 +98,8 @@ enum rte_page_sizes { > */ > #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE) > > -typedef uint64_t phys_addr_t; /**< Physical address definition. */ > +/** Physical address definition. */ > +typedef uint64_t phys_addr_t __rte_aligned(sizeof(uint64_t)); > #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1) > Note that this is obviously not the only way to fix the issues with the PMDs, but it seems to me to be the simplest and most logical way to do so. I've verified with testpmd that a) things still work for 64-bit, and b) the md5sums of the testpmd 64-bit binary do not change before and after the change, so it really only affects 32-bit builds. Regards, /Bruce