From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60085.outbound.protection.outlook.com [40.107.6.85]) by dpdk.org (Postfix) with ESMTP id 088FF1B134; Wed, 26 Sep 2018 12:09:47 +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=qFhyKgYZhQEEmxRQOGMAscNpMDYhJ/QxOmUK87IlVic=; b=bjk6ifwNKlNN+tkaaY0ByHf1zS7JEJZ/EiNtwV0G3+uhnkqvgCHuFbm9Y51RBM2ZGPys5a4EY7kaZR86nrKhqwHqdS9oI3QBIL24vGOmIv5+U1F2DnE5jiQGT9PhtFSEBWl9kuuNEi0b8isGLIZpHk96Ua6kqHMxFdls8eDizro= Received: from DB7PR08MB3082.eurprd08.prod.outlook.com (52.134.110.24) by DB7PR08MB3257.eurprd08.prod.outlook.com (52.134.111.19) 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 10:09:44 +0000 Received: from DB7PR08MB3082.eurprd08.prod.outlook.com ([fe80::6c4d:ef1:bd1c:4589]) by DB7PR08MB3082.eurprd08.prod.outlook.com ([fe80::6c4d:ef1:bd1c:4589%6]) with mapi id 15.20.1143.022; Wed, 26 Sep 2018 10:09:44 +0000 From: Justin He To: "Gavin Hu (Arm Technology China)" , "dev@dpdk.org" CC: Honnappa Nagarahalli , Steve Capper , Ola Liljedahl , "jerin.jacob@caviumnetworks.com" , nd , "stable@dpdk.org" Thread-Topic: [PATCH v3 1/3] ring: read tail using atomic load Thread-Index: AQHUTl7oRf7ShYPLWECgB4oSebTnGqUCWerQgAALHDA= Date: Wed, 26 Sep 2018 10:09:44 +0000 Message-ID: References: <20180807031943.5331-1-gavin.hu@arm.com> <1537172244-64874-1-git-send-email-gavin.hu@arm.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Justin.He@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR08MB3257; 6:Cz1K/KnpfkbMrrTkCu6ebq/PvgbWs8J/GzbKvZkfB/xHaFgn0LyQ55JemJNwBmlQ05+pIxkweRlmTwNsfIlpDzWHO8ucKQVi3D1J8c90WtQX9eSj7aBs4sgT5eJPOyUUlX8yOEMak5ljw5l6KfjbyxSdouffQQJauA+ZcZvirAkyeVY98b6JLGAhYqn1cqLHBzgMiZvkNa/2nJPe2kmAg4V8Vx5U0t6YAVT/A/IVs9yFGTmpt0kjMDCBDQsBPrvrNMQlKEC1WCwJMwFuHyiKJmdDKBdNNRxUphK9KSKKhTHlrrFnNMUfJFBTXoS51kNeWr7sJEGo7BOBU5zKFhrexcKcF0DKQ+Q9t+6BE0n0TM1I4NZwsUwYatqp/fsIKd8AoIcC55Ozn5pRsDHMOZ7zkpTn9H0V/2XFlBPZpyq6vrf5i6famkLmY0AhVfirdtYTdLfIbgn/i+5SVL0hWSeqQA==; 5:EesHOfI7ZT0nP/TCtMUkxjcY6EEkneRgqtAmwmV/Js/L8jr0G730Y8YA+ljEryBN1yGyetmiNrzImHCAVLQ52L3QqERr+lZyeC4DabSt2E3h1E+D0tDaN5uRVk37FnI6WDp/qoA6uLmnAZAdZSz3xhHC1LAbezL7ZkDTZZGZDMw=; 7:+8Jv+hCyZ9D83RKAioIy1GbARv8w9nRmuzzJR7vYBHNenRb9C9VqPeV2OjM8+6grgbuhSFU8MXsNmwxFLcDe0wQNmVlOREqXoSGyNfk/BwV4tjWUSyZ1Re5kLrCmieE4qHsu17Os/xNpXeFs3TbcCYNAl9UaKhXzeDH2pgAd2jsBwRFd1QKejr5CRY/T+8ALTzfaZXvhCQzpDAxZjQf/4CdfFhNJW+6miWTypixUaFXNO9+ciY8Mej/SAws+douU x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: d11ce00a-f8c1-4db0-8550-08d623982eba x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR08MB3257; x-ms-traffictypediagnostic: DB7PR08MB3257: 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)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(201708071742011)(7699051); SRVR:DB7PR08MB3257; BCL:0; PCL:0; RULEID:; SRVR:DB7PR08MB3257; x-forefront-prvs: 08076ABC99 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(346002)(39860400002)(396003)(136003)(13464003)(40434004)(199004)(189003)(446003)(5660300001)(81156014)(11346002)(8676002)(99286004)(7696005)(55016002)(256004)(6436002)(76176011)(9686003)(5024004)(53936002)(316002)(14444005)(2501003)(229853002)(8936002)(71190400001)(26005)(71200400001)(86362001)(54906003)(6116002)(2900100001)(81166006)(6506007)(2906002)(476003)(53546011)(3846002)(102836004)(5250100002)(66066001)(4326008)(33656002)(68736007)(105586002)(305945005)(74316002)(7736002)(25786009)(106356001)(6246003)(486006)(34290500001)(14454004)(110136005)(72206003)(97736004)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3257; H:DB7PR08MB3082.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: MX7AEDIK6o5k817LNdY3P17i/NSNKhxv/MG6PKgbgu/Kqz6LO9GzabcLy1xW7C9QstIdWrbkpSRxjHXTp48M9XliKgMAEuPk7ET8SK0lLRJnSSmYrXYszeJnUAflPgmzq//U2t6X4b1tJzZZdMbefDfDBpg3mYJj98riyfDOx2ASTK8dzg9+1Ypc8kChwskyJgnieVcmKXwlaOCvWHB+5/sUiFJ/6FWTu5PIkgQN7Ov1+7r8I0ZES8zxHG6mc21Z9VV0XKuMsQ1dFr0qkjKhBa3eC9lW20DEUcGlqIQZVF9IYupiuy6o9fit5yu/QpVGjkXwcNd78um0uKzcOpmPA3SdTAYAbNscWvnszaPTsk4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: d11ce00a-f8c1-4db0-8550-08d623982eba X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Sep 2018 10:09:44.4109 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3257 X-Mailman-Approved-At: Thu, 27 Sep 2018 13:25:05 +0200 Subject: Re: [dpdk-dev] [PATCH v3 1/3] ring: read tail using atomic load 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: , X-List-Received-Date: Wed, 26 Sep 2018 10:09:47 -0000 > -----Original Message----- > From: Gavin Hu (Arm Technology China) > Sent: 2018=1B$BG/=1B(B9=1B$B7n=1B(B26=1B$BF|=1B(B 17:29 > 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 > Subject: RE: [PATCH v3 1/3] ring: read tail using atomic load > > +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 > > > > 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= . > > > > Fixes: 39368ebfc6 ("ring: introduce C11 memory model barrier option") > > Cc: stable@dpdk.org > > > > 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(-) > > > > 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))) I still wonder why an atomic load is needed here? Cheers, Justin (Jia He) > > rte_pause(); > > > > __atomic_store_n(&ht->tail, new_val, __ATOMIC_RELEASE); > > -- > > 2.7.4 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.