From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by sourceware.org (Postfix) with ESMTPS id CED02384A02B for ; Mon, 28 Jun 2021 10:12:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CED02384A02B Received: from AM7PR02CA0022.eurprd02.prod.outlook.com (2603:10a6:20b:100::32) by AS8PR08MB6948.eurprd08.prod.outlook.com (2603:10a6:20b:347::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Mon, 28 Jun 2021 10:12:01 +0000 Received: from VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:100:cafe::a4) by AM7PR02CA0022.outlook.office365.com (2603:10a6:20b:100::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Mon, 28 Jun 2021 10:12:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.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 VE1EUR03FT005.mail.protection.outlook.com (10.152.18.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Mon, 28 Jun 2021 10:12:01 +0000 Received: ("Tessian outbound e0fcff857b11:v97"); Mon, 28 Jun 2021 10:12:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f01ed4bab541a970 X-CR-MTA-TID: 64aa7808 Received: from 655ec101ecf6.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 49CD1CE2-52A5-4A8F-B577-9BECF02A3A51.1; Mon, 28 Jun 2021 10:11:30 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 655ec101ecf6.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 28 Jun 2021 10:11:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UxY7FtSMMbJIhN+O8TGh7R1ghAbRbN6KDzIipxBygWSoKXIIoV968sTTAZ8WEkJJCBY737gW9k2RwxwQq1qKcdOdrgydSB2RIGf7pEDzAJC902GQVcidlj+Zv874P5t8p6u0JoQ3+NdJ5L4CoAh/oAmFIH7VfW1fyBfRsBPHoOjJOZPFAFstf/LD/deFXoDlkDDbVZdbq74g0Ek/UrXfefCG9eiIKXwSNOwhBe4taRv76IeI4nN5eDlFDxWGdSd8hjfK8OOe9u145cWc36rV00b5cryisV71esG4O3UQ8n8N6KnQcHJ6aStFRgmlqvrSRxIojfEVwqpu8IJznDsHVg== 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=4bTOZxpP5OInDQoW7rnWy39v13plk9ST5nlY+/IFKec=; b=L1r2pqkbRZSHkTe33Rt9wa7jJf6JzzarJ+7NLA05breZAJPohFjqv/GoV3gDW8w2S4fwjckBtMQ/Fh2wn+A1DCEu4yvvTTSclvCmgHQPESbtE2x+PIWKcro/Rru9QS+svrPY90sTAq85fflkO2fgBidXnSq7EtHT5/6YmdTm6T2tsN9KdibwaBCQQ8Gc7QEPbs6gj0A21CaALDltdt1EcK+9aOCr/4g1/twc6m4aZ5OyP+i7VwTgSSN8isLQ74Ed8jV6oEqRWecABc3pSLAXODz8Nfo2SlVE2QwJWVjpYTtV3DlvYArU2U6ewYqWEIK8gmCwhAkLmFX5Jf3nAjUqrg== 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 Received: from VE1PR08MB5599.eurprd08.prod.outlook.com (2603:10a6:800:1a1::12) by VI1PR08MB4463.eurprd08.prod.outlook.com (2603:10a6:803:101::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.22; Mon, 28 Jun 2021 10:11:28 +0000 Received: from VE1PR08MB5599.eurprd08.prod.outlook.com ([fe80::8c25:b5e8:b9be:13ac]) by VE1PR08MB5599.eurprd08.prod.outlook.com ([fe80::8c25:b5e8:b9be:13ac%5]) with mapi id 15.20.4242.023; Mon, 28 Jun 2021 10:11:28 +0000 From: Wilco Dijkstra To: 'GNU C Library' CC: Szabolcs Nagy Subject: [PATCH] AArch64: Add hp-timing.h Thread-Topic: [PATCH] AArch64: Add hp-timing.h Thread-Index: AQHXbAWY9l2T1LdHsES2JDT34KltXw== Date: Mon, 28 Jun 2021 10:11:28 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; x-originating-ip: [82.24.249.100] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 36cf4c38-f05d-487e-eda3-08d93a1d2bf2 x-ms-traffictypediagnostic: VI1PR08MB4463:|AS8PR08MB6948: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:3513;OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: JFqGxS5YJuBnlmHF9Ngtp8SEBI8xRPoBRK7yzbTuug2RPgBLrbigOQxKhniNVYiWCNI/WqJYiPIyluUucnwfNEihZJQF9MQuIdTvadSOD9eIxIRLtBuJpG+R7h/cB20XVpCtD0quhmZ+d7EHgbsbfMmp9FFggMk7g05EpoSsZIynfeOPCjxDLAjoWGuhw2tMVSA5ZkcHszNvITwPcUxIIJMqpRuC9RphCtzemXWVGWwHA4uAWk3QLaAptbUqYS3RBmBL5bPlh/3qdYdZbgzhTfQ0aZ+NiJrGWz76lDGsUcKsgFV9V8U/Q7zcJTdh80AOZJRQnl46r4J+F6zakj+WByqUFaZ9Y9UmBAeE3sNzmPyUdv19h+Dy4H0FtqC3vAqmM+1XU12zQu42Pc6mUGWOBqnshM/I0eUCX/upYoG40oFpP7pHYN2kWbhCRChIOrq2CZ+r6hYxr7xlLOGlK5ts/MB4POYkSrabddd2/HesB5Uc2gHJ0BWl0FCRE2Ioq8EyV1hlQpuTspvMYyw0GxWaa4QrjipcKT8HmuF6DJJFV8TjwOYcmBvDV6FJ4qajiwu83d/4Tv8fOk8Jc3vlmpiOKxleAVZb7U8fxnrvsvo9sS+mKShx+apFtTCRyjFYOa82/p2tk+kz44fGAuYy7WB3gQjYITibjCXHDR9DEdkZxOohrr2h/uADgd80JdLBud4Nkb9q/5fwP6BOyryUMZ6jBipEihLpuBxyZglsWJB7o3nlIYbnr4Fvmq0K4e+EGhTUFhwiT5SIN9DSAP3Z2X6jPg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB5599.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(39860400002)(136003)(366004)(376002)(396003)(122000001)(38100700002)(66446008)(52536014)(6506007)(5660300002)(66556008)(64756008)(86362001)(76116006)(66946007)(91956017)(316002)(66476007)(6916009)(186003)(26005)(7696005)(4326008)(71200400001)(478600001)(9686003)(2906002)(33656002)(55016002)(8676002)(8936002)(2004002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?gYhKZjqELA0rANukG15i/MNUh9KhEoZeYjc18ZeGRXArr5+2Rggl1IgtYW?= =?iso-8859-1?Q?uL1sIWdIXEXNReQXRX+9/xqproBvlQtJsUIqXU2LlkCzvG/MrEKfB5f5K+?= =?iso-8859-1?Q?n5otoobODxPABXrEjivb2G4wZuDlVw5d/hfvrPHPOOehkR6ZpEi8GGmWRv?= =?iso-8859-1?Q?ff4mE7ZEjvu38INTUUSwHwhMJdUIJFvpYymD+/LvBvVy4+rEmp1CEW6+Yc?= =?iso-8859-1?Q?zBt8vzynCkF7WgRFrNisQ4fQMHpTL0PoFwJRr/en2q1yfZjQWKHatY5lrC?= =?iso-8859-1?Q?BGPnelA12DfrWdrqRSKqCfVJxt043r9XcK8LYvTZ/Zanmsw56K5nSduEQq?= =?iso-8859-1?Q?spg622E4BA28Jfk2gQ52jizQ6AG0mYxPfSnDFvNn8YMUDbSUf4r966hjuO?= =?iso-8859-1?Q?3psPKeqxgicJaW+ykCqySLwtm13E4PH+kfAooFZUpbkNZAs3IqB6Fi1mgL?= =?iso-8859-1?Q?MFGGu8gJF4Pb3hP6SOzhGt2AaEEyk7DPjLXzK8Xcv1TnoAKWcvFNdfknP6?= =?iso-8859-1?Q?yPTzBtvQCqNi7cJb299Goo22Izhj5SSaWvGES5pg16XFDHmUsPl5QlvPRx?= =?iso-8859-1?Q?X7dAcdiQurmDeq8nQ5XRcmzDReYVxLAJKQjgduu6F1IxQ3X45O3FvPhFwI?= =?iso-8859-1?Q?GLc4hW7tpN3ldoftpeQaEn3957JVJ8QLZ/k8kUa3nanN6jJ0TdwGItmuqR?= =?iso-8859-1?Q?hzF2/hZBuB1z9hCDGOkuVwzrTHWTAEwRIYHI8u1Pm3asqvKAD2qTcEXeu+?= =?iso-8859-1?Q?Jmsdl40v1JiX/81rxjJXLLOSm5TwidJX7i9dAeacmI51svdcFSjSrBgM2X?= =?iso-8859-1?Q?3uPeUwqN8U/FLGKeJVdkCpW9BmuvDOI7d6xDnm3Is8ENr6m1mO4aIA4lQG?= =?iso-8859-1?Q?SD4H53Y1T6Mg2Kv/2xnq1QTNJ8ShPHCMvp0ZspW3aC7JD3lYQ28eeTdOTN?= =?iso-8859-1?Q?yW2xv/vGp7bFQ7P0PwYyxy0XFZfjn6xTmlZ1NQ5aagnoy6gBF+FRzlIFNF?= =?iso-8859-1?Q?l2e+jq7mbbH0zJVuPuga5Lt0fTZaBOUxbiywdYrl+oTVokb0C1vJRsxs/i?= =?iso-8859-1?Q?fuwZ7FibaKXxERNWIWxX6yynOOZO62VS2Y2AYgUsCtE4D3/RAI80x4kIVs?= =?iso-8859-1?Q?HpcQiuIMbP6FWEFXySXvuWbsndDhoE28V9ndhxekiJTGXuZCnDSZq7Jjog?= =?iso-8859-1?Q?Pb1QCJ5DvYTLcqP2cHwabUd1fSnFnvW7wZLNstTu/mo7gdSUqAZ2jF7lWe?= =?iso-8859-1?Q?o3rYAo3d62rdIYdkDBwXDlZY9MK7MbcEMVswDMvPfwRI6Rl94Mu+156Mik?= =?iso-8859-1?Q?CAvObLj/u4vijz8RdFWn2h2agZK4FXaSodkLdHgS6nNYM7A=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4463 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: d1356580-bd0d-4ca1-3b1b-08d93a1d181d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ktQXcYBUhmTG5blK4NuGt3z7VIvDWppj7yTm27Zqr6m4RXz48F6R2vhDbAW1P8F8+cqN63pYyZtSLpCKoBHMxkXP8MCvH28LVm7TA6GFGxcrMsQJwjFeGA4LgWZ+bF4RkCmdTUgxSN16joLkooygeRxg5NgdPXfATEkws6LLkavtZCkBAKkJthJrYo6rWf6a/s3dacNU3sY2g1nfaumh3VA300jf07H0ziK/HPzl9Rgh+XOskfS/flLjGB2wsIJGtOX78R3k447NBaJIxQPo8Q0CTR2HYwch8ZMDub4jTNnKQFqxq+lKf0K1BJsBgWlU9mOqGAevg6DtnykKYQVrB8N7/xoBAI1jPGov1Gz8TUuwFHdtYp/qBFyAf0yYK+Yd3VdoDpbDN/nPX4VH1rsaNo9KDmBu6ixef2/6/gvxFpfo17CafzFxpyPslMu2XkzQESRv/ClOKtNTRlJkyUXdPPrjVa+7+/7zx8O1IgSfzUBDj/9G0R55KZQDrGqijk4AWcZRf12omzXz+ms0G6XUD57kNIFQhAeeTLzTxAkiN7cPBpWePAWAVJ3RT6LjASf+IWS+ryN8McPIW9wvlhfzO7j11ibGY02d7RBSpu0GdNtuyov8+7gyCbGKqWffb2ZX91lDrwpAyHMv1oNaJ19QEcr15tI5YBE+cbaB7ZUOdqO+7r0AUgq4tmtMlwYOKg6nwsoEM3V/EB8fJWpHSrp9alkPJUL38LMHm7Ba0A+a4/FbdvelNSn6L3TacPBmtgfpHnKO2b5oLwS/WiFMWPncUU6t7NlPRpaTG7fzbFKKFPoVNRTYNUHEk8offqBqi2HalWz/52gIkIuoxnUhQn1Qkg== 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)(376002)(39860400002)(346002)(396003)(36840700001)(46966006)(33656002)(82310400003)(478600001)(9686003)(6916009)(36860700001)(55016002)(6506007)(52536014)(7696005)(8936002)(316002)(70206006)(70586007)(356005)(82740400003)(26005)(81166007)(186003)(86362001)(336012)(2906002)(4326008)(5660300002)(8676002)(47076005)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2021 10:12:01.4239 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36cf4c38-f05d-487e-eda3-08d93a1d2bf2 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: VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6948 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2021 10:12:06 -0000 Add hp-timing.h using the cntcvt_el0 counter. Return timing in nanoseconds= =0A= so it is fully compatible with generic hp-timing. Don't set HP_TIMING_INLIN= E=0A= in the dynamic linker since very old kernels may not handle cntcvt correctl= y.=0A= =0A= ---=0A= =0A= diff --git a/sysdeps/aarch64/hp-timing.h b/sysdeps/aarch64/hp-timing.h=0A= new file mode 100644=0A= index 0000000000000000000000000000000000000000..f9822e725c227b3b57d508dc7d4= 4cd7d2d04faf4=0A= --- /dev/null=0A= +++ b/sysdeps/aarch64/hp-timing.h=0A= @@ -0,0 +1,47 @@=0A= +/* High precision, low overhead timing functions. AArch64 version.=0A= + Copyright (C) 2021 Free Software Foundation, Inc.=0A= + This file is part of the GNU C Library.=0A= +=0A= + The GNU C Library is free software; you can redistribute it and/or=0A= + modify it under the terms of the GNU Lesser General Public=0A= + License as published by the Free Software Foundation; either=0A= + version 2.1 of the License, or (at your option) any later version.=0A= +=0A= + The GNU C Library is distributed in the hope that it will be useful,=0A= + but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= + Lesser General Public License for more details.=0A= +=0A= + You should have received a copy of the GNU Lesser General Public=0A= + License along with the GNU C Library; if not, see=0A= + . */=0A= +=0A= +#ifndef _HP_TIMING_H=0A= +#define _HP_TIMING_H 1=0A= +=0A= +#include =0A= +#include =0A= +#include =0A= +#include =0A= +=0A= +/* Don't use inline timer in ld.so. */=0A= +#if IS_IN(rtld)=0A= +# define HP_TIMING_INLINE (0)=0A= +#else=0A= +# define HP_TIMING_INLINE (1)=0A= +#endif=0A= +=0A= +typedef uint64_t hp_timing_t;=0A= +=0A= +#define HP_TIMING_NOW(var) \=0A= + __asm__ __volatile__ ("isb; mrs %0, cntvct_el0" : "=3Dr" (var))=0A= +=0A= +/* Compute elapsed time in nanoseconds. */=0A= +#undef HP_TIMING_DIFF=0A= +#define HP_TIMING_DIFF(Diff, Start, End) \=0A= +({ hp_timing_t freq; \=0A= + __asm__ __volatile__ ("mrs %0, cntfrq_el0" : "=3Dr" (freq)); \=0A= + (Diff) =3D ((End) - (Start)) * (UINT64_C(1000000000) / freq); \=0A= +})=0A= +=0A= +#endif /* hp-timing.h */=0A=