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 9110BA04F3; Mon, 16 Dec 2019 11:49:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D14341BFED; Mon, 16 Dec 2019 11:49:42 +0100 (CET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70044.outbound.protection.outlook.com [40.107.7.44]) by dpdk.org (Postfix) with ESMTP id 4CA111BFEC; Mon, 16 Dec 2019 11:49:41 +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=ejhkgtW6f1ym08fCkAxIsXpI4zWgQQrFb5Ek7gSQK+E=; b=VOL98/Hre+ulGhAyhvfXEbtIeYDOZbThxoYwODWT4mlrssA0aFjxr8RCiJ6/gXkmhBjL3MlvyfX+BpkmMnGXZvU+wp5gzFQaTRptA7ttP1tHjdXngxvapUYY5oFaw/UUnZVBs63hl1Z9eCVcZo4tp1A3yRZmmSgNzZo+fvL/RQ0= Received: from VI1PR08CA0260.eurprd08.prod.outlook.com (2603:10a6:803:dc::33) by AM7PR08MB5414.eurprd08.prod.outlook.com (2603:10a6:20b:105::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.15; Mon, 16 Dec 2019 10:49:40 +0000 Received: from DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::206) by VI1PR08CA0260.outlook.office365.com (2603:10a6:803:dc::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.17 via Frontend Transport; Mon, 16 Dec 2019 10:49:40 +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 DB5EUR03FT033.mail.protection.outlook.com (10.152.20.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.18 via Frontend Transport; Mon, 16 Dec 2019 10:49:39 +0000 Received: ("Tessian outbound 0eaff1016ea4:v40"); Mon, 16 Dec 2019 10:49:39 +0000 X-CR-MTA-TID: 64aa7808 Received: from e512784380ad.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6266017F-2B20-4F69-A359-AB36FF3E2615.1; Mon, 16 Dec 2019 10:49:34 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e512784380ad.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 16 Dec 2019 10:49:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=awZlX28J3Pxea7OVfOw/qf3yQlUn42uVo+qZQav1WLOYpaxPAiL+GYgIaR9vHKptzFVXQWhFCTkapDIF9KmWaNWx8tOlXeFR4bRUzT2lMAAa2+1vjLGygamusLitCcLakeLEPtLe4xIlj/4YX6d2XJKPhkm2KhJn9mu8SCCHuHxp+kUiVzG7otIrJhDMTeIohV7XIMb2MWVRHeyXBVE7eU/2rqWHppVknvU4tDHLF2K2Fn+Yvq31PFnFljHGgU0W0RhdNpp/iQiGReZpPKjQBXSMSABtvCfaKpilFOTmEud5NcJuGm+Zzf5fOMzhJIKnKZLYTiAD3Tk/7TXx7lelIw== 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=ejhkgtW6f1ym08fCkAxIsXpI4zWgQQrFb5Ek7gSQK+E=; b=SpFm/vvVyrHYIWj9+/4Y88KsosJ//E2GQuwZz/ovHYqlGFPddU+VNFSQJn4tvpAm81Qq8mSP2s6w4RhA3rn6dhfxhqahT9zBiM2dkbOPTskfXIbIv3tLlfJoj7Jd2/xa+oyzWVDoHRrzAqX4QNRqyh3GwyMku/HOk3lo0ozqRVXIhdQ9PqmX0nw493t8oIAB6gZFKdv9aFnq8wxUCNYsTQca/L0ryfUaJYuIyX5G8PxardPs2rL7Fbg5j3RSJnFNogZ4vvZ2kTHVmpBGHVpc1vGngbrpycZwNQ8d9lhznVuKi9scWjRnJBB3T9iXIAf6xizJbL1UtBGO1DWOWtG4JQ== 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=ejhkgtW6f1ym08fCkAxIsXpI4zWgQQrFb5Ek7gSQK+E=; b=VOL98/Hre+ulGhAyhvfXEbtIeYDOZbThxoYwODWT4mlrssA0aFjxr8RCiJ6/gXkmhBjL3MlvyfX+BpkmMnGXZvU+wp5gzFQaTRptA7ttP1tHjdXngxvapUYY5oFaw/UUnZVBs63hl1Z9eCVcZo4tp1A3yRZmmSgNzZo+fvL/RQ0= Received: from VI1PR08MB5376.eurprd08.prod.outlook.com (10.255.196.79) by VI1PR08MB4528.eurprd08.prod.outlook.com (20.179.27.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.18; Mon, 16 Dec 2019 10:49:33 +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; Mon, 16 Dec 2019 10:49:31 +0000 From: "Gavin Hu (Arm Technology China)" To: Xiaoyun Li , "jingjing.wu@intel.com" CC: "dev@dpdk.org" , "omkar.maslekar@intel.com" , "stable@dpdk.org" , nd Thread-Topic: [dpdk-dev] [PATCH v2] raw/ntb: fix write memory barrier issue Thread-Index: AQHVs7Tni9/XHz+bM0yLOm9Kl+X1h6e8lRjw Date: Mon, 16 Dec 2019 10:49:31 +0000 Message-ID: References: <20191204151916.12607-1-xiaoyun.li@intel.com> <20191216015854.28725-1-xiaoyun.li@intel.com> In-Reply-To: <20191216015854.28725-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: b6ac8359-5a5c-4c85-8d6f-299ce9f3dbca.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: 45c1ff73-d1df-44de-bbc0-08d78215a6a5 X-MS-TrafficTypeDiagnostic: VI1PR08MB4528:|AM7PR08MB5414: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:1923;OLM:1923; x-forefront-prvs: 02530BD3AA X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(13464003)(189003)(199004)(71200400001)(55236004)(186003)(53546011)(6506007)(7696005)(5660300002)(52536014)(4326008)(26005)(478600001)(9686003)(316002)(55016002)(66476007)(66556008)(64756008)(66446008)(66946007)(76116006)(81166006)(81156014)(86362001)(33656002)(8676002)(8936002)(110136005)(54906003)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB4528; H:VI1PR08MB5376.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: kdxblBd9y5qn/UgCY0z2GnGolFmVGJ3zTV30tf02q0w41ChRx+RdFCBAJzFs3x/iWx35OnWQ2UlY0VtHXwSDI7yP7jhbn3xdIGEWe7gLddcfGIT2z89KGVyBtW9ujvGTvzcVhOhny2Vb7XhldzQA8OwRJ3oIL4nsmnt7QuvWil7X/BxrhSxAWKlx6npUwLmRyt2Jt/DiKcgMjkwJLFOhLXnjbcbxTlpnX2pJoJF4DRZ6SRkYBm5u+enOA3RrSm5OZnGHZIX717tETd+McfPx9C5EAp5rKR6MCBokArr8Xq6H+v8j2AJYDyzhPyOpBZ8GDhogOVLb3nW68uBVpTDhKMmapVO1nufDm2fA479ZZpMvU10OeE7HSuOLEJJNlFVW3uMl4U3nfVTO6RUzyyEc579ryXSkT/dWNYdt2kcu6Wb0U4nIkMgME354uWKbC0na53CexIeEzdJdA90aYYCP2RW3pCHrceWx41vFH343vgu9nZlivfqwmWkz4hTxrduZ 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: VI1PR08MB4528 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(346002)(136003)(396003)(13464003)(199004)(189003)(4326008)(336012)(86362001)(5660300002)(9686003)(7696005)(450100002)(26826003)(356004)(2906002)(26005)(478600001)(81166006)(81156014)(8676002)(8936002)(6506007)(53546011)(55016002)(70206006)(186003)(316002)(33656002)(52536014)(110136005)(70586007)(76130400001)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM7PR08MB5414; 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: 658d1662-acd9-4ee7-fa5c-08d78215a1fb NoDisclaimer: True X-Forefront-PRVS: 02530BD3AA X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uNApvQvkahFuHSuPJcaDXSj3EO6CVId1ynQvJH3fMS3OsFPCmNOB2AYW/uAeq43/RVqzQTHJvrHDvSv9qpYzHoDtn2qWRc64eSKEIepnbsL/YePHoCvfJniSEGgu6fNNdex3fA0Uwscic3+jeqrZXEPJ3FkG4TP509cOl+fVO57dMeK4cMIRDneJhk0GUKPwUf+iA2yqpGH8wz5mW/saryCDvek80hyQtrxamOoD4v2LAi9Zd3tRFdNV5CFyKojQGYM0Ttvxxpv+6gJ6mUEZNOdlCrDVaAlFGdAPaZL1/+P6Bb7++SeHLzyJfli+hPctS3lbZcDt4W9F8RehM9qikvbxq449EHR0KC2m9audCjF1cGq949IZiThS5Vg+VKkyPknwSJrrK3i8X8LOsOe88TVYO9HuRafYOIMpLl9VYx7V3gdLOFPEwNmQzjkugO8graRLC6JkHjhcZ9C8bWahdtUe8VxHhUhZ9P/dht5ZWdJx/NigyzPsfZGo6tSiH79Z X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2019 10:49:39.7297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45c1ff73-d1df-44de-bbc0-08d78215a6a5 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: AM7PR08MB5414 Subject: Re: [dpdk-dev] [PATCH v2] raw/ntb: fix write memory barrier issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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----- > From: dev On Behalf Of Xiaoyun Li > Sent: Monday, December 16, 2019 9:59 AM > To: jingjing.wu@intel.com > Cc: dev@dpdk.org; omkar.maslekar@intel.com; Xiaoyun Li > ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH v2] 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 > --- > v2: > * Replaced rte_wmb with rte_io_wmb since rte_io_wmb is enough. > --- > 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..c7de86f36 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); > + rte_io_wmb(); As both txq->tx_used_ring and *txq->used_cnt are physically reside in the P= CI device side, rte_io_wmb is correct to ensure the ordering. > *txq->used_cnt =3D txq->last_used; > - rte_wmb(); >=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); > + rte_io_wmb(); > *rxq->avail_cnt =3D rxq->last_avail; > - rte_wmb(); >=20 > /* update queue stats */ > off =3D NTB_XSTATS_NUM * ((size_t)context + 1); > -- > 2.17.1 Reviewed-by: Gavin Hu