From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 1EB7A1F55B for ; Sun, 24 May 2020 16:14:10 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C8869388A833; Sun, 24 May 2020 16:14:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8869388A833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1590336848; bh=TOSclGqwKvJUAsFLj7oMg/bG++oOsR752NqbEu78Dtk=; 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=gbzeGiC/2enIjIKYjXzj3odP7bYzHqKrDDh4PJLg0X8ziZZr83q4SBx6tld+MH4o5 Nhlx+9RZYPFuherB5EJLf9emWIYPjaDOJPQaWC88kdtglNrRVv2SpDcc+iaLlpFyXN RyG1PLX3EkBGnRTa6yIlDW2Rg7iVJqtXMaCNTDjI= Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by sourceware.org (Postfix) with ESMTPS id BAF963870872 for ; Sun, 24 May 2020 16:14:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BAF963870872 Received: by mail-io1-xd42.google.com with SMTP id u23so3402723iot.12 for ; Sun, 24 May 2020 09:14:05 -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:content-transfer-encoding; bh=TOSclGqwKvJUAsFLj7oMg/bG++oOsR752NqbEu78Dtk=; b=nVwechqYHs4g/2xRMM2osJZOVGYhdo7/KCrUSOByHqrUCiZPKrpsVKmaNoFCzzBdWZ szB62zFd9wX0cYCQVDG8ZqKJage7t/i00kCprg5pezoPUP8lF3KZ+tkno9JCFYjxMiYX ylXDkCCuEIGdr0kMyeW9f20NUYOQlzJYSYfOWB6bHxYBe6UdElioVqDKmrmLEp4HkN9Q sUbX4WKujwyJl4Wwq+w0mP9nhzQPqh1gy8EKAMNGPphMyKFkT+SYG6rgcQGNng2zAT7M lxuewbdt8/bt8RQbXYtkPvIgPlCyyWEQ4XZDb9b3ss7/NRecQDSH0+2vhJrGvnfb9O8V cESw== X-Gm-Message-State: AOAM532PYpnz4hF+DSDCtq1SuWkbxAUO2p1MJbjFw/slvhDKUY6qm6+Z 1vrVIBBb8TZTaAoBwFY0UbJ+g5tiHfTerm4B8bQ= X-Google-Smtp-Source: ABdhPJxcdbC6FLNQCI1eqhilB5FjxreZJ2xdaa1Y6nhL7MbR/NzArpoknnGoMz7Jn2btB+t3x6SrYhsRghyYrsENSFU= X-Received: by 2002:a5e:d71a:: with SMTP id v26mr4037977iom.91.1590336845005; Sun, 24 May 2020 09:14:05 -0700 (PDT) MIME-Version: 1.0 References: <20200505181605.22346-1-lukma@denx.de> <20200521122423.7d98dd96@jawa> <20200524110338.0165621c@jawa> <20200524173021.3f5a926f@jawa> In-Reply-To: <20200524173021.3f5a926f@jawa> Date: Sun, 24 May 2020 09:13:29 -0700 Message-ID: Subject: Re: [PATCH] Fix __clock_gettime64 for sysdeps/generic/hp-timing.h To: Lukasz Majewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: , From: "H.J. Lu via Libc-alpha" Reply-To: "H.J. Lu" Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis , Joseph Myers Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On Sun, May 24, 2020 at 8:30 AM Lukasz Majewski wrote: > > On Sun, 24 May 2020 04:39:47 -0700 > "H.J. Lu" wrote: > > > On Sun, May 24, 2020 at 2:03 AM Lukasz Majewski wrote: > > > > > > On Sat, 23 May 2020 13:32:05 -0700 > > > "H.J. Lu" wrote: > > > > > > > On Thu, May 21, 2020 at 4:11 AM H.J. Lu > > > > wrote: > > > > > > > > > > On Thu, May 21, 2020 at 3:24 AM Lukasz Majewski > > > > > wrote: > > > > > > > > > > > > Hi "H.J. Lu", > > > > > > > > > > > > > On Tue, May 5, 2020 at 11:21 AM Lukasz Majewski > > > > > > > wrote: > > > > > > > > > > > > > > > > The __clock_gettime internal function is not supporting 64 > > > > > > > > bit time on architectures with __WORDSIZE =3D=3D 32 and > > > > > > > > __TIMESIZE !=3D 64 (like e.g. ARM 32 bit). > > > > > > > > > > > > > > > > The __clock_gettime64 function shall be used instead in > > > > > > > > the glibc itself as it supports 64 bit time on those > > > > > > > > systems. This patch does not bring any changes to systems > > > > > > > > with __WORDSIZE =3D=3D 64 as for them the __clock_gettime64 > > > > > > > > is aliased to __clock_gettime (in ./include/time.h). > > > > > > > > > > > > > > > > --- > > > > > > > > Changes for v3: > > > > > > > > - Fix the commit message (add missing "function" after > > > > > > > > __clock_gettime64) > > > > > > > > - Refactor __nisfind_server() function to support 64 bit > > > > > > > > time with struct timespec instead of struct timeval > > > > > > > > - Change expires to __time64_t > > > > > > > > > > > > > > > > Changes for v2: > > > > > > > > - Use only TIMESPEC_TO_TIMEVAL instead of > > > > > > > > valid_timespec64_to_timeval in logout.c and logwtmp.c as > > > > > > > > it is generic enough to also support struct __timespec64 > > > > > > > > conversion to struct timeval --- > > > > > > > > benchtests/bench-timing.h | 2 +- > > > > > > > > include/random-bits.h | 4 > > > > > > > > ++-- login/logout.c | > > > > > > > > 4 ++-- login/logwtmp.c | > > > > > > > > 5 +++-- nis/nis_call.c > > > > > > > > | 16 +++++++--------- sysdeps/generic/hp-timing.h > > > > > > > > | 4 ++-- sysdeps/generic/memusage.h > > > > > > > > | 4 ++-- > > > > > > > > sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c | 4 ++-- > > > > > > > > sysdeps/unix/sysv/linux/clock.c | 7 > > > > > > > > ++----- 9 files changed, 23 insertions(+), 27 > > > > > > > > deletions(-) > > > > > > > > > > > > > > Does this patch work with "make bench" when > > > > > > > sysdeps/generic/hp-timing.h is used, like on arm? I got > > > > > > > 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 =E2=80=98main=E2=80=99: > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of > > > > > > > =E2=80=98tv=E2=80=99 isn=E2=80=99t known 37 | struct __time= spec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:82:8: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 82 | TIMING_NOW (start); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:38:3: error: implicit > > > > > > > declaration of function =E2=80=98__clock_gettime64=E2=80=99; = did you mean > > > > > > > =E2=80=98clock_gettime=E2=80=99? [-Werror=3Dimplicit-function= -declaration] > > > > > > > 38 | __clock_gettime64 (CLOCK_MONOTONIC, &tv); \ > > > > > > > | ^~~~~~~~~~~~~~~~~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:82:8: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 82 | TIMING_NOW (start); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable > > > > > > > =E2=80=98tv=E2=80=99 [-Werror=3Dunused-variable] > > > > > > > 37 | struct __timespec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:82:8: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 82 | TIMING_NOW (start); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of > > > > > > > =E2=80=98tv=E2=80=99 isn=E2=80=99t known 37 | struct __time= spec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:86:8: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 86 | TIMING_NOW (end); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable > > > > > > > =E2=80=98tv=E2=80=99 [-Werror=3Dunused-variable] > > > > > > > 37 | struct __timespec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:86:8: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 86 | TIMING_NOW (end); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of > > > > > > > =E2=80=98tv=E2=80=99 isn=E2=80=99t known 37 | struct __time= spec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:90:8: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 90 | TIMING_NOW (start); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable > > > > > > > =E2=80=98tv=E2=80=99 [-Werror=3Dunused-variable] > > > > > > > 37 | struct __timespec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:90:8: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 90 | TIMING_NOW (start); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of > > > > > > > =E2=80=98tv=E2=80=99 isn=E2=80=99t known 37 | struct __time= spec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:94:8: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 94 | TIMING_NOW (end); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable > > > > > > > =E2=80=98tv=E2=80=99 [-Werror=3Dunused-variable] > > > > > > > 37 | struct __timespec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:94:8: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 94 | TIMING_NOW (end); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of > > > > > > > =E2=80=98tv=E2=80=99 isn=E2=80=99t known 37 | struct __time= spec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:103:3: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 103 | TIMING_NOW (start); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable > > > > > > > =E2=80=98tv=E2=80=99 [-Werror=3Dunused-variable] > > > > > > > 37 | struct __timespec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:103:3: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 103 | TIMING_NOW (start); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of > > > > > > > =E2=80=98tv=E2=80=99 isn=E2=80=99t known 37 | struct __time= spec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:106:3: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 106 | TIMING_NOW (end); > > > > > > > | ^~~~~~~~~~ > > > > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable > > > > > > > =E2=80=98tv=E2=80=99 [-Werror=3Dunused-variable] > > > > > > > 37 | struct __timespec64 tv; \ > > > > > > > | ^~ > > > > > > > ./bench-timing.h:35:25: note: in expansion of macro > > > > > > > =E2=80=98HP_TIMING_NOW=E2=80=99 35 | #define TIMING_NOW(var) = HP_TIMING_NOW > > > > > > > (var) | ^~~~~~~~~~~~~ > > > > > > > ./bench-skeleton.c:106:3: note: in expansion of macro > > > > > > > =E2=80=98TIMING_NOW=E2=80=99 106 | TIMING_NOW (end); > > > > > > > | ^~~~~~~~~~ > > > > > > > cc1: all warnings being treated as errors > > > > > > > > > > > > How shall I reproduce this error? > > > > > > > > > > Apply the enclosed patch and do > > > > > > > > > > $ make USE_CLOCK_GETTIME=3D1 bench > > > > > > > > > > > Was it supposed to be catch with build-many-glibc.py ? > > > > > > > > > > > > > > > > No, "make bench" isn't tested by build-many-glibc.py. > > > > > > > > > > > > > Here is the patch to fix __clock_gettime64 for > > > > sysdeps/generic/hp-timing.h. OK for master? > > > > > > > > > > Thanks for preparing the fix. > > > > > > If I may ask - I do have some question about the following code: > > > +#else > > > +struct __timespec64; > > > +extern int __clock_gettime64 (clockid_t clock_id, struct > > > __timespec64 *tp); +#endif > > > > > > Why do we need the "struct __timespec64;" declaration there as > > > in ./sysdeps/generic/hp-timing.h you explicitly added: > > > #include ? > > > > > > > include/time.h is also included by other files which may not include > > . > > > > In which files you observe this situation? > > The was introduced to avoid including time.h > when only new, y2038 safe struct __timespec64 is necessary. > Without it, I got cc -m32 getprtent_r.c -c -std=3Dgnu11 -fgnu89-inline -O2 -g -march=3Di686 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -Wstrict-prototypes -Wold-style-definition -fmath-errno -fPIC -Wa,-mtune=3Di686 -fexceptions -ftls-model=3Dinitial-exec -I../include -I/export/build/gnu/tools-build/glibc-32bit-gitlab/build-i686-linux/inet -I/export/build/gnu/tools-build/glibc-32bit-gitlab/build-i686-linux -I../sysdeps/unix/sysv/linux/i386/i686 -I../sysdeps/i386/i686/nptl -I../sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/x86/include -I../sysdeps/unix/sysv/linux/x86 -I../sysdeps/x86/nptl -I../sysdeps/i386/nptl -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu/multiarch -I../sysdeps/i386/i686/fpu -I../sysdeps/i386/i686/multiarch -I../sysdeps/i386/i686 -I../sysdeps/i386/fpu -I../sysdeps/x86/fpu -I../sysdeps/i386 -I../sysdeps/x86 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/float128 -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /export/build/gnu/tools-build/glibc-32bit-gitlab/build-i686-linux/libc-modu= les.h -DMODULE_NAME=3Dlibc -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=3Dglibc -o /export/build/gnu/tools-build/glibc-32bit-gitlab/build-i686-linux/inet/getp= rtent_r.os -MD -MP -MF /export/build/gnu/tools-build/glibc-32bit-gitlab/build-i686-lin= ux/inet/getprtent_r.os.dt -MT /export/build/gnu/tools-build/glibc-32bit-gitlab/build-i686-linux/inet/= getprtent_r.os In file included from ../sysdeps/nptl/lowlevellock.h:24, from ../sysdeps/unix/sysv/linux/x86/lowlevellock.h:23, from ../nptl/descr.h:29, from ../sysdeps/i386/nptl/tls.h:120, from ../sysdeps/i386/i686/nptl/tls.h:33, from ../include/link.h:51, from ../include/dlfcn.h:4, from ../nss/nsswitch.h:28, from ../include/nsswitch.h:1, from ../inet/netgroup.h:22, from ../include/netdb.h:203, from getprtent_r.c:18: ../include/time.h:9:58: error: =E2=80=98struct __timespec64=E2=80=99 declar= ed inside parameter list will not be visible outside of this definition or declaration [-Werror] 9 | extern int __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp); | ^~~~~~~~~~= ~~ cc1: all warnings being treated as errors This may happen for all 32-bit targets. --=20 H.J.