unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
To: Lukasz Majewski <lukma@denx.de>
Cc: Florian Weimer <fweimer@redhat.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Andreas Schwab <schwab@suse.de>,
	Alistair Francis <alistair.francis@wdc.com>,
	Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH] Fix __clock_gettime64 for sysdeps/generic/hp-timing.h
Date: Sun, 24 May 2020 04:39:47 -0700	[thread overview]
Message-ID: <CAMe9rOp34SNnSB+02aV=oFrMVOapiBQ8bw-B7xH0RPUegRxF+g@mail.gmail.com> (raw)
In-Reply-To: <20200524110338.0165621c@jawa>

On Sun, May 24, 2020 at 2:03 AM Lukasz Majewski <lukma@denx.de> wrote:
>
> On Sat, 23 May 2020 13:32:05 -0700
> "H.J. Lu" <hjl.tools@gmail.com> wrote:
>
> > On Thu, May 21, 2020 at 4:11 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Thu, May 21, 2020 at 3:24 AM Lukasz Majewski <lukma@denx.de>
> > > wrote:
> > > >
> > > > Hi "H.J. Lu",
> > > >
> > > > > On Tue, May 5, 2020 at 11:21 AM Lukasz Majewski <lukma@denx.de>
> > > > > wrote:
> > > > > >
> > > > > > The __clock_gettime internal function is not supporting 64
> > > > > > bit time on architectures with __WORDSIZE == 32 and
> > > > > > __TIMESIZE != 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 == 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 ‘main’:
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of
> > > > > ‘tv’ isn’t known 37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:82:8: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 82 |        TIMING_NOW (start);
> > > > >       |        ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:38:3: error: implicit
> > > > > declaration of function ‘__clock_gettime64’; did you mean
> > > > > ‘clock_gettime’? [-Werror=implicit-function-declaration]
> > > > >    38 |   __clock_gettime64 (CLOCK_MONOTONIC, &tv);   \
> > > > >       |   ^~~~~~~~~~~~~~~~~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:82:8: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 82 |        TIMING_NOW (start);
> > > > >       |        ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable
> > > > > ‘tv’ [-Werror=unused-variable]
> > > > >    37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:82:8: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 82 |        TIMING_NOW (start);
> > > > >       |        ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of
> > > > > ‘tv’ isn’t known 37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:86:8: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 86 |        TIMING_NOW (end);
> > > > >       |        ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable
> > > > > ‘tv’ [-Werror=unused-variable]
> > > > >    37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:86:8: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 86 |        TIMING_NOW (end);
> > > > >       |        ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of
> > > > > ‘tv’ isn’t known 37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:90:8: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 90 |        TIMING_NOW (start);
> > > > >       |        ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable
> > > > > ‘tv’ [-Werror=unused-variable]
> > > > >    37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:90:8: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 90 |        TIMING_NOW (start);
> > > > >       |        ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of
> > > > > ‘tv’ isn’t known 37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:94:8: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 94 |        TIMING_NOW (end);
> > > > >       |        ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable
> > > > > ‘tv’ [-Werror=unused-variable]
> > > > >    37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:94:8: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 94 |        TIMING_NOW (end);
> > > > >       |        ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of
> > > > > ‘tv’ isn’t known 37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:103:3: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 103 |   TIMING_NOW (start);
> > > > >       |   ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable
> > > > > ‘tv’ [-Werror=unused-variable]
> > > > >    37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:103:3: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 103 |   TIMING_NOW (start);
> > > > >       |   ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: storage size of
> > > > > ‘tv’ isn’t known 37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:106:3: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 106 |   TIMING_NOW (end);
> > > > >       |   ^~~~~~~~~~
> > > > > ../sysdeps/generic/hp-timing.h:37:23: error: unused variable
> > > > > ‘tv’ [-Werror=unused-variable]
> > > > >    37 |   struct __timespec64 tv;      \
> > > > >       |                       ^~
> > > > > ./bench-timing.h:35:25: note: in expansion of macro
> > > > > ‘HP_TIMING_NOW’ 35 | #define TIMING_NOW(var) HP_TIMING_NOW (var)
> > > > >       |                         ^~~~~~~~~~~~~
> > > > > ./bench-skeleton.c:106:3: note: in expansion of macro
> > > > > ‘TIMING_NOW’ 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=1 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 <struct___timespec64.h> ?
>

include/time.h is also included by other files which may not include
<struct___timespec64.h>.

-- 
H.J.

  reply	other threads:[~2020-05-24 11:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 18:16 [PATCH v3] y2038: Replace __clock_gettime with __clock_gettime64 Lukasz Majewski
2020-05-19 19:51 ` Lukasz Majewski
2020-05-20 10:29 ` Andreas Schwab
2020-05-21  1:09 ` H.J. Lu via Libc-alpha
2020-05-21 10:24   ` Lukasz Majewski
2020-05-21 11:11     ` H.J. Lu via Libc-alpha
2020-05-23 20:32       ` [PATCH] Fix __clock_gettime64 for sysdeps/generic/hp-timing.h H.J. Lu via Libc-alpha
2020-05-24  9:03         ` Lukasz Majewski
2020-05-24 11:39           ` H.J. Lu via Libc-alpha [this message]
2020-05-24 15:30             ` Lukasz Majewski
2020-05-24 16:13               ` H.J. Lu via Libc-alpha
2020-05-24 23:34                 ` V2 " H.J. Lu via Libc-alpha
2020-05-25 10:40                   ` Lukasz Majewski
2020-05-25 10:57   ` [PATCH v3] y2038: Replace __clock_gettime with __clock_gettime64 Andreas Schwab
2020-05-27 12:44     ` Florian Weimer via Libc-alpha
2020-05-27 12:47       ` H.J. Lu via Libc-alpha
2020-05-27 12:50         ` Florian Weimer via Libc-alpha
2020-05-28 12:28           ` [PATCH] Fix __clock_gettime64 with _ISOMAC in sysdeps/generic/hp-timing.h H.J. Lu via Libc-alpha
2020-05-28 12:58             ` Florian Weimer via Libc-alpha
2020-05-28 13:07               ` H.J. Lu via Libc-alpha
2020-05-28 14:28                 ` Florian Weimer via Libc-alpha
2020-05-28 14:50                   ` [PATCH] Update HP_TIMING_NOW for " H.J. Lu via Libc-alpha
2020-06-05 16:26                     ` Carlos O'Donell via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMe9rOp34SNnSB+02aV=oFrMVOapiBQ8bw-B7xH0RPUegRxF+g@mail.gmail.com' \
    --to=libc-alpha@sourceware.org \
    --cc=alistair.francis@wdc.com \
    --cc=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=joseph@codesourcery.com \
    --cc=lukma@denx.de \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).