From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH v2] examples/l3fwd: fix aliasing in port grouping Date: Mon, 6 Nov 2017 09:59:46 +0530 Message-ID: <20171106042945.GA4073@jerin> References: <20171103104351.30181-1-gprathyusha@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: tomasz.kantecki@intel.com, Jianbo.Liu@arm.com, guduriprathyusha@gmail.com, konstantin.ananyev@intel.com, dev@dpdk.org To: Guduri Prathyusha Return-path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0074.outbound.protection.outlook.com [104.47.37.74]) by dpdk.org (Postfix) with ESMTP id 082BE1B252 for ; Mon, 6 Nov 2017 05:30:08 +0100 (CET) Content-Disposition: inline In-Reply-To: <20171103104351.30181-1-gprathyusha@caviumnetworks.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" -----Original Message----- > Date: Fri, 3 Nov 2017 16:13:51 +0530 > From: Guduri Prathyusha > To: tomasz.kantecki@intel.com > CC: Jianbo.Liu@arm.com, guduriprathyusha@gmail.com, > konstantin.ananyev@intel.com, dev@dpdk.org, Guduri Prathyusha > > Subject: [dpdk-dev] [PATCH v2] examples/l3fwd: fix aliasing in port grouping > X-Mailer: git-send-email 2.14.1 > > With -f-strict-aliasing enabled by default from -O2, gcc > 5.x gives > undefined behavior in port_groupx4 in ARM. 'pn' and 'pnum' are > two different pointers pointing to same chunk of memory and > with -f-strict-aliasing the pointers are assumed to be pointing to > different memory and compiler reorders instructions that depend on > pnum and pn. This breaks port grouping algorithm. > > This patch eliminates the above problem by introducing a compiler > barrier between the instructions that depend on pnum, pn and lp. > > Fixes: 569b290cdb36 ("examples/l3fwd: add NEON implementation") > > Signed-off-by: Guduri Prathyusha Acked-by: Jerin Jacob > --- > examples/l3fwd/l3fwd_neon.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h > index 4bc161394..b319b5a92 100644 > --- a/examples/l3fwd/l3fwd_neon.h > +++ b/examples/l3fwd/l3fwd_neon.h > @@ -114,6 +114,7 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, > > /* update last port counter. */ > lp[0] += gptbl[v].lpv; > + rte_compiler_barrier(); > > /* if dest port value has changed. */ > if (v != GRPMSK) { > -- > 2.14.1 >