From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30070.outbound.protection.outlook.com [40.107.3.70]) by dpdk.org (Postfix) with ESMTP id 2A6055F62; Wed, 26 Sep 2018 11:29:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dInT7D75mYDyJbGL6598KgNZ/jo0P13yrNdvsshWBrY=; b=AkSGKKwVlenF7MGFWD2hj62YQQHb1o8wyyRVDDIan5x82Ctexb02l9Rb8toPPe7giy8t3BWC4PfRFq0npAKMTnw20U7MHx4z21XcwBIJ++pis07atTmWynHbd+DU0rc2/JvkcpafNVGOJPIVZrDXmnlDkEBhKff4hV+Qs5nIe9M= Received: from VI1PR08MB3167.eurprd08.prod.outlook.com (52.133.15.142) by VI1PR08MB3088.eurprd08.prod.outlook.com (52.133.15.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Wed, 26 Sep 2018 09:29:13 +0000 Received: from VI1PR08MB3167.eurprd08.prod.outlook.com ([fe80::4c13:b1f:ad01:86d7]) by VI1PR08MB3167.eurprd08.prod.outlook.com ([fe80::4c13:b1f:ad01:86d7%4]) with mapi id 15.20.1164.024; Wed, 26 Sep 2018 09:29:12 +0000 From: "Gavin Hu (Arm Technology China)" To: "Gavin Hu (Arm Technology China)" , "dev@dpdk.org" CC: Honnappa Nagarahalli , Steve Capper , Ola Liljedahl , "jerin.jacob@caviumnetworks.com" , nd , "stable@dpdk.org" , Justin He Thread-Topic: [PATCH v3 1/3] ring: read tail using atomic load Thread-Index: AQHUTl7oRf7ShYPLWECgB4oSebTnGqUCWerQ Date: Wed, 26 Sep 2018 09:29:12 +0000 Message-ID: References: <20180807031943.5331-1-gavin.hu@arm.com> <1537172244-64874-1-git-send-email-gavin.hu@arm.com> In-Reply-To: <1537172244-64874-1-git-send-email-gavin.hu@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR08MB3088; 6:ffhMUovtYnQO752OVwbLxn+Fz/47ujqqfSWwfP7KSXfjatn9rtfUVNieS93P9FeZVabJ85Uqr3yU8WvSpikxIJEHOMDI+DOEVF2YJdylWyh9kJc8M1GgBh5FcVGdHLQpDmVDdVEpq4+FwOL2/e9Fzy3QlySzEFimDqEhgV3QQpAgyTudmjjOUzIa9jDGm2vYQOeAj1hk3KFVyUiQ4krFmSCbSXeqLq4yMqiKLJcDIrn3BJn4g2m9vZsRYUj/QSNlxdaMxtA61Hn9Br0+920yRnkfAB2BrbaQt76LR60MhSvDNO4nRi/6s12zSn4TayF2zaVaGs2oBjD0eziwq/4kFgvXhyIHPvQZrNFncAv9GES+b+TGE3QbgoJ2xytXUa77XZY5mTP0Mfev8Uc/8dYzmhRl6AaQV6RXQ1WI+z3lnh2V+fiYpyhF1hf+sWEtNloRNBLJLaWColRS04UogesEHw==; 5:ieEzO5/SG7SfmY945CV/eGk0FQx3yoTjht1hA7WyabEzrUVDZJSb0oK5FovpRgl63+KjmCbMLvVmk/BfKXITrkmd9f0pkmZXWtpFgsx9DZpP5oYbPmX5Y6zlMxHermjxs7zMWimfRjtg7p0IZwpbMmyHe0oq0vUGZsOCGcYm1Dg=; 7:qUZzVIqhth34aMF3dCatTj7ndkc66l3wAR/SdmQmy/gY2TZX3IWCCsbcxlHdn55DYg3pprskRTEw07qSCz+GOInzcRS8yZavkStxQRtwh2G66Of23Y55kKE059bGxKW9eTZPOl3GvE7A0CJMppk7Uhr/PouB9Vc7AzYqUjfreaWZ9EKoSvbsEagm1BU8IRq2vxBL3kDEBeMTH51bftrQCEfHpOzKA0wEI5VV5NbtB8B5KWntLxkMLyMCrae8Hia6 x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: 99ae8e0c-aeda-4837-d609-08d623928568 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR08MB3088; x-ms-traffictypediagnostic: VI1PR08MB3088: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:VI1PR08MB3088; BCL:0; PCL:0; RULEID:; SRVR:VI1PR08MB3088; x-forefront-prvs: 08076ABC99 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(396003)(346002)(376002)(39860400002)(13464003)(199004)(189003)(53546011)(7696005)(5660300001)(3846002)(2501003)(99286004)(25786009)(8936002)(229853002)(110136005)(102836004)(66066001)(33656002)(478600001)(54906003)(6436002)(316002)(6116002)(5250100002)(8676002)(2906002)(6506007)(81156014)(81166006)(476003)(74316002)(305945005)(53936002)(6246003)(26005)(486006)(55016002)(76176011)(9686003)(446003)(11346002)(68736007)(86362001)(106356001)(7736002)(14444005)(72206003)(256004)(97736004)(71200400001)(71190400001)(34290500001)(4326008)(14454004)(105586002)(2900100001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3088; H:VI1PR08MB3167.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-microsoft-antispam-message-info: kWDdmiGxvEVr0DFaQco3TYdR86W4a+wL5ayN+C95yVVtwqGNKLgPMy0aaFm5qRsj4Wq4NF3Ky1KNZGMRSbasihl2zACylo35EdNdiM+7Twg+eJ7Jp9aAWNyaIWA68F8yPRNg28nSB2eYe4ROpNe9DKZvoxRk7rRbhcmIgFX7jrh1lto3UiWXDuuFwqA+3IWT45sQRfT+YGKcFPya/dCXOPYhtykOSZmg6lQuv5OaJBKnqFHQocjBkBwIqz1x37FBVi23Vv8AEVhXMTVWoTGnfKzMrut+MXCn81VsQBjJasG9p6nJI6x+I3q9FtEJD4MnTAjttZGpqlKHh5t5XZiUpyqReDanehOTwRK41MvVEnQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99ae8e0c-aeda-4837-d609-08d623928568 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Sep 2018 09:29:12.8691 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3088 Subject: Re: [dpdk-stable] [PATCH v3 1/3] ring: read tail using atomic load 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: , X-List-Received-Date: Wed, 26 Sep 2018 09:29:15 -0000 +Justin He > -----Original Message----- > From: Gavin Hu > Sent: Monday, September 17, 2018 4:17 PM > To: dev@dpdk.org > Cc: Gavin Hu (Arm Technology China) ; Honnappa > Nagarahalli ; Steve Capper > ; Ola Liljedahl ; > jerin.jacob@caviumnetworks.com; nd ; stable@dpdk.org > Subject: [PATCH v3 1/3] ring: read tail using atomic load >=20 > In update_tail, read ht->tail using __atomic_load.Although the compiler > currently seems to be doing the right thing even without _atomic_load, we > don't want to give the compiler freedom to optimise what should be an > atomic load, it should not be arbitarily moved around. >=20 > Fixes: 39368ebfc6 ("ring: introduce C11 memory model barrier option") > Cc: stable@dpdk.org >=20 > Signed-off-by: Gavin Hu > Reviewed-by: Honnappa Nagarahalli > Reviewed-by: Steve Capper > Reviewed-by: Ola Liljedahl > --- > lib/librte_ring/rte_ring_c11_mem.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_ring/rte_ring_c11_mem.h > b/lib/librte_ring/rte_ring_c11_mem.h > index 94df3c4..234fea0 100644 > --- a/lib/librte_ring/rte_ring_c11_mem.h > +++ b/lib/librte_ring/rte_ring_c11_mem.h > @@ -21,7 +21,8 @@ update_tail(struct rte_ring_headtail *ht, uint32_t > old_val, uint32_t new_val, > * we need to wait for them to complete > */ > if (!single) > - while (unlikely(ht->tail !=3D old_val)) > + while (unlikely(old_val !=3D __atomic_load_n(&ht->tail, > + __ATOMIC_RELAXED))) > rte_pause(); >=20 > __atomic_store_n(&ht->tail, new_val, __ATOMIC_RELEASE); > -- > 2.7.4