From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0073.outbound.protection.outlook.com [104.47.38.73]) by dpdk.org (Postfix) with ESMTP id 3F9071B123; Sat, 29 Sep 2018 12:49:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8UxaN9v66nv/IKQBUdL0aIUEfq3rWf2Q21T6EurqVyE=; b=DVbSqtTJHXbgVMZUeTCQNbGNTa2UhlbvXuBCbp3Pm72jPjfsgm3BIyEDZmGL1iXahYLjiL7fZ/8LK+sNKiUBK6gToqgV0YQpn66+vVL7QKOdRLMA8ceJ82JyrK7XxtCAVvRTAW7Eg/6mnkOmRe4Bs9Qy7J8fxEhJ7yaAOpbvgCM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (115.113.156.3) by DM6PR07MB5003.namprd07.prod.outlook.com (2603:10b6:5:25::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Sat, 29 Sep 2018 10:49:17 +0000 Date: Sat, 29 Sep 2018 16:18:59 +0530 From: Jerin Jacob To: Gavin Hu Cc: dev@dpdk.org, Honnappa.Nagarahalli@arm.com, steve.capper@arm.com, Ola.Liljedahl@arm.com, nd@arm.com, stable@dpdk.org Message-ID: <20180929104857.GA30457@jerin> References: <20180807031943.5331-1-gavin.hu@arm.com> <1537172244-64874-1-git-send-email-gavin.hu@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1537172244-64874-1-git-send-email-gavin.hu@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Originating-IP: [115.113.156.3] X-ClientProxiedBy: PN1PR0101CA0057.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:d::19) To DM6PR07MB5003.namprd07.prod.outlook.com (2603:10b6:5:25::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec694fe4-6f17-4f57-7007-08d625f9363b X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:DM6PR07MB5003; X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB5003; 3:9vH7Pi5pIJDfGumHxr3PFnjmNGx5ZFEE63J93P+jHx22G0jQSzN2xqaXvwxFgq+xbEWQ+uDlKa3BPWyZsECYzJeR5NmkaKzV22W26zQq3ggK1gzBT7UjZerYm7Vbe2Z7AAHpf7ou6r/csrftww0R7Ny+ivHn4Gucg+FrXLfQIa2sa7sINIsnqEszd7zxt50DyRyt5o/VgK2/9OaTIiyDufVQU4FzXtWZJYxUrl0BIjUo34HR0EMBoP2/WC3fujPE; 25:Y5Pc0K7XtAyrIAPMdCG35CMKI1rEJqrod2zgoorPD5qPwjYPrO5xYvArWLwZXpDS59VMWeb0tcdty1VmG4+YSGuZO4CTtToMETu7vC75b64TPhCW7pPK/N7XqXKj+ThnABWPZ4xupLr/c1olM2pULRwHaRufOPcMIYuHgpQt+ibQ/WNvajzQavpnSLrj9CNQzY4hOtodxuJ3xtCt35s4+47nwo+HeQmcWKxueDbYJELljoEdbBTwpPzI504/7E/NK2NdaC7sk0dV/apTvz5l3ga7m8ZEnV3PfKIzEfoM0OI2IO7usyA7iVnPdJbWmyNiWL/dvU8b3ouJfQbn9X83/Q==; 31:viTlTXYZBuZPbYLTpPngELwDgNPFS9FffE8D/6g17FlGLkRU6I4j9B8qi+2TXoWwuwDEtzbxRAOf8ToIXMtCheBBGe/ffcYFLHKe1p2ng9XjgLKbpewyVemQ23V/LJEJ8/cFZ5TiashLWfkKHe+0eDd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JItfeRMYRDmp8Hbl2YX/mt3QZ1I 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)(93006095)(3231355)(944501410)(52105095)(3002001)(10201501046)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(201708071742011)(7699051); SRVR:DM6PR07MB5003; BCL:0; PCL:0; RULEID:; SRVR:DM6PR07MB5003; X-Forefront-PRVS: 0810818DA0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(136003)(39860400002)(366004)(13464003)(189003)(199004)(97736004)(55016002)(478600001)(7736002)(386003)(16526019)(186003)(956004)(26005)(9686003)(16586007)(50466002)(72206003)(305945005)(58126008)(316002)(4326008)(44832011)(47776003)(14444005)(81166006)(81156014)(446003)(11346002)(8936002)(34290500001)(25786009)(66066001)(106356001)(105586002)(6496006)(52116002)(33896004)(6666003)(6916009)(68736007)(76176011)(5660300001)(8676002)(6246003)(229853002)(476003)(53936002)(1076002)(33716001)(2906002)(23726003)(42882007)(6116002)(3846002)(33656002)(486006)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR07MB5003; H:jerin; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR07MB5003; 23:czWX3UIjBJV+1+8JcD0iMpjCDfkWSJQMkK/IHNdQO?= =?us-ascii?Q?fK1yjwcQuy5ssfFaUQYMZr2YuRfcvPfdrB+hUbViR9imSdFKEaqE35XeplO4?= =?us-ascii?Q?AQJgZX4Pg0jQAxRl9/GxoaWZxjmKvayDLkSdWD8ePOByLfCqDAz8km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HdESlZqJc5SdXBJ/knxll8EkqHsn5rmkamzlL9geT4FcMs7AGRl4hIcjwXZ+BlDGoqB2VpU+Mgw3hGcC0YoNbpCHlCM94/wuIzpXu5kYgq4tQczL2bR+XxHCeHDXvJN8mq60cAzspOT05xECLh/hYwvD58mV8NfvraDFe9RTIsb8irWSgD8vIF6phzKqYO6nUamUyP1yzFLGmy0RKHt7S7zbatyGd2m10gPZdcUmdN51zXUPtHDTc6U3t+ECJ6UMhH5eNA==; 5:PoNKcGJiAOL2lPTPPSkDdhrwRPtOL/grDDqY3K6qgnUU2kAr26r7g+jyb65/+OYETd9T70jxvWPJbeMV09TyKQEmiooM05Sk9nqKrPCpGe4P1gOKY8/BDswpltROqoh5AQ9fz7/2xK6xsQDSuUNurJNT1wZlFCgLqlDh6ix8KDY=; 7:uMO5Yc4a1ZjvdLJ2fterqlogLlDflT7KYxnhWDRpLZxnCW+Emb78Plb2Pt2iC/DmMrPovZYIlcjYlYv/PWIW83FtqxyLEXNGkzuyrDNBi9WNgy/3ozW6oCrkRpqUBjE9SVnq1ENwCbZHyjkjMidB4epk2S7IGPfoBlmZefKFngfvse4ysTdMMHAH0leNTDdE0PEFkZ/tlBqGVxwc26WuJbzUv8sNlcakJsodVk2+MaCAreV6XVMghVr2uk70HqpE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2018 10:49:17.4661 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec694fe4-6f17-4f57-7007-08d625f9363b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB5003 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: Sat, 29 Sep 2018 10:49:22 -0000 -----Original Message----- > Date: Mon, 17 Sep 2018 16:17:22 +0800 > From: Gavin Hu > To: dev@dpdk.org > CC: gavin.hu@arm.com, Honnappa.Nagarahalli@arm.com, steve.capper@arm.com, > Ola.Liljedahl@arm.com, jerin.jacob@caviumnetworks.com, nd@arm.com, > stable@dpdk.org > Subject: [PATCH v3 1/3] ring: read tail using atomic load > X-Mailer: git-send-email 2.7.4 > > External Email > > 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 != old_val)) > + while (unlikely(old_val != __atomic_load_n(&ht->tail, > + __ATOMIC_RELAXED))) > rte_pause(); Since it is a while loop with rte_pause(), IMO, There is no scope of false compiler optimization. IMO, this change may not required though I don't see any performance difference with two core ring_perf_autotest test. May be more core case it may have effect. IMO, If it not absolutely required, we can avoid this change. > > __atomic_store_n(&ht->tail, new_val, __ATOMIC_RELEASE); > -- > 2.7.4 >