From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A03B1A0548; Thu, 11 Nov 2021 13:27:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8CB19410EF; Thu, 11 Nov 2021 13:27:47 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 52DFE40E2D; Thu, 11 Nov 2021 13:27:45 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10164"; a="293725559" X-IronPort-AV: E=Sophos;i="5.87,226,1631602800"; d="scan'208";a="293725559" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2021 04:27:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,226,1631602800"; d="scan'208";a="583363039" Received: from irsmsx603.ger.corp.intel.com ([163.33.146.9]) by FMSMGA003.fm.intel.com with ESMTP; 11 Nov 2021 04:27:41 -0800 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by irsmsx603.ger.corp.intel.com (163.33.146.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 11 Nov 2021 12:27:40 +0000 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2242.012; Thu, 11 Nov 2021 20:27:37 +0800 From: "Zhang, Qi Z" To: Ruifeng Wang , "dev@dpdk.org" CC: "Xing, Beilei" , "Richardson, Bruce" , "jerinj@marvell.com" , "hemant.agrawal@nxp.com" , "drc@linux.vnet.ibm.com" , "honnappa.nagarahalli@arm.com" , "stable@dpdk.org" , "nd@arm.com" Subject: RE: [PATCH v2 2/2] net/i40e: fix risk in Rx descriptor read in scalar path Thread-Topic: [PATCH v2 2/2] net/i40e: fix risk in Rx descriptor read in scalar path Thread-Index: AQHXqgyPG70y93F550SRMTXuJAwt+qv+mtqQ Date: Thu, 11 Nov 2021 12:27:37 +0000 Message-ID: References: <20210906033201.1789796-1-ruifeng.wang@arm.com> <20210915083339.2424369-1-ruifeng.wang@arm.com> <20210915083339.2424369-3-ruifeng.wang@arm.com> In-Reply-To: <20210915083339.2424369-3-ruifeng.wang@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Ruifeng Wang > Sent: Wednesday, September 15, 2021 4:34 PM > To: dev@dpdk.org > Cc: Xing, Beilei ; Zhang, Qi Z ; > Richardson, Bruce ; jerinj@marvell.com; > hemant.agrawal@nxp.com; drc@linux.vnet.ibm.com; > honnappa.nagarahalli@arm.com; stable@dpdk.org; nd@arm.com; Ruifeng > Wang > Subject: [PATCH v2 2/2] net/i40e: fix risk in Rx descriptor read in scala= r path >=20 > Rx descriptor is 16B/32B in size. If the DD bit is set, it indicates that= the rest of > the descriptor words have valid values. Hence, the word containing DD bit > must be read first before reading the rest of the descriptor words. >=20 > Since the entire descriptor is not read atomically, on relaxed memory ord= ered > systems like Aarch64, read of the word containing DD field could be reord= ered > after read of other words. >=20 > Read barrier is inserted between read of the word with DD field and read = of > other words. The barrier ensures that the fetched data is correct. >=20 > Testpmd single core test showed no performance drop on x86 or N1SDP. > On ThunderX2, 22% performance regression was observed. >=20 > Fixes: 7b0cf70135d1 ("net/i40e: support ARM platform") > Cc: stable@dpdk.org >=20 > Signed-off-by: Ruifeng Wang > Reviewed-by: Honnappa Nagarahalli > --- > drivers/net/i40e/i40e_rxtx.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c = index > 8329cbdd4e..c4cd6b6b60 100644 > --- a/drivers/net/i40e/i40e_rxtx.c > +++ b/drivers/net/i40e/i40e_rxtx.c > @@ -746,6 +746,12 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf > **rx_pkts, uint16_t nb_pkts) > break; > } >=20 > + /** > + * Use acquire fence to ensure that qword1 which includes DD > + * bit is loaded before loading of other descriptor words. > + */ > + rte_atomic_thread_fence(__ATOMIC_ACQUIRE); > + > rxd =3D *rxdp; > nb_hold++; > rxe =3D &sw_ring[rx_id]; > @@ -862,6 +868,12 @@ i40e_recv_scattered_pkts(void *rx_queue, > break; > } >=20 > + /** > + * Use acquire fence to ensure that qword1 which includes DD > + * bit is loaded before loading of other descriptor words. > + */ > + rte_atomic_thread_fence(__ATOMIC_ACQUIRE); > + > rxd =3D *rxdp; > nb_hold++; > rxe =3D &sw_ring[rx_id]; > -- > 2.25.1 Applied to dpdk-next-net-intel. Thanks Qi