From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1895) id DBF013858D33; Wed, 22 Feb 2023 17:17:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBF013858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677086255; bh=vobJBAwpP3kW3eHpdGfNdh/DT+X/FOp/qf6DS4IXzfk=; h=From:To:Subject:Date:From; b=p8QcSltbGqcPnTUkRlXLtPIXWWxC5yO4u/8soGtuLOkWxYIRJaX5Ndk+g6uYK0JmR 6EOpy8Q1eES+VR3GKqFS705CwmyQVKqVlDc0r/qi+tQQzlbbXPOiD7hoY2FTo79VzD qFqRkaGHPAFDxiBVuWeh5B3xAZvV+T1POv9Qldbg= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Wilco Dijkstra To: glibc-cvs@sourceware.org Subject: [glibc] AArch64: Fix HP_TIMING_DIFF computation [BZ# 29329] X-Act-Checkin: glibc X-Git-Author: Jun Tang X-Git-Refname: refs/heads/master X-Git-Oldrev: 8b014a1b1f7aee1e3348db108aeea396359d481e X-Git-Newrev: 311a7e0256975275d97077f1af338bc9caf0c837 Message-Id: <20230222171735.DBF013858D33@sourceware.org> Date: Wed, 22 Feb 2023 17:17:35 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=311a7e0256975275d97077f1af338bc9caf0c837 commit 311a7e0256975275d97077f1af338bc9caf0c837 Author: Jun Tang Date: Wed Feb 22 16:45:59 2023 +0000 AArch64: Fix HP_TIMING_DIFF computation [BZ# 29329] Fix the computation to allow for cntfrq_el0 being larger than 1GHz. Assume cntfrq_el0 is a multiple of 1MHz to increase the maximum interval (1024 seconds at 1GHz). Reviewed-by: Wilco Dijkstra Diff: --- sysdeps/aarch64/hp-timing.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/aarch64/hp-timing.h b/sysdeps/aarch64/hp-timing.h index c8469e3011..b97e878f7b 100644 --- a/sysdeps/aarch64/hp-timing.h +++ b/sysdeps/aarch64/hp-timing.h @@ -41,7 +41,7 @@ typedef uint64_t hp_timing_t; #define HP_TIMING_DIFF(Diff, Start, End) \ ({ hp_timing_t freq; \ __asm__ __volatile__ ("mrs %0, cntfrq_el0" : "=r" (freq)); \ - (Diff) = ((End) - (Start)) * (UINT64_C(1000000000) / freq); \ + (Diff) = (((End) - (Start)) * UINT64_C(1000000000 >> 6)) / (freq >> 6); \ }) #endif /* hp-timing.h */