From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6558EA04F1 for ; Sat, 14 Dec 2019 16:30:03 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 339491BFAF; Sat, 14 Dec 2019 16:30:03 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80054.outbound.protection.outlook.com [40.107.8.54]) by dpdk.org (Postfix) with ESMTP id 6F0631BFAF; Sat, 14 Dec 2019 16:30:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=032agUKS5HCzr921O/PXK0LMLcwJbWlCnp0vRsj5Elw=; b=mETvVaktRmMCYaYZWZ9e2UBTjOWNyWUDvU4V5YAI/nOKEl/OJLf4YTccUBeGAUOkoE7xm7JU7WbVru0EJ8OqmkfwqzAhaeWl+WogidHYEdqUBhviICAGDtFpoxb9G5JG5j8PXao4tuikCrwAnNmc7X3ZRIGfL+AbNHkxXYY7X/o= Received: from VI1PR08CA0194.eurprd08.prod.outlook.com (2603:10a6:800:d2::24) by HE1PR08MB2922.eurprd08.prod.outlook.com (2603:10a6:7:2e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.15; Sat, 14 Dec 2019 15:29:59 +0000 Received: from DB5EUR03FT048.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::206) by VI1PR08CA0194.outlook.office365.com (2603:10a6:800:d2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.15 via Frontend Transport; Sat, 14 Dec 2019 15:29:58 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT048.mail.protection.outlook.com (10.152.21.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.18 via Frontend Transport; Sat, 14 Dec 2019 15:29:58 +0000 Received: ("Tessian outbound e09e55c05044:v40"); Sat, 14 Dec 2019 15:29:58 +0000 X-CR-MTA-TID: 64aa7808 Received: from c3571d64776c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9AEAE438-EACB-4935-97DC-AF2B34D0EAAE.1; Sat, 14 Dec 2019 15:29:53 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c3571d64776c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 14 Dec 2019 15:29:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mx3/igQbr+o5g6/A63WIlT9awKufkk0gpI9AepcvkX7r9uKllZmAk5IfOTQo6T6qK4Qw/pnCUTInialOC8TCGxUvM38LevcJkPhhnhh3rVT3+MDuKIeM20ip7VtvXN61GsaUpfrkpbDWxEjBS/WbIyT4sYaqMX149i1L++eIM5RawP4TKMkUzLyC9mvRl4fszs0h2NYMf9wXFbMMKxkhEYnvgHC/c833tAsFP0dpsCwnhH+ZeAfqtrFmfG8yDAsmKIcywj7UeCG5aXhfRQpplH6TqwtaAz5lVi8cEGqVIak+H/agSu3CaUSmspVnQcrDZzhd4uyTHh1rqG03J9gKKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=032agUKS5HCzr921O/PXK0LMLcwJbWlCnp0vRsj5Elw=; b=hMCpz6rFMdgAr6DinakgP+lTVIhlMEajPEJ2N6VwZeLtnKbYCO4RniclBtWs4L6VqPPoXL2zlj9MIMrMoBYyw0Q+nztlS1l/E6+fYcPtL8XLLLTiTvnZVWeW42Zewcn0E6eWm5XwxZF1NqlhGwyG1Yf/O7dcaaYkW82wf1WXlU1sYKQQkswe+01U2J3mlofcw50yP1N+8LC2ng+J3GSLbufstf6wXCtTgATJrvOHAwjsHbWRjpTRxxiXzBziiAcEq68At6WRgfmXtcc+BVT2XAvlYsclpb38btKeFPBpdIhjCCbeW1eKmJNVfNnvv4+NaB2WMKuWs+Ba0m8z747L+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=032agUKS5HCzr921O/PXK0LMLcwJbWlCnp0vRsj5Elw=; b=mETvVaktRmMCYaYZWZ9e2UBTjOWNyWUDvU4V5YAI/nOKEl/OJLf4YTccUBeGAUOkoE7xm7JU7WbVru0EJ8OqmkfwqzAhaeWl+WogidHYEdqUBhviICAGDtFpoxb9G5JG5j8PXao4tuikCrwAnNmc7X3ZRIGfL+AbNHkxXYY7X/o= Received: from VI1PR08MB5376.eurprd08.prod.outlook.com (10.255.196.79) by VI1SPR01MB0384.eurprd08.prod.outlook.com (10.141.111.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.18; Sat, 14 Dec 2019 15:29:50 +0000 Received: from VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::dde8:216f:6a0b:8cfb]) by VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::dde8:216f:6a0b:8cfb%7]) with mapi id 15.20.2538.019; Sat, 14 Dec 2019 15:29:50 +0000 From: "Gavin Hu (Arm Technology China)" To: Xiaoyun Li , "jingjing.wu@intel.com" CC: "dev@dpdk.org" , "stable@dpdk.org" , nd Thread-Topic: [dpdk-dev] [PATCH] raw/ntb: fix write memory barrier issue Thread-Index: AQHVqrakdRAoGo/TLU22us54PelBa6e50C0A Date: Sat, 14 Dec 2019 15:29:50 +0000 Message-ID: References: <20191204151916.12607-1-xiaoyun.li@intel.com> In-Reply-To: <20191204151916.12607-1-xiaoyun.li@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 873dff9f-b840-4c74-bf28-195bae3129a9.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c0d5d92a-2077-45f8-c613-08d780aa7aa3 X-MS-TrafficTypeDiagnostic: VI1SPR01MB0384:|HE1PR08MB2922: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:3631;OLM:3631; x-forefront-prvs: 025100C802 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(39840400004)(376002)(366004)(346002)(136003)(199004)(189003)(13464003)(81166006)(53546011)(76116006)(8676002)(6506007)(81156014)(7696005)(55016002)(9686003)(86362001)(110136005)(54906003)(66476007)(966005)(66556008)(478600001)(26005)(2906002)(186003)(316002)(66946007)(71200400001)(4326008)(33656002)(5660300002)(52536014)(66446008)(64756008)(8936002)(55236004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1SPR01MB0384; H:VI1PR08MB5376.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: at5LkJKAdwzDLfPxdK0YuaJw+kMt7Y7l1XgkzaWY6vXCKEXlqKmzjoy+6uxXdTdHvzqXmAXdJ71SwLKWxJBouC7cXlTG3vF/oWhGZZvyNTAXU+1hME6qsowJuInV5tvuSHfgMC19BhZ6bJTGkj1uFczz4zSD/D0lSvzdvx6UKScVodVjrhpiccRNFL0dgvCPpFSrSr6sePJEOIRJ6bBLxgRAK8GCdVff2lv5SVnj/ZmVoTzp9ZboUE5NIU46tkDwJIVn2Pk3D8l6rgLh5Ev0e0ON2L1boNY2fj0ejdXL1M9P594ZUxbAbpy8BHD72m3dSFw88Hd3EQMo3vUSVI48xxuQsB2bNW9M/+US7mYJFxTvVjmhxqD/EgTG5Wz+MXqy5dUpZEwn9ax2ap7MvWvvyEQKb4rB8+SncRW/hCtNJ3VlhIfRmWlTf/GvEGYqm3gZWazicybniFhRRhOmP9vQWrBxnZEI1AoyRRDWwS+tzJ29XfYpGCOGztihreTybHoDFu3FbG2YchD4QGeKUTd6w/hUhZA0o0yOEVFKZeAoWqI= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1SPR01MB0384 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT048.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(346002)(376002)(396003)(39860400002)(136003)(199004)(189003)(13464003)(52536014)(2906002)(356004)(9686003)(55016002)(5660300002)(86362001)(70206006)(54906003)(70586007)(316002)(33656002)(110136005)(76130400001)(53546011)(6506007)(450100002)(81156014)(4326008)(26005)(8676002)(81166006)(7696005)(26826003)(8936002)(478600001)(336012)(966005)(186003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR08MB2922; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 1f6ee434-9697-4ccd-8e6f-08d780aa75d5 NoDisclaimer: True X-Forefront-PRVS: 025100C802 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rKD4pNgXmHK7aFi4qvFCjTNRtMpsPAGWKa0IfdHGWeVBFzFXu18QQ9t7K/wruzxlc4wTx34mehTVB/VeTT39CURyiZ0NjMiyyDlg379x5RffWUVTf8+QTk/JRT+KUkVbesw6jENn1oCQoRutj8PDZoMpBVZcMsjB0I/40GufIAVpzs5Zf+AgBKuXZO0DHH6pqTg+CxMCwBkIaAkLJEAgq0Uxk8Kdl724KhtXnKZfAYFd2t6d1CJg62TvrbCvUEfLn4oMNLal9b96ibX5D5RMbf43/AH1EoCNtXsAbTv8Dmhk2M8RY7KZDalA6VVf213EQlxRadd9655xdpoYm75VUnO8Fe7MfHUIhtokYnpNv8DynmHIJ5TsDgXarJjaJmrblJPKKyg2A8gZSjxCo9tj6EeyExPECRc0Pcq/q+Jz2iXL1GBKX/9pUeiO0xh3eldbvhALtOlJTtUevWXRltFyPK3/yYYX4TWyYoKQh0ZeWO5wMk+HtHUkQ8ODtKiNYhivbtv/rivBh4+7MTjroEkGq0hLWPY6E/VUbFTcBwCc8s0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2019 15:29:58.5843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0d5d92a-2077-45f8-c613-08d780aa7aa3 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2922 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] raw/ntb: fix write memory barrier issue X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi Xiaoyun, > -----Original Message----- > From: dev On Behalf Of Xiaoyun Li > Sent: Wednesday, December 4, 2019 11:19 PM > To: jingjing.wu@intel.com > Cc: dev@dpdk.org; Xiaoyun Li ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH] raw/ntb: fix write memory barrier issue >=20 > All buffers and ring info should be written before tail register update. > This patch relocates the write memory barrier before updating tail regist= er > to avoid potential issues. >=20 > Fixes: 11b5c7daf019 ("raw/ntb: add enqueue and dequeue functions") > Cc: stable@dpdk.org >=20 > Signed-off-by: Xiaoyun Li > --- > drivers/raw/ntb/ntb.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c > index ad7f6abfd..dd0b72f8c 100644 > --- a/drivers/raw/ntb/ntb.c > +++ b/drivers/raw/ntb/ntb.c > @@ -683,8 +683,8 @@ ntb_enqueue_bufs(struct rte_rawdev *dev, > sizeof(struct ntb_used) * nb1); > rte_memcpy(txq->tx_used_ring, tx_used + nb1, > sizeof(struct ntb_used) * nb2); > - *txq->used_cnt =3D txq->last_used; > rte_wmb(); > + *txq->used_cnt =3D txq->last_used; I am ok with the re-location of the barrier, but why not the rte_io_wmb ins= tead of rte_wmb?=20 Rte_io_wmb is sufficient to guarantee the preceding stores are visible to t= he device, rte_wmb is overkill.=20 https://code.dpdk.org/dpdk/latest/source/lib/librte_eal/common/include/gene= ric/rte_atomic.h#L92=20 >=20 > /* update queue stats */ > hw->ntb_xstats[NTB_TX_BYTES_ID + off] +=3D bytes; > @@ -789,8 +789,8 @@ ntb_dequeue_bufs(struct rte_rawdev *dev, > sizeof(struct ntb_desc) * nb1); > rte_memcpy(rxq->rx_desc_ring, rx_desc + nb1, > sizeof(struct ntb_desc) * nb2); > - *rxq->avail_cnt =3D rxq->last_avail; > rte_wmb(); > + *rxq->avail_cnt =3D rxq->last_avail; >=20 > /* update queue stats */ > off =3D NTB_XSTATS_NUM * ((size_t)context + 1); > -- > 2.17.1