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 35EEBA04B3; Mon, 30 Dec 2019 04:02:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 928721C0BD; Mon, 30 Dec 2019 04:02:49 +0100 (CET) Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120071.outbound.protection.outlook.com [40.107.12.71]) by dpdk.org (Postfix) with ESMTP id 014751C0B9 for ; Mon, 30 Dec 2019 04:02:47 +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=OAY1ec+9TM4mj6HX8mSmpHAsmrPhuFJ9Yf4wej8hYZQ=; b=ucIUWxNSGrhHrGMaR57jEFS3Ho4/7hkYt6x1P6JjAfBA+zN3HzVghwf8YZKWyulBFPrj3Gn7HSbp905Vy7PU0HvVIMuJSo3eH3LZuLWqy+Ev1by+XwWlGmGlIYeXJxOGZ8gbXnKgvKTDXaia8BQsLsT3slHEG/oT+ZqHn+P2Hog= Received: from AM4PR08CA0074.eurprd08.prod.outlook.com (2603:10a6:205:2::45) by PR2PR08MB4779.eurprd08.prod.outlook.com (2603:10a6:101:1e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12; Mon, 30 Dec 2019 03:02:46 +0000 Received: from AM5EUR03FT030.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::203) by AM4PR08CA0074.outlook.office365.com (2603:10a6:205:2::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Mon, 30 Dec 2019 03:02:46 +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 AM5EUR03FT030.mail.protection.outlook.com (10.152.16.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.11 via Frontend Transport; Mon, 30 Dec 2019 03:02:46 +0000 Received: ("Tessian outbound e09e55c05044:v40"); Mon, 30 Dec 2019 03:02:46 +0000 X-CR-MTA-TID: 64aa7808 Received: from c94c866d594b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BE539C0A-66B2-4289-B0E9-AEE8F0DAFC05.1; Mon, 30 Dec 2019 03:02:40 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c94c866d594b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 30 Dec 2019 03:02:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DzK/EjIOEvYJoy+SKwEy7R6rhsouWTMDrLIXs8Ptw35Hbb5pgVSOKAKCQa61KGdpK135OW1f4WPTR/x0MLPPT74uqq0k/XBTOx1hM39UPr7/frQymyWxpzkolp8SWVsOLX95114dHU5z1/qpRYcZ6uxgl+V5PL3yd49Ta0UOP4o68lcnlvZ/e0GFEsgBwMVvQts3i41votFwjAsRWDvJMoK9LClXOtFZ16+ZyZZhNKQDGpWnXszVsVDtpbPu4lXhgDNRHTmO5tzehkv7WZ4H/48Uez3dbxTmKCJELgMIgok2bvEptBZfs9ZzuC07+GCc2VdgSbPENHKjri6tA2LQnQ== 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=OAY1ec+9TM4mj6HX8mSmpHAsmrPhuFJ9Yf4wej8hYZQ=; b=j9lQgjeYdBxUFwWHN+C1zRrJ7BbQ0tIMDaY9Zs8o6wr55CAfVsZass9a+rUgukIW/cDJs0V/z/cFnMbeOw2HaV8dPPKk6/b0KUAb+4BmjVgccezsorgxB3Jk4IeCkYnFCFaVxddFrfwlT6NmsbeSmItAAGzcxJ8ccED4fbgmYsRvzDCgeiLNEPJ3Ywf568ByEJqsZefY5X4DmJWj/ZPOkpZamu07SInFSEKvXT2SzBAHVkOt4k4R/mr40Nh1bLryZAixGj/5IxN3G3OvoARqzDg3T4oiG4nlxnOKYmp4qNb0mKLet0mHXQ/qKzLZT3lxQl+7UL30U7eaPP5cS91hyQ== 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=OAY1ec+9TM4mj6HX8mSmpHAsmrPhuFJ9Yf4wej8hYZQ=; b=ucIUWxNSGrhHrGMaR57jEFS3Ho4/7hkYt6x1P6JjAfBA+zN3HzVghwf8YZKWyulBFPrj3Gn7HSbp905Vy7PU0HvVIMuJSo3eH3LZuLWqy+Ev1by+XwWlGmGlIYeXJxOGZ8gbXnKgvKTDXaia8BQsLsT3slHEG/oT+ZqHn+P2Hog= Received: from VI1PR08MB5376.eurprd08.prod.outlook.com (10.255.196.79) by VI1PR08MB4415.eurprd08.prod.outlook.com (20.179.26.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12; Mon, 30 Dec 2019 03:02:37 +0000 Received: from VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::dde8:216f:6a0b:8cfb]) by VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::dde8:216f:6a0b:8cfb%7]) with mapi id 15.20.2581.007; Mon, 30 Dec 2019 03:02:37 +0000 From: Gavin Hu To: Stephen Hemminger , Honnappa Nagarahalli CC: 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" , nd Thread-Topic: [PATCH v6 1/6] lib/eal: implement the family of rte bit operation APIs Thread-Index: AQHVtWiBonRK2cDGV0OJsEiY9OXtDqfCmT+AgAItZYCAACGqAIACSbUAgADBfgCAChkZsA== Date: Mon, 30 Dec 2019 03:02:37 +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> In-Reply-To: <20191223083644.4de8e184@hermes.lan> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 118f129c-1f2a-47a4-9af0-0ee686d50900.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8e0c1e8b-5f9a-443d-2d9d-08d78cd4bf2b X-MS-TrafficTypeDiagnostic: VI1PR08MB4415:|VI1PR08MB4415:|PR2PR08MB4779: 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:7219;OLM:7219; x-forefront-prvs: 0267E514F9 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(39850400004)(396003)(346002)(376002)(366004)(136003)(199004)(189003)(13464003)(45080400002)(8676002)(55016002)(8936002)(54906003)(2906002)(6636002)(110136005)(316002)(81156014)(4326008)(33656002)(9686003)(81166006)(7416002)(52536014)(86362001)(5660300002)(26005)(71200400001)(64756008)(6506007)(186003)(7696005)(478600001)(66476007)(53546011)(66946007)(55236004)(66556008)(76116006)(966005)(66446008); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB4415; H:VI1PR08MB5376.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-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: M/1i+a3gAC2pgl58/JtVto59jq8LRBfKhjC2n7zA+RTmYONxNsEX62lukOF1yqIok2KkWxewfCKh61aDt5weEXIhjs/XKmPaZmBHbqgztHmBIuAnRmNprAhEUj17hBzik5yPOtB9OH0io4EXFEU9udoeequ7+wtO27ualIgHsZnZ3qQmf7KSaw/Am6BUTqs/soyzoKozKickae5l29W1fe3jzm6i96vJNySprZ/1nArkCaVvPbCqQUi2oBiZ5cmbVMSR+ADcLg+l1lAENodrGF9kuosz/Nc9m3SWNpN9WwTOIeaVyybQqcrnctFUPmIFFnkcbUjwZ6BD0WCBkzfXtwQFI4RtmTteRA0Sb/6YcBOaWC4jp7zOB3ojpv5YyIvSoaUaSVuhXE/qOwZXqhvkE8PD4Yr12zA//TPPsUf+cdH9BamPErirzD4CaD6cY4JPVQ3bxTmC8SDzdw4norSQYMmHA08bWuYc0aNzTMpUAz8J5ZE9fxpYLkyF+v+go0RA Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4415 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT030.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)(346002)(376002)(136003)(39850400004)(396003)(13464003)(199004)(189003)(7696005)(54906003)(5660300002)(70586007)(36906005)(26005)(6636002)(966005)(76130400001)(52536014)(6506007)(70206006)(110136005)(336012)(316002)(186003)(356004)(2906002)(478600001)(33656002)(8936002)(53546011)(86362001)(55016002)(45080400002)(8676002)(4326008)(81156014)(26826003)(81166006)(9686003); DIR:OUT; SFP:1101; SCL:1; SRVR:PR2PR08MB4779; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 78aedde0-1183-4d26-a555-08d78cd4b9a3 NoDisclaimer: True X-Forefront-PRVS: 0267E514F9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ph7PhoCOdM7VkKuGbZGN0YIM5cgMuKxdjsvBlbaUVsSgsEhPEXdm45Eb2u747j1E/X7iyXUWXpHPBaC+QpUeZsVSKqbyNftVpon0JhZXdTHZOovYRoY4hPLDbwBVSiYlQmW2ptWT9QV3iuSAtXhHyw2wEvuki/563tylTcvhUyNxyhIghFmuRhEE+/Wr0mMv38NJuW5xTcQHmlAr7VJpkhxuXmlOy3j7vUWkaZ7b89EkPz853vQKR0VjrmHJ7tzfE3JgBoWJj2NJr6vphCWb4q2hLiCRbTQaclvOsVxxtm6CgLzuUso4l7Avzwlv9HPN5/mWDvACG1eFD7ab64P3l1aIIiyCxewVuGPxHV0HX6c9ss1HVkV6XDj5p17Gjqq5SLGRdYK9ljWkDjRh4lW8MdcI1qmb7OoXBhjuYybwtyfZgUaQ8oZvPsfuBrCWoCaTH3TDTDS8wugEG3wRyt82okQX0AvOkUw/fsRfVe0lcPKnZGedC9AtFUdven3Ebd47 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2019 03:02:46.3647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e0c1e8b-5f9a-443d-2d9d-08d78cd4bf2b 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: PR2PR08MB4779 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" Hi Stephen, Honnappa, > -----Original Message----- > From: Stephen Hemminger > Sent: Tuesday, December 24, 2019 12:37 AM > To: Honnappa Nagarahalli > Cc: 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 > ; Gavin Hu ; nd ; > dev@dpdk.org > Subject: Re: [PATCH v6 1/6] lib/eal: implement the family of rte bit oper= ation > APIs >=20 > On Mon, 23 Dec 2019 05:04:12 +0000 > Honnappa Nagarahalli wrote: >=20 > > > > > > > > > > On Sat, 21 Dec 2019 16:07:23 +0000 > > > Honnappa Nagarahalli wrote: > > > > > > > Converting these into macros will help remove the size based duplic= ation > 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 he= ader > 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. >=20 > Why do we have to wrap every C atomic builtin? What value is there in tha= t? The wrapping is aimed to reduce code duplication, on average 3 lines cut do= wn to 1 line for a single core. Overall I am thinking this bitops APIs are targeted for use by PMDs only, a= pplications can use C11 freely. The initial thought for the new APIs came from the idea of consolidating th= e scattered bit operations all over the PMDs. It is unwise to expanding to = applications or libraries, as different memory orderings are required and c= omplexity generate.=20 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 half.=20 http://inbox.dpdk.org/dev/VI1PR08MB53766C30B5CDA00FB9FCE9678F2E0@VI1PR08MB5= 376.eurprd08.prod.outlook.com/ Any thoughts and comments are welcome!