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 E0FA0A034F; Wed, 13 May 2020 13:54:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 61B651D54B; Wed, 13 May 2020 13:54:04 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 1DEEA23D for ; Wed, 13 May 2020 13:54:02 +0200 (CEST) IronPort-SDR: PW6PCt84Z4xdacenWyU3twelLpsePRqsNx7InvADLxXBRaqrJtiv2ontXCNaLQS2GzDsUB04+w CfFLwui/iJbg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 04:54:02 -0700 IronPort-SDR: MH3ArAFHobF0kQX/ialkMsfhA7DFnkeEI0m8kMPZQ/Q25DSyh4yJdJqPXS7q7z5c545kVer/KO bTl27bGqaJpQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,387,1583222400"; d="scan'208";a="287003075" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga004.fm.intel.com with ESMTP; 13 May 2020 04:54:01 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 13 May 2020 04:54:01 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.177) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 13 May 2020 04:54:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DotJL+7Gklf7K8VABwVQRgUdDs4DtSoH79QRpJSbsZRFXDXW4jUnY0Jabkd37PiOt0fAcxibXaNZ5bTP8l95RvvXRYRw38Pf3JNAE6iStl5+zw0Ta7YNHsJ5M5hRronRoAX4ignHr1HmaURbnGnOLCLDG5Sra9sY9lqmNfQLL1BxkKLNj6LmFJFgirIXU232ShFyYPV9+67LA0iKp7RR002RlDMA4gI3CYz5gmffa2ytqkY5mIR7UpvrUq9DXfBM5u4XIPFCGhb5vNddwDleM2JhLDrOyqHlZGD1e8WeCt/MIJXySf6KQDt286+L9h4+bM8AAW69224xVq2NjxXUqg== 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=bdjrc8P5raFC4VZkB3k5ENEyYjCQN76dPEp+ydDo+dg=; b=WKwPo9Jy/YhNyVndTyu/Vfjfu+CgA0vdr5bChIqKRWHm/aub8yKWuOpfUT37jAQ6QzCZNgVja8W0E8yABdwdjafH/ICz7afVgLY4yEYx+ktetYi+EUwK1uuegOC9veOm42UznTjU556hDWRlO6iUKkv4gdVlzyJpCVkwwWLDDAWCEz1mxZrLDPbq63QA6HpX8ghwIx18mfaj6mJYwxuX66w8yGrUM11bRYtY2j2qqa75XhMk9cZvlVvSKHwVQ13VdZFYPIkQD3uJfvehhKrq6yEcrk2FGALNt5ySd6BQYDa0CWpXlvSpSFAOQ9XCPN0uB3wCTOnSQw8uieg4JArFTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bdjrc8P5raFC4VZkB3k5ENEyYjCQN76dPEp+ydDo+dg=; b=UvyeK5NmDX5KY1szS//L1Ze5BUg3BDGOn5B1gXwHOSvsAowfrY37KOLjP5exNO//x6PVUMwoECm2Gnp+qrNxGvtZ5sh/Oe8YwSrPtrTpLrSyYkAr4s3i4vaKJYJccufAs7YUknJHm1qCA4jK16RRlRzHDb0fHRQ4Tam2yxH4g08= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BYAPR11MB3784.namprd11.prod.outlook.com (2603:10b6:a03:fe::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.28; Wed, 13 May 2020 11:53:58 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f8cb:58cd:e958:fff4]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f8cb:58cd:e958:fff4%6]) with mapi id 15.20.2979.033; Wed, 13 May 2020 11:53:58 +0000 From: "Ananyev, Konstantin" To: Honnappa Nagarahalli , Stephen Hemminger , Phil Yang CC: "thomas@monjalon.net" , "dev@dpdk.org" , "Richardson, Bruce" , "Yigit, Ferruh" , "hemant.agrawal@nxp.com" , "jerinj@marvell.com" , "ktraynor@redhat.com" , "maxime.coquelin@redhat.com" , "olivier.matz@6wind.com" , "mb@smartsharesystems.com" , "mattias.ronnblom@ericsson.com" , "Van Haaren, Harry" , "Carrillo, Erik G" , nd , nd Thread-Topic: [PATCH v4 4/4] eal/atomic: add wrapper for c11 atomics Thread-Index: AQHWKDQR7pJKhXc7F0GYBlegXTh626ikw4QAgAAR2ACAAQtYoA== Date: Wed, 13 May 2020 11:53:58 +0000 Message-ID: References: <1584407863-774-1-git-send-email-phil.yang@arm.com> <1589270586-4480-1-git-send-email-phil.yang@arm.com> <1589270586-4480-5-git-send-email-phil.yang@arm.com> <1589307606.25513.1@networkplumber.org> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.151.162] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9ede19d9-3226-4e7f-c92d-08d7f73451f9 x-ms-traffictypediagnostic: BYAPR11MB3784: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0402872DA1 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fVXzzK6+KUY+CIXWP+iHQXZoyxoM3bECmi0aJpjhBoIMGWtY7eb3S1II2pUmsT5Sxo5uKO2XPWjFSJx8zAByeDirSRbrcitWV1v/Ffpc0g7LsVqXn0IXGatdDP4oaV01fKceKJokbwnlYnzsjWqcO8wRMX2N7s2N+GQeVdOK5W8FL2v8Erj0EmimYmYgzHw3x86QvnwhuvV2D/HpMezA2CvL4W8vOVdk3nlxCCQrsWL+Js656iIcEzEpgQi9kqa/n1+mZFJSrZiR5tzdfnOKyWmKwc72/ObTItf5MGuP7lZfCvEgeNh59jXYWn7BFuIPOqCGe6ki8pDpk2VZai6NSQBUsdHicq0dk9fCxez94djd4Nqieco9HxQrsX00posUMtBgNoFS65d36u+XbJd3JyhXe4LUASz6AAZ3Py1uxd4acmiRA0cbjk16LVvnI/Fw12UcSlgjEQVWx7rrqRh0FcyXE4zYhq1dD3Dg+a7pBztmZ5qm009V/AmhSpRFKBDGoYnh/9G7HvkKQxmunWpPaOnUKGRwPE2rByF3GuObXlKkOSPHFNJHjzTqoh018jxK x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(396003)(366004)(136003)(39860400002)(376002)(346002)(33430700001)(52536014)(54906003)(66446008)(5660300002)(66556008)(7416002)(55016002)(64756008)(66946007)(66476007)(4326008)(76116006)(9686003)(478600001)(86362001)(33440700001)(26005)(2906002)(7696005)(6506007)(186003)(8936002)(110136005)(316002)(71200400001)(33656002)(53546011)(8676002)(21314003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: 9DXBD5H2C7u7Pr3y/PO7VUxBzQQP9ucBgIG2aWPgguQxwAI2fHQGLRZEGJAJ3LJnKgzn3VwF1aIKqtyHj4mDkzk/aABDuwMY0Hxweu3NtjXmgBMBK3myCEiNXvQZEdPsTAo42Vs7irKH7TQ6/lVKkvwXSyqre642LekwAqlroHq+bf5/jXRFGwEADfdW62kkAPWoMpGS+Uh3AQ/lOlXm7xP+aGX56pAhzizJsvqQDMKcsp+liPx+5D1MZjrehVps5xqVhKDONrOwqJNEUAdwnJJCiD+nSjiL6CU/mWbPJHRfpaGyIf2/bDP3m22ylHQTzIEBGvRBcEbAfPp5AhIUiIwutcrJOCfUCUJkxNzMPFzw34cJOgiMKyZfg2KittiBVjhW99OteaHRjvqEiNWU8lFjhMS7ipxRaReYb3mW9H9dedbSNJdwHzWepwW8mPvZulA+T2hO7M9336VaJqv/7wwYczzM8+JGSiBRvnFy4mzerOouKARAIg4WXsBkeiyT Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 9ede19d9-3226-4e7f-c92d-08d7f73451f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2020 11:53:58.0849 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Bw+nFNU4+nSsBwSK54Y7UvxrfDUuLIUeBu65WN5R1HLdWJBXPmMZeFS4Ar+VoPVb917BtRpsXfaW4NC1xk0ua0JdBobf4ug60ovAFRiz2vw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3784 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v4 4/4] eal/atomic: add wrapper for c11 atomics 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" > >=20 > Subject: Re: [PATCH v4 4/4] eal/atomic: add wrapper for c11 atomics >=20 > On Tue, May 12, 2020 at 4:03 pm, Phil Yang wro= te: >=20 > parameter. Signed-off-by: Phil Yang >=20 >=20 > What is the purpose of having rte_atomic at all? > Is this level of indirection really helping? > [HONNAPPA] (not sure why this email has html format, converted to text fo= rmat) > I believe you meant, why not use the __atomic_xxx built-ins directly? The= only reason for now is handling of > __atomic_thread_fence(__ATOMIC_SEQ_CST) for x86. This is equivalent to rt= e_smp_mb which has an optimized implementation for x86. > According to Konstantin, the compiler does not generate optimal code. Wra= pping that built-in alone is going to be confusing. >=20 > The wrappers also allow us to have our own implementation using inline as= sembly for compilers versions that do not support C11 atomic > built-ins. But, I do not know if there is a need to support those version= s. Few thoughts from my side about that patch: Yes, for __atomic_thread_fence(__ATOMIC_SEQ_CST) generates full 'mfence' wh= ich is quite expensive, and can be a avoided for SMP case. Though I don't see why we need to create our own wrappers for *all* __ato= mic buitins. >From my perspective it would be sufficient to just introduce few of them: rte_thread_fence_XXX (where XXX - supported memory-orders: RELEASE, ACUIQRE= , SEQ_CST, etc.). For all other __atomic built-ins I don't see any problem to use them direct= ly, without introducing any wrappers around. =20 As a side note, this patch implements rte_atomic_thread_fence() as a simple= wrapper around __atomic_thread_fence(), so concern mentioned above is not addressed.