From patchwork Thu May 28 14:50:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 39379 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D0366388A837; Thu, 28 May 2020 14:51:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0366388A837 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1590677480; bh=luVr/szyDVzceKZOwlBfsnFnJovYeSwjd6/bfbCMZYU=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Yqm0lC4WUWJyWYrrqvXbATwLEHxkTTuIayMgNciftCWjjf3Ltc+3VfDCSJXknlIBX esI12ElajJLKnPR8Af7FDCzbkjrc7dkHVRbIg+kLuQuT7TWP8N6UoBGSWiWPUpjT6w iazfMwWQZxneu7lfj6h89Njjje6Kyqqr0byjoWbU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by sourceware.org (Postfix) with ESMTPS id 7F4FB38708D0 for ; Thu, 28 May 2020 14:51:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7F4FB38708D0 Received: by mail-io1-xd44.google.com with SMTP id j8so30204289iog.13 for ; Thu, 28 May 2020 07:51:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=luVr/szyDVzceKZOwlBfsnFnJovYeSwjd6/bfbCMZYU=; b=IF6CoXyxCf+9Ohi7O6VTT09e0IlptmLygmHeM5PQM0DCP33zb9c3IdXy9/yMKpRIEv L5iXlLFxEpSEmIsuy0v4PkdxMgixTZj1MSgGeV8fgUjgMkNUstxLzr76JEZZFV44lETq vAY/8yzpLqu4SYMfxguJhbK+iLWsJ7jZ3ZHcC6sVSzGaFzSPrGXUEnmRrWrUjtIVmGkv r3hmQKP+WZf/B/nSc42WAahIBe86aE/qb8klMiAACNSt0dnIAOVFeo+5H9yAAtrbPFhc geH2v/vB1IMkDzcEYa3Ev8Jr+bjcXHfdpaPFYiW874hxZMJsh7W9zo2YTNE1MQSi/qVY aB6g== X-Gm-Message-State: AOAM5301M2RZ5ctWG6u1bx/GR3Mwlohm4LSfh75HfT7XAx5TSnLS18k9 W1nEtOO3L9S5uz8uTgMPg4yAzTEVng6xrcjJDwzz1w== X-Google-Smtp-Source: ABdhPJzBm+zn3yI8YoPtFWiUn6bkLc7SwnPisZvJpcnxznPCNSZ3lo5NITPUe7X6yySvZxBQYJMLNXdU/ribgxNIoSc= X-Received: by 2002:a6b:39c3:: with SMTP id g186mr2534418ioa.91.1590677477994; Thu, 28 May 2020 07:51:17 -0700 (PDT) MIME-Version: 1.0 References: <20200505181605.22346-1-lukma@denx.de> <87v9kkmgcw.fsf@igel.home> <87367lk0nk.fsf@oldenburg2.str.redhat.com> <87y2pdiltl.fsf@oldenburg2.str.redhat.com> <87sgfkb4ij.fsf@oldenburg2.str.redhat.com> <87sgfk9lqw.fsf@oldenburg2.str.redhat.com> In-Reply-To: <87sgfk9lqw.fsf@oldenburg2.str.redhat.com> Date: Thu, 28 May 2020 07:50:42 -0700 Message-ID: Subject: [PATCH] Update HP_TIMING_NOW for _ISOMAC in sysdeps/generic/hp-timing.h To: Florian Weimer X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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-Patchwork-Original-From: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Cc: Andreas Schwab , Alistair Francis , "H.J. Lu via Libc-alpha" , Joseph Myers Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On Thu, May 28, 2020 at 7:29 AM Florian Weimer wrote: > > * H. J. Lu: > > > On Thu, May 28, 2020 at 5:58 AM Florian Weimer wrote: > >> > >> * H. J. Lu via Libc-alpha: > >> > >> > diff --git a/sysdeps/generic/hp-timing.h b/sysdeps/generic/hp-timing.h > >> > index af9d92f7f7..99b12995f1 100644 > >> > --- a/sysdeps/generic/hp-timing.h > >> > +++ b/sysdeps/generic/hp-timing.h > >> > @@ -24,6 +24,11 @@ > >> > #include > >> > #include > >> > > >> > +#ifdef _ISOMAC > >> > +# define __timespec64 timespec > >> > +# define __clock_gettime64 clock_gettime > >> > +#endif > >> > + > >> > /* It should not be used for ld.so. */ > >> > #define HP_TIMING_INLINE (0) > >> > >> To be honest, I would have expected different definitions of the timing > >> macros. This redirection looks a bit iffy for me for _ISOMAC. > > > > What do you have in mind? > > Something like this: > > /* The clock_gettime (CLOCK_MONOTONIC) has unspecified starting time, > nano-second accuracy, and for some architectues is implemented as > vDSO symbol. */ > #ifdef _ISOMAC > # define HP_TIMING_NOW(var) \ > ({ \ > struct timespec tv; \ > clock_gettime (CLOCK_MONOTONIC, &tv); \ > (var) = (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec); \ > }) > #else > # define HP_TIMING_NOW(var) \ > ({ \ > struct __timespec64 tv; \ > __clock_gettime64 (CLOCK_MONOTONIC, &tv); \ > (var) = (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec); \ > }) > #endif > > in sysdeps/generic/hp-timing.h. > Here is the updated patch. OK for master? Thanks. Reviewed-by: Carlos O'Donell From f312c52fa80828ecdc473594e160ef2f5d2a00d7 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 23 May 2020 10:04:20 -0700 Subject: [PATCH] Update HP_TIMING_NOW for _ISOMAC in sysdeps/generic/hp-timing.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit e9698175b0b60407db1e89bcf29437ab224bca0b Author: Lukasz Majewski Date: Mon Mar 16 08:31:41 2020 +0100 y2038: Replace __clock_gettime with __clock_gettime64 breaks benchtests with sysdeps/generic/hp-timing.h: In file included from ./bench-timing.h:23, from ./bench-skeleton.c:25, from /export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/benchtests/bench-rint.c:45: ./bench-skeleton.c: In function ‘main’: ../sysdeps/generic/hp-timing.h:37:23: error: storage size of ‘tv’ isn’t known 37 | struct __timespec64 tv; \ | ^~ Define HP_TIMING_NOW with clock_gettime in sysdeps/generic/hp-timing.h if _ISOMAC is defined. Don't define __clock_gettime in bench-timing.h since it is no longer needed. --- benchtests/bench-timing.h | 1 - sysdeps/generic/hp-timing.h | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/benchtests/bench-timing.h b/benchtests/bench-timing.h index a0d6f82465..d0176fb76e 100644 --- a/benchtests/bench-timing.h +++ b/benchtests/bench-timing.h @@ -18,7 +18,6 @@ #undef attribute_hidden #define attribute_hidden -#define __clock_gettime __clock_gettime64 #include #include diff --git a/sysdeps/generic/hp-timing.h b/sysdeps/generic/hp-timing.h index af9d92f7f7..1960a71c62 100644 --- a/sysdeps/generic/hp-timing.h +++ b/sysdeps/generic/hp-timing.h @@ -32,11 +32,20 @@ typedef uint64_t hp_timing_t; /* The clock_gettime (CLOCK_MONOTONIC) has unspecified starting time, nano-second accuracy, and for some architectues is implemented as vDSO symbol. */ -#define HP_TIMING_NOW(var) \ +#ifdef _ISOMAC +# define HP_TIMING_NOW(var) \ +({ \ + struct timespec tv; \ + clock_gettime (CLOCK_MONOTONIC, &tv); \ + (var) = (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec); \ +}) +#else +# define HP_TIMING_NOW(var) \ ({ \ struct __timespec64 tv; \ __clock_gettime64 (CLOCK_MONOTONIC, &tv); \ (var) = (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec); \ }) +#endif #endif /* hp-timing.h */ -- 2.26.2