From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 94B2C2946 for ; Mon, 4 Apr 2016 21:06:31 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 04 Apr 2016 12:06:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,441,1455004800"; d="scan'208";a="925232119" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga001.jf.intel.com with ESMTP; 04 Apr 2016 12:06:29 -0700 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 4 Apr 2016 20:06:28 +0100 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.35]) by irsmsx112.ger.corp.intel.com ([169.254.1.234]) with mapi id 14.03.0248.002; Mon, 4 Apr 2016 20:06:28 +0100 From: "Ananyev, Konstantin" To: "Kulasek, TomaszX" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] examples/l3fwd: fix segfault with gcc 5.x Thread-Index: AQHRjoC/RWiN1YIBa0yX2h8fmQ5HWZ96LPHg Date: Mon, 4 Apr 2016 19:06:28 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B2E246@irsmsx105.ger.corp.intel.com> References: <1459781123-7556-1-git-send-email-tomaszx.kulasek@intel.com> In-Reply-To: <1459781123-7556-1-git-send-email-tomaszx.kulasek@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzM3NDgxZmUtNzBlMC00OGM2LTgzYzEtMDRhMWJhMmRmYzQxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlNVb1E5R3diQURGS3I0ZzVrQ3lnbmd3enRIeGZLVVRiVGpFZm05SGRnZ1U9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] examples/l3fwd: fix segfault with gcc 5.x X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 19:06:32 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Kulasek > Sent: Monday, April 04, 2016 3:45 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] examples/l3fwd: fix segfault with gcc 5.x >=20 > It seems that with gcc >5.x and -O2/-O3 optimization breaks packet groupi= ng > algorithm. >=20 > When last packet pointer "lp" and "pnum->u64" buffer points the same > memory buffer, high optimization can cause unpredictable results. It seem= s > that assignment of precalculated group sizes may interfere with > initialization of new group size when lp points value inside current grou= p > and didn't should be changed. >=20 > With gcc >5.x and optimization we cannot be sure which assignment will be > done first, so the group size can be counted incorrectly. >=20 > This patch eliminates intersection of assignment of initial group size > (lp[0] =3D 1) and precalculated group sizes when gptbl[v].idx < 4. >=20 > Fixes: 94c54b4158d5 ("examples/l3fwd: rework exact-match") >=20 > Signed-off-by: Tomasz Kulasek > --- > examples/l3fwd/l3fwd_sse.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h > index f9cf50a..1afa1f0 100644 > --- a/examples/l3fwd/l3fwd_sse.h > +++ b/examples/l3fwd/l3fwd_sse.h > @@ -283,9 +283,9 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, = __m128i dp1, __m128i dp2) >=20 > /* if dest port value has changed. */ > if (v !=3D GRPMSK) { > - lp =3D pnum->u16 + gptbl[v].idx; > - lp[0] =3D 1; > pnum->u64 =3D gptbl[v].pnum; > + pnum->u16[FWDSTEP] =3D 1; > + lp =3D pnum->u16 + gptbl[v].idx; > } >=20 > return lp; > -- Acked-by: Konstantin Ananyev > 1.7.9.5