From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 77AF9A0C49; Wed, 7 Jul 2021 21:05:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCD3F413DB; Wed, 7 Jul 2021 21:05:10 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2049.outbound.protection.outlook.com [40.107.20.49]) by mails.dpdk.org (Postfix) with ESMTP id 248CC413B6 for ; Wed, 7 Jul 2021 21:05:10 +0200 (CEST) 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=89b01dflo24gW68ik07JBAYNePTw3gScZFyfB8MzOzE=; b=i6v1TWP6uLdnlmmOjx+zTYiWYdF5m6VffVlvRHlAOafSlAbdLJWC7szC03NRAhnGGoaFiHMBc2nu2gbCZ9Nw+DZMlMmtSSi4PPgUNtdkjOV+hsQLbIk4hvUJJuLhGCdXFBLcghIVc8XiS6A7C8RjIP7YEXV/6Ahi+rAl30nB/x0= Received: from DB8PR03CA0009.eurprd03.prod.outlook.com (2603:10a6:10:be::22) by AM6PR08MB3893.eurprd08.prod.outlook.com (2603:10a6:20b:8d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Wed, 7 Jul 2021 19:04:57 +0000 Received: from DB5EUR03FT003.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:be:cafe::2a) by DB8PR03CA0009.outlook.office365.com (2603:10a6:10:be::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20 via Frontend Transport; Wed, 7 Jul 2021 19:04:57 +0000 X-MS-Exchange-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=pass 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 DB5EUR03FT003.mail.protection.outlook.com (10.152.20.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20 via Frontend Transport; Wed, 7 Jul 2021 19:04:57 +0000 Received: ("Tessian outbound 257aba444440:v98"); Wed, 07 Jul 2021 19:04:57 +0000 X-CR-MTA-TID: 64aa7808 Received: from 074ded36947f.4 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 459925A1-30F3-4E20-8FEF-FA93FDAB7F54.1; Wed, 07 Jul 2021 19:04:47 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 074ded36947f.4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 07 Jul 2021 19:04:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GZ4mAOL+K42G6Uvqy8oBgKgJGMQFzCgaV3CcLtsoBZU8gu7cZrxsKoy1zrHCBIk9LlTPPyuYTHw1L0k2OdO7S1QWr7/Isyt+g6wtlDhG7KGPzTJDjDB/SGnw0gkzM55xwRH1P+ZH5Jpsb/R5eZkfQS4D/OJT/WI8sJwz785nlkowQTWWTyFyjSOxzCU203QW1BYc2qtcKLCCgC1QdKEKJHaU4UQ/wb4XOeoKMy/gEhFL7QCMug1TQqytiW1uSBXaX0r55z9K1I3mDR/j7LQO6uLlPgD5XGZ2cbTgED3h/t3R7+v2fmizzRNNBA2897XjpEZDOCfyjZxo3iGMBB1dYA== 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=89b01dflo24gW68ik07JBAYNePTw3gScZFyfB8MzOzE=; b=GXYwlYU3T4505cW0ewZvlqkAKlRw3/jYP5wOZyeO12zk0ALaWKXr0vuCkAEjdH9oa5ulqM17C2Zvt0xW3fDApr208x63CNd2viBlfnu9KyYgriOMJ0HNpdktu0Hnk+Mwtwgq8IfH7dSoMEVHlC4noGx4k1LLahXWo3Qlna8KQKybyEmLqOXGD/WhuHkxfTWINUIHf/yrILjjy0UmLQhsWivJA55TTAOx9r8sYYZ0HErwKslhikTEmgVyZjQz6JgPZy/ngdRO9nf5Qzou7q99jUQ6uopgY+fcPBDDsMJCbNkmqPm4/4KCF7Gq2rb0/hnute9/90KG/TNWmuzBE4Rv8Q== 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=89b01dflo24gW68ik07JBAYNePTw3gScZFyfB8MzOzE=; b=i6v1TWP6uLdnlmmOjx+zTYiWYdF5m6VffVlvRHlAOafSlAbdLJWC7szC03NRAhnGGoaFiHMBc2nu2gbCZ9Nw+DZMlMmtSSi4PPgUNtdkjOV+hsQLbIk4hvUJJuLhGCdXFBLcghIVc8XiS6A7C8RjIP7YEXV/6Ahi+rAl30nB/x0= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB7PR08MB3337.eurprd08.prod.outlook.com (2603:10a6:5:26::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.31; Wed, 7 Jul 2021 19:04:44 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::f15f:821c:74c5:2482]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::f15f:821c:74c5:2482%2]) with mapi id 15.20.4308.021; Wed, 7 Jul 2021 19:04:44 +0000 From: Honnappa Nagarahalli To: "thomas@monjalon.net" , Ruifeng Wang , Phil Yang CC: "bruce.richardson@intel.com" , "konstantin.ananyev@intel.com" , "dev@dpdk.org" , "david.marchand@redhat.com" , David Christensen , nd , Honnappa Nagarahalli , nd Thread-Topic: atomic operations Thread-Index: AQHXb/7EOXmmHqTSZk6zwV6i4TZ5UKs31UiQ Date: Wed, 7 Jul 2021 19:04:44 +0000 Message-ID: References: <1879045.6WiRxTbeAL@thomas> In-Reply-To: <1879045.6WiRxTbeAL@thomas> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: E4B9B123C39E9E4CBF87F2FAA8775DC3.0 x-checkrecipientchecked: true Authentication-Results-Original: monjalon.net; dkim=none (message not signed) header.d=none; monjalon.net; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: b9ed4459-9471-4546-a171-08d9417a1d02 x-ms-traffictypediagnostic: DB7PR08MB3337:|AM6PR08MB3893: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: KxecH4JMWIauQR/ytWY0eqcAb7uuXdFI79P7/4MBAU2TQzfe7TaZBiVGvSvh0jAc8p6ap8F7Q9d8JbLg7F896gU3CdGJk4Sb+Pvk/WNgkios3evLtutiOrBdidq+nfGsvSwrgqNxxmZVAtwE+iiQAKp7KzB/0cNnMfji5ZFYUs5cP9qpV2/4S68bhgUe1K0mJt1lMssLSi7URtDFwDSyI36WPWIa1he4g7AnXdqhTGguofzwR/waRxROgP4RYwqlTclfTwnaEEYFKN53OV2sd6DAfiBo0fIjg/fU4OYLFFA14ZRjrRAkYz2OMCGH2+OrvQs5csRzmQNnlv1qQqebijF0ckoJjTKVrFvAve0iS26x8gETC4FxdFcV8iiFKzYK6t7ZtbU6pTz/YYUruogPOL0Mwqvs5HfokgWyhCvxL/ptm2QmHOGjXT+wIn0x1WraAlBIE9n6QXwjJiFE0nUYCUzY+qgqYnlFt0Y4tsieLBF8rlvpU6q6p5qxJRc+EsYHtFkb3+fyNVr83ParYcOE6pucx7slpQghzkTdw/BwtpjOz6cn9ooZq0OCxIRlXY/ZBbLXNclTdlYpctB02Un1ObyUnPYPH23mz3xZxRSLdqV8NFmB4x+XZZx1isIV3WTUHcWhA1TLvOZtp/OZl6DmFPiSjgMMogLtEYhOGhVhVMxrD7qDcK6tuAp133W6L7jxDqJkUqqgWKbnV8n9G95MYHoP1f8vx7Ky6J1QC5N88TeDcDSx1Ur26XiPEYFFYjoIvDjoL3AVFf23B/syCdGYzMs5sjER4Gov/X3BOuO1u4PK88oBddIlF/TbYQqZeWJCPnzWn0IeF05p2JCC2FJKzg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(39850400004)(376002)(366004)(396003)(5660300002)(966005)(52536014)(86362001)(2906002)(4326008)(64756008)(6506007)(83380400001)(8676002)(110136005)(7696005)(54906003)(3480700007)(55016002)(9686003)(478600001)(186003)(26005)(316002)(38100700002)(66556008)(122000001)(66946007)(7116003)(66476007)(6636002)(8936002)(76116006)(66446008)(71200400001)(33656002)(21314003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?NAIL5SP0RxBdZkdoZ5WF+qjMOl2m98BCWynPjPgJTRau9u73vAyMOkzXB8vj?= =?us-ascii?Q?3awIJJ9oYYHFipr05vVqbf7cA5GDIRZVlhXGO7tMsyLVB6spuJ2kIQQxsdK4?= =?us-ascii?Q?K/ilqYQz6Epo5xIqHn3qnfxnr2LxZQ6OX7+rOJXSG182YQoABDXytejLw6pe?= =?us-ascii?Q?B/XGjKWLBFL1GDW7WSzcafwLBHcdCjaznKYtkuGDEBmILrcUxUchBoRKxJpJ?= =?us-ascii?Q?UH5f/T/DiTTVjK9pb938vU2sBiDrWo8CaaKz4oQaCkw0BM7pRH2CaZnPqWXB?= =?us-ascii?Q?vPd4Ex+7Qa69U9QJO16A8FIBnkws4t7Q6jGMin/JkF8YnhgK45O3eNd1iKZu?= =?us-ascii?Q?dMh53TevC7+CFeeeV6t8bbkNh+m4eqxTgEu+31NElgWUzGAXPnqXEEFcBWkZ?= =?us-ascii?Q?ugqxddI1lSP+4juslZIeZCG3COceRykkIAIt+J0KiHROwqtnXSSt70Tgt90S?= =?us-ascii?Q?cgOwseHLS52EpIzGi2FSLFDEWia3GANPN38p8xHRD3m1YxhUc+oVx3o46Sze?= =?us-ascii?Q?Rpi9f+xdo0+OTam5o5MeEl8ILQkN/y4mQYeo6Ct4QzhSuzmNeVRmEDIJP6hP?= =?us-ascii?Q?7swhZ26cW5X3g7nZ/06o7H8oijSG+8IO3CdCU75xmGNXNCkbI6wLszRpLMTC?= =?us-ascii?Q?uMiZsteNwjVXSKuKJMDZ/jQOVbOhBAM1u8a6WL3rIbP6ERg1QAh6TP1nsBUM?= =?us-ascii?Q?R4lHOwkYMIF9sqigIrswLQsIi4hD1qjz4fg1QADJhD4yvDKOyBPJddw8wb32?= =?us-ascii?Q?Wxh4qROQBxQwXzjI74lWFvca2BH1fo4x5KDbgwFbNWoPp1XsdM1gjlcB7Nhp?= =?us-ascii?Q?SdBuFaaqJkyvzRnGhfm/5vGiiXxgnVXCS8hL2ZNq6V/GG33KGNLdqKNwuA6D?= =?us-ascii?Q?rs4j2fQeNMhUGGunx70WDboPFT+oYSw355fE9Ut7PsiQ0E0V5mrR33cvOcPJ?= =?us-ascii?Q?UShwP811DbyXRxKvASKjNRf65NLt8SJ1mmJvR9BirxX3cGQhM/e0288gfur0?= =?us-ascii?Q?by3m8O9KMKGt7mvQhokgJRMMtNGAHFaZVefNpdFVS+BQMe4MG4oCGGnJ5+MU?= =?us-ascii?Q?3M7NxxZetVCdBNmWnAJXQhFoVuTie4QBnGPpAZsT7WGsnvSbwRVbah9lj8Te?= =?us-ascii?Q?fsbaDa3k31Y0UpHrHEfcbkHjbjuKS7DK60K1BYSx0I4jR03MRQG1XMG3wWUX?= =?us-ascii?Q?Gott7rxFZhyi0d/Z+wsn3VagEoJzXlvYP7Nl3XnJYm4ThVl1kBXXoJmK/G33?= =?us-ascii?Q?hePO7vf8LpZz8ATO8MoQPTuq7YKfAFWqfvilHu+zWTvOC2FzK4rmMlYAJhDA?= =?us-ascii?Q?5xQliGxRSLap+FHNP+Pw1CEw?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3337 Original-Authentication-Results: monjalon.net; dkim=none (message not signed) header.d=none; monjalon.net; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5f7f297b-a7bb-486a-8628-08d9417a1540 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z1176Zj58JfGqA31cNv0k8VsabqVo2FtHgzVTkJE6i5QHlkA2zcpZRiqsUW92n4Q5MfYvvSAGUyvdT5YGbC2Cv79XaCbySG1HynDlHG5HBsgXRLXGEYxq4iB0pX2Obif5CvrIQUsffH92yBKjLsg1n4Oim844PxXDEDWUizjGkz6woi++WlHd/UW5eE0H0QA166pKrr7/alSSsIg9amxzkVLqOug1kgImXcnxYutB+oZSZMmigjc7UBOBftbVwk+Tfa6Ckf3Pvgc+Fm+UuN4c6XIXG+1VXbqPvLyBa0P/+ADr5mYF9BPtWqjiWrXiw00SIXXpntq8ZyNshGtxr0XNjJEoYPl2qOJ/zKcWyAMCBRwqCygmfnXhYfPYW0nPyMHk9RJkP0OmkaktDNqOtBfsZsu8baTQK1ymlGNHmqLMq6FIMrx5iEeN9P3X0wO/zbxhC0yCyHjd9urF4gXUfKTB5WIFUYJluAoaGXfSRul6AM/DnUNI80CKxtldHJpXMlyef5QchJgZwZ+6LcNcnSXco6j4unkxfI8lYjVpM+6B3AlkQP9AMKosMCBI4aD4MKOM8FfGiSF9Xx14mrLpO9r5Gpmp2ep8YRRMiE+yaS5v4lWWGsjwPjjut9+Jvat+81pzanrjCunSLu2PhiihS1cdG53udOroNjbklZreEtic1xnFNZf4I+ACnodRmJ5nEsPMO5eVefgZPHgmh57iFm1EcuoS3Yr/IkXvYJeWgVUbP62wpJuwENuv4pKGhQa4xWQaRj2+UHZYmAYFjRs46cJ4+LUnb82ssh97yVyWyvLpF3uq2MMI3H9HRmuAOmHm/HETJ6MgNV19SGxeo/6PZzT/tonCjvmxzJhAd39kl9yCig= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(136003)(346002)(376002)(39860400002)(396003)(46966006)(36840700001)(8676002)(55016002)(47076005)(36860700001)(26005)(356005)(478600001)(7696005)(8936002)(52536014)(186003)(70586007)(966005)(3480700007)(316002)(70206006)(7116003)(54906003)(33656002)(5660300002)(6506007)(82310400003)(86362001)(110136005)(4326008)(83380400001)(81166007)(6636002)(82740400003)(336012)(9686003)(2906002)(21314003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2021 19:04:57.8083 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9ed4459-9471-4546-a171-08d9417a1d02 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-AuthSource: DB5EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3893 Subject: Re: [dpdk-dev] atomic operations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" >=20 > In the deprecation notices of DPDK 21.05, we can still read this: > " > * rte_atomicNN_xxx: These APIs do not take memory order parameter. This > does > not allow for writing optimized code for all the CPU architectures supp= orted > in DPDK. DPDK will adopt C11 atomic operations semantics and provide > wrappers > using C11 atomic built-ins. These wrappers must be used for patches tha= t > need to be merged in 20.08 onwards. This change will not introduce any > performance degradation. >=20 > * rte_smp_*mb: These APIs provide full barrier functionality. However, ma= ny > use cases do not require full barriers. To support such use cases, DPDK= will > adopt C11 barrier semantics and provide wrappers using C11 atomic built= -ins. > These wrappers must be used for patches that need to be merged in 20.08 > onwards. This change will not introduce any performance degradation. > " >=20 > Should we keep these notifications forever? I do not think we need to keep them forever (unless the precedence is to ke= ep all the older deprecations). >=20 > It is very difficult to find which wrapper to use. Actually, the deprecations are incorrect on the 'wrappers'. When the deprecations were added, the understanding was we will develop wra= ppers, the discussion was not concluded. When we made the decision, we deci= ded to use the C++11 atomic built-ins. Only wrapper developed was rte_atomi= c_thread_fence. This is documented in the following blog. >=20 > This is the guide we have: > https://doc.dpdk.org/guides/prog_guide/writing_efficient_code.html#locks- > and-atomic-operations > There are 2 blog posts: > https://www.dpdk.org/blog/2021/03/26/dpdk-adopts-the-c11-memory- > model/ > https://www.dpdk.org/blog/2021/06/09/reader-writer-concurrency/ >=20 > Basically it says we should use "__atomic builtins" but there is example = for > simple situations like counters, memory barriers, etc. > Please who could work on improving the documentation? There is good amount of information on how to use the __atomic builtins for= counters, memory barriers etc. It would make sense to document something in DPDK if we implement our own w= rappers. >=20