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 A056FA04F6; Tue, 7 Jan 2020 05:41:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB1B91D8F7; Tue, 7 Jan 2020 05:41:18 +0100 (CET) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30068.outbound.protection.outlook.com [40.107.3.68]) by dpdk.org (Postfix) with ESMTP id BB7EF1D8F1 for ; Tue, 7 Jan 2020 05:41:16 +0100 (CET) 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=E/0avGZQJacwuEAN1IZK9zumJ0hKZK5gYg6hgNQGZCc=; b=S3xyGm7OzNGHfJeJqs9tlZh4kndcspIn7gwc6HBLU5TB/Y0SaOvrbrRat9t49seKRjZqOD0npvB8yvCEVoIXYrj/N0/vhKN2CNSK9cZa+doPNQrw3Jjx/Kz9Ng5TyDitk3hrBO6KlDeIwg7xD3wBXaJ4SUqhE6kN2Mw4pY6QX+8= Received: from VI1PR0802CA0020.eurprd08.prod.outlook.com (2603:10a6:800:aa::30) by AM6PR08MB4501.eurprd08.prod.outlook.com (2603:10a6:20b:b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10; Tue, 7 Jan 2020 04:41:14 +0000 Received: from DB5EUR03FT025.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::204) by VI1PR0802CA0020.outlook.office365.com (2603:10a6:800:aa::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.12 via Frontend Transport; Tue, 7 Jan 2020 04:41:14 +0000 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=bestguesspass 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 DB5EUR03FT025.mail.protection.outlook.com (10.152.20.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Tue, 7 Jan 2020 04:41:14 +0000 Received: ("Tessian outbound ba41a0333779:v40"); Tue, 07 Jan 2020 04:41:14 +0000 X-CR-MTA-TID: 64aa7808 Received: from 9dbcbc568e6f.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6BD612D4-643F-420D-A70F-428B7385DD8B.1; Tue, 07 Jan 2020 04:41:09 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9dbcbc568e6f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 07 Jan 2020 04:41:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aP6ZUr89LfDyMxHl6f1Tu3Y5Fm02RRTd5rDvITomEBGqn3HeN65KieWAiksy5xlPqbcVZHODjJ9qXGfQMEgD1pn/Vdj722WyoMiz29lj7ISbamI3YQIIUsMWOeRW2A8MB8jq+dWFzHS8gCEyv6LZrJejSaQgheyGu4v6Yuz6fOEIlAEWnc+4WXjEI0woM0AtqKbAl5Egf+JJVIaGdrWEkGkG2DqahnhiFqHUTRI0XP0K1X18KVk8L2H7ReJYHmWw0R56Dg4kW6hwi7RzzaCIf50ZikTPnurQZzEW+u0+24Aixhq0z6gRmTl76iBcuG/djlOwXIcwdZ+AEBIhM7ZJWw== 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=E/0avGZQJacwuEAN1IZK9zumJ0hKZK5gYg6hgNQGZCc=; b=DYbXaHKQn7t3YYB6YUiusp+q0/U+KemAniO+t3KPvTro1PoU6Z7qdbRJzENWpcAD7gUmm4g29TfLmwO7VD3/N6OvEYimN0eT92aDT06TlUfLWxiTt4tdctQmsiFf2D44ObL1ToeHgyR8QgUUDD2oOZMTu9o4moA+HItg792FvCks3mmoUgv31yZ98qK0JZOpciaJ8R/5+Vj7Lxqa7FB4Jf7SJN7D/QVzgTt1RO4VWxsmqxzJuWS5ynfwgU7wAE4nQneeWcUptQJA2uQqpl2p0kcnHz75kJIx47ALE+JnWzbSdIMaBnAIM9OF/2kOUys3w3tPrmdQ5W3o1QADxBSdYw== 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=E/0avGZQJacwuEAN1IZK9zumJ0hKZK5gYg6hgNQGZCc=; b=S3xyGm7OzNGHfJeJqs9tlZh4kndcspIn7gwc6HBLU5TB/Y0SaOvrbrRat9t49seKRjZqOD0npvB8yvCEVoIXYrj/N0/vhKN2CNSK9cZa+doPNQrw3Jjx/Kz9Ng5TyDitk3hrBO6KlDeIwg7xD3wBXaJ4SUqhE6kN2Mw4pY6QX+8= Received: from VE1PR08MB5149.eurprd08.prod.outlook.com (20.179.30.27) by VE1PR08MB5279.eurprd08.prod.outlook.com (20.179.29.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10; Tue, 7 Jan 2020 04:41:07 +0000 Received: from VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::29eb:a1be:8f8f:fae2]) by VE1PR08MB5149.eurprd08.prod.outlook.com ([fe80::29eb:a1be:8f8f:fae2%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 04:41:07 +0000 From: Honnappa Nagarahalli To: Stephen Hemminger CC: Gavin Hu , Joyce Kong , "thomas@monjalon.net" , "david.marchand@redhat.com" , "mb@smartsharesystems.com" , "jerinj@marvell.com" , "bruce.richardson@intel.com" , "ravi1.kumar@amd.com" , "rmody@marvell.com" , "shshaikh@marvell.com" , "xuanziyang2@huawei.com" , "cloud.wangxiaoyun@huawei.com" , "zhouguoyang@huawei.com" , Phil Yang , nd , "dev@dpdk.org" , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v6 1/6] lib/eal: implement the family of rte bit operation APIs Thread-Index: AQHVtWiBQ1n0Dk5tDEKroTViQBZDeKfCfMMAgAJBDyCAACp8AIACRrEggADEggCAChzcgIAMZtQwgAAQ1YCAADWZIA== Date: Tue, 7 Jan 2020 04:41:06 +0000 Message-ID: References: <1571125801-45773-1-git-send-email-joyce.kong@arm.com> <1576648808-24765-2-git-send-email-joyce.kong@arm.com> <20191221100752.04838f7a@hermes.lan> <20191223083644.4de8e184@hermes.lan> <20200106172601.71750b85@hermes.lan> In-Reply-To: <20200106172601.71750b85@hermes.lan> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: eb4a0e73-fff1-4413-86f4-28a9e0fc8937.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: eeab7390-4bdc-4e56-6dae-08d7932bd40a X-MS-TrafficTypeDiagnostic: VE1PR08MB5279:|VE1PR08MB5279:|AM6PR08MB4501: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:9508;OLM:9508; x-forefront-prvs: 027578BB13 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(396003)(346002)(136003)(366004)(376002)(189003)(199004)(6506007)(5660300002)(52536014)(8936002)(8676002)(81156014)(7696005)(81166006)(966005)(26005)(4326008)(478600001)(45080400002)(64756008)(66556008)(66446008)(66476007)(316002)(54906003)(7416002)(66946007)(76116006)(2906002)(86362001)(186003)(33656002)(71200400001)(55016002)(6916009)(9686003)(533714002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5279; H:VE1PR08MB5149.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LKlB4noqiUvYWC4RUdRTZpSCl3dNFqIZp9shGhbOjjK9RXZz3Gx7rw6haIhEKyKKJlFFUBuUmwdxASuZGmc1RE+czvZrw+DltqPkqYJ7ZDVtbRfbM14FJ1Lk3nkeS4wA22fX/i3zqZ7X1Ty18WxbFD8L1QuVaOM4lHjq2H+mcv/ojYRJlk2+f3JcnDYOvIrUQ1ildl8ijmTTN5znb4Y+zKWL2urHpyic3LI839U1Br6KBvZ74Avcep9OUk+Rlzv+CiIWF5jqqMRXLcaj5qlimD/r0u7oafWA1B8HBR4E4w/sxZjqIKDd7MEvRVI27Rd0wRLv6BWEkVUwKoNlcn90Wcnw5fbp9I5rXB8SiBOHlWrxayB05n/Giw4y02wpR8aJjOxE41Jasas0o9RK54xw8o9e8loWO632d6o0KVeUA7FPUlkkSbuUTJUx49z7xPkm1if/OVjsYZwRbUVY1AWzd9e3Gy4BmdWlKQ+XwdK3pRxFNMp6wPh6MGp+stuKfxz5L86GO3G6rzWzKMCilMetWHe2ar/FJGWdCAi1+6grxyw6tS712Rrdt09l+ItIelsg Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5279 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT025.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(396003)(346002)(39860400002)(376002)(189003)(199004)(7696005)(81166006)(81156014)(45080400002)(33656002)(186003)(336012)(8676002)(9686003)(4326008)(6506007)(8936002)(6862004)(55016002)(2906002)(26826003)(478600001)(26005)(70206006)(356004)(70586007)(86362001)(52536014)(5660300002)(966005)(316002)(54906003)(533714002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB4501; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: f6f0b267-08c5-46e0-be6a-08d7932bcf96 NoDisclaimer: True X-Forefront-PRVS: 027578BB13 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dRz4e9nWcUCBMS96bPanLFVPnPzqZoqsbeAtUwTecSBIP4WCStwang/YbA9MNtMMyvZNpetCXYhayYIJy4xI9Wz/dfNUrgwKHEL3i545XRbBRd4wvCjS7I4/CMaa+/K9Bi2sa8LcUi3L+Tc9t7j9xdWymyCm4TR7AaBH7sb2d2WZOy4jFl1l8TwGP0H4Bq8e16a+1GKQeTU/G4QmFBYDN9GGyLroPnWsXUd5P1Q89Jr/tPJUh1w2kaiwIPLP8NdJRxDh6wf55meMhSugw5wUolb/nx6JwwVpGabv0pkfa7C/+rTVYtA6L6ipXrW6RxFWh3QJzLKwTC4LtzLuEofyI0NMn6aan6NI9gVZmJBOTEMYq/+PbpzBjMwPqLhvIu1Twl2nAtgSpQfID8boRDDfCshGiwoJrLPIw7iv6YDusWT+k4MoX1gjUyq80P2htdVlxQdUwdxzsb7Dbg/8Ocb6Fo1ewVhNPQYFNiEqblV8bFFATOhToW7hIW5WZr0mmtv099hxNGHQvS9LTlydbSc9C7woM03nD4rRAXyu2TRqTIGFRSql/l/Z2VFX4sX0og3b X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2020 04:41:14.5703 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eeab7390-4bdc-4e56-6dae-08d7932bd40a 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4501 Subject: Re: [dpdk-dev] [PATCH v6 1/6] lib/eal: implement the family of rte bit operation APIs 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" > > > > > > > > > > > > > > > > > > > On Sat, 21 Dec 2019 16:07:23 +0000 Honnappa Nagarahalli > > > > > > wrote: > > > > > > > > > > > > > Converting these into macros will help remove the size based > > > > > > > duplication > > > > of > > > > > > APIs. I came up with the following macro: > > > > > > > > > > > > > > #define RTE_GET_BIT(nr, var, ret, memorder) \ ({ \ > > > > > > > if (sizeof(var) =3D=3D sizeof(uint32_t)) { \ > > > > > > > uint32_t mask1 =3D 1U << (nr)%32; \ > > > > > > > ret =3D __atomic_load_n(&var, (memorder)) & mask1;\ > > > > > > > } \ > > > > > > > else {\ > > > > > > > uint64_t mask2 =3D 1UL << (nr)%64;\ > > > > > > > ret =3D __atomic_load_n(&var, (memorder)) & mask2;\ > > > > > > > } \ > > > > > > > }) > > > > > > > > > > > > Macros are more error prone. Especially because this is in > > > > > > exposed header > > > > file > > > > > That's another question I have. Why do we need to have these > > > > > APIs in a > > > > public header file? These will add to the ABI burden as well. > > > > These APIs should be in a common-but-not-public header file. I am > > > > also not sure how helpful these APIs are for applications as these > > > > APIs seem to have considered requirements only from the PMDs. > > > > > > > > Why do we have to wrap every C atomic builtin? What value is there = in > that? > > > > > > The wrapping is aimed to reduce code duplication, on average 3 lines > > > cut down to 1 line for a single core. > > > Overall I am thinking this bitops APIs are targeted for use by PMDs > > > only, applications can use C11 freely. > > > The initial thought for the new APIs came from the idea of > > > consolidating the scattered bit operations all over the PMDs. It is > > > unwise to expanding to applications or libraries, as different > > > memory orderings are required and complexity generate. > > > > > > If the use cases are limited to PMDs, a 'volatile' or a compiler > > > barrier is sufficient therefore the number of APIs can be saved by ha= lf. > > > > http://inbox.dpdk.org/dev/VI1PR08MB53766C30B5CDA00FB9FCE9678F2E0 > > > @VI1PR08MB5376.eurprd08.prod.outlook.com/ > > > > > > Any thoughts and comments are welcome! > > I would prefer that the APIs/Macros just address PMD's requirements. > These also should be kept private (through naming conventions?). Given th= at > the current PMDs are not using C11, we can skip using C11 atomics in thes= e > APIs. >=20 > Not in favor, just use existing Gcc/clang/icc atomics instead of creating > unnecessary bloat wrappers. I thought, you blessed this patch [1].=20 [1] http://mails.dpdk.org/archives/dev/2019-October/147297.html