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=-3.7 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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 11EB91F55B for ; Sun, 24 May 2020 15:30:32 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A0171383E821; Sun, 24 May 2020 15:30:30 +0000 (GMT) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id 8581D386F816 for ; Sun, 24 May 2020 15:30:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8581D386F816 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49VPLT0JQmz1qs42; Sun, 24 May 2020 17:30:24 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49VPLS4mstz1qqkJ; Sun, 24 May 2020 17:30:24 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id ClCLZBzUDeYR; Sun, 24 May 2020 17:30:22 +0200 (CEST) X-Auth-Info: ff0wkD4liRvBxXEVJOPvEL/Aswf2+fwXEvXj4M4XcmU= Received: from jawa (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 24 May 2020 17:30:22 +0200 (CEST) Date: Sun, 24 May 2020 17:30:21 +0200 From: Lukasz Majewski To: "H.J. Lu" Subject: Re: [PATCH] Fix __clock_gettime64 for sysdeps/generic/hp-timing.h Message-ID: <20200524173021.3f5a926f@jawa> In-Reply-To: References: <20200505181605.22346-1-lukma@denx.de> <20200521122423.7d98dd96@jawa> <20200524110338.0165621c@jawa> Organization: denx.de X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/VSNniY980Fu/WZRMVlVBLiD"; protocol="application/pgp-signature" 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: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis , Joseph Myers Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" --Sig_/VSNniY980Fu/WZRMVlVBLiD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: > > =20 > > > On Thu, May 21, 2020 at 4:11 AM H.J. Lu > > > wrote: =20 > > > > > > > > On Thu, May 21, 2020 at 3:24 AM Lukasz Majewski > > > > wrote: =20 > > > > > > > > > > Hi "H.J. Lu", > > > > > =20 > > > > > > On Tue, May 5, 2020 at 11:21 AM Lukasz Majewski > > > > > > wrote: =20 > > > > > > > > > > > > > > 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(-)=20 > > > > > > > > > > > > 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/b= enchtests/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 __timesp= ec64 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; di= d you mean > > > > > > =E2=80=98clock_gettime=E2=80=99? [-Werror=3Dimplicit-function-d= eclaration] > > > > > > 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 __timesp= ec64 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 __timesp= ec64 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 __timesp= ec64 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 __timesp= ec64 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 __timesp= ec64 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 =20 > > > > > > > > > > How shall I reproduce this error? =20 > > > > > > > > Apply the enclosed patch and do > > > > > > > > $ make USE_CLOCK_GETTIME=3D1 bench > > > > =20 > > > > > Was it supposed to be catch with build-many-glibc.py ? > > > > > =20 > > > > > > > > No, "make bench" isn't tested by build-many-glibc.py. > > > > =20 > > > > > > Here is the patch to fix __clock_gettime64 for > > > sysdeps/generic/hp-timing.h. OK for master? > > > =20 > > > > 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 ? > > =20 >=20 > include/time.h is also included by other files which may not include > . >=20 In which files you observe this situation? The was introduced to avoid including time.h when only new, y2038 safe struct __timespec64 is necessary. Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/VSNniY980Fu/WZRMVlVBLiD Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl7Kkw0ACgkQAR8vZIA0 zr3W/Qf+OHzr1ivGeuPz1wR0cE+pk/l3OUSLc4X3WlnJJ6HHS+R3UlU5XbbuYMkr lb9LCHzVmH0+j6QKa7gStv/HZildveyUIS8x3tkSm7cO4pQMmvLEILOSxi/r0c26 Uu1FG3zAY6wOWfCMoczGeAz5c33REnShScsJ1mmb6xB7836k41N/LKbX2Ksbzm/X M/eqHNUcsTMjrzNZhB5HXHGEEVI1SNdRaN5TFbd6vjtwy0v2UYXmj/+pY5Vqtt8I xRxJBo1BJq14r/1aAMUjVs+kPmk/fSNinzvrZIsFxrHbg+FnySZtSyGid6C5VCYT 443FWMxMITrUKm1p3Fam+taRr3Pu5A== =aMHE -----END PGP SIGNATURE----- --Sig_/VSNniY980Fu/WZRMVlVBLiD--