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 0B44C28F2 for ; Mon, 4 Apr 2016 16:45:56 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 04 Apr 2016 07:45:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,440,1455004800"; d="scan'208";a="947686515" Received: from unknown (HELO Sent) ([10.217.248.31]) by orsmga002.jf.intel.com with SMTP; 04 Apr 2016 07:45:49 -0700 Received: by Sent (sSMTP sendmail emulation); Mon, 04 Apr 2016 16:45:27 +0200 From: Tomasz Kulasek To: dev@dpdk.org Date: Mon, 4 Apr 2016 16:45:23 +0200 Message-Id: <1459781123-7556-1-git-send-email-tomaszx.kulasek@intel.com> X-Mailer: git-send-email 2.1.4 Subject: [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 14:45:57 -0000 It seems that with gcc >5.x and -O2/-O3 optimization breaks packet grouping algorithm. When last packet pointer "lp" and "pnum->u64" buffer points the same memory buffer, high optimization can cause unpredictable results. It seems that assignment of precalculated group sizes may interfere with initialization of new group size when lp points value inside current group and didn't should be changed. With gcc >5.x and optimization we cannot be sure which assignment will be done first, so the group size can be counted incorrectly. This patch eliminates intersection of assignment of initial group size (lp[0] = 1) and precalculated group sizes when gptbl[v].idx < 4. Fixes: 94c54b4158d5 ("examples/l3fwd: rework exact-match") Signed-off-by: Tomasz Kulasek --- examples/l3fwd/l3fwd_sse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) /* if dest port value has changed. */ if (v != GRPMSK) { - lp = pnum->u16 + gptbl[v].idx; - lp[0] = 1; pnum->u64 = gptbl[v].pnum; + pnum->u16[FWDSTEP] = 1; + lp = pnum->u16 + gptbl[v].idx; } return lp; -- 1.7.9.5