This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 05/10] Use clock_gettime to implement time.
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Florian Weimer <fweimer at redhat dot com>, Zack Weinberg <zackw at panix dot com>
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>, GNU C Library <libc-alpha at sourceware dot org>, Joseph Myers <joseph at codesourcery dot com>, Lukasz Majewski <lukma at denx dot de>, Alistair Francis <alistair23 at gmail dot com>, Stepan Golosunov <stepan at golosunov dot pp dot ru>, Arnd Bergmann <arnd at arndb dot de>, Samuel Thibault <samuel dot thibault at ens-lyon dot org>
- Date: Mon, 2 Sep 2019 15:35:36 -0300
- Subject: Re: [PATCH v2 05/10] Use clock_gettime to implement time.
- References: <20190828153236.18229-1-zackw@panix.com> <20190828153236.18229-6-zackw@panix.com> <87muftb1fk.fsf@oldenburg2.str.redhat.com> <e2fd0284-2e7c-bec9-7961-2f143acc37ad@cs.ucla.edu> <87sgpl9h2o.fsf@oldenburg2.str.redhat.com> <321d1bd0-a9f6-310b-5412-a023d813e90f@cs.ucla.edu> <87imqh9dhm.fsf@oldenburg2.str.redhat.com> <CAKCAbMiqG75Pr51-OR8u+PxEQZ303qHgj2XZO0fZqJoYOsfjhg@mail.gmail.com> <87r24yvn66.fsf@oldenburg2.str.redhat.com>
On 02/09/2019 10:32, Florian Weimer wrote:
> * Zack Weinberg:
>
>> On Wed, Aug 28, 2019 at 5:39 PM Florian Weimer <fweimer@redhat.com> wrote:
>>> I think we should keep using the time entry in the vDSO. This
>>> consolidation is just not possible to do for performance reasons.
>>
>> To be crystal clear about where I'm coming from, I think this
>> consolidation is *necessary* to clear the way for the y2038 patches.
>
> But it's not an absolute technical requirement, right?
>
> I mean, if we wanted, we could still add a file like
> sysdeps/unix/sysv/linux/x86_64/time.c and do things differently there?
> (Although we'd also have to change the vDSO setup code for an efficient
> implementation.)
>
>> And I was under the impression that the kernel people wanted to
>> withdraw support for the time and gettimeofday entry points (at least
>> for new architectures going forward).
>
> Yes, but that doesn't mean they want performance regressions on x86-64.
> I think.
>
>> So I'm only looking for ways to mitigate the performance impact at
>> this point. Before I back off on "henceforth we only call the
>> kernel's clock_gettime" I would need to hear *both* a really
>> compelling argument for why we need to keep calling the time or
>> gettimeofday entry points -- a few ns more expense on a call that only
>> reports the time to the nearest second isn't going to cut it -- *and*
>> an explanation of why it won't interfere with the y2038 work and/or
>> why we won't have to stop using them in the future anyway.
>
> I expect that people have time calls in (binary) logging code where this
> is visible. I think EXPLAIN ANALYZE in PostgreSQL also rather sensitive
> to timing performance, but fortunately it already uses
> clock_gettimeofday.
>
> I'm not too concerned here (assuming that we *can* still optimize the
> time function on select architectures if that proves necessary in a
> couple of years). It's just that I really dislike the idea of
> performance regressions on 64-bit architectures as a side effect of
> Y2038 support on 32-bit architectures.
I think the *default* implementation for time should indeed be done through
clock_gettime, as this patch intends, however I also think it is possible to
keep arch-specific code in place so the optimized vDSO implementation are
used. It will also allow each arch maintainer to do the switch if the
consensus would to use the default one.
My view is we can use my proposed patch to refactor time [1], and change
the fallback syscall path to call clock_gettime instead. I can work
towards the modification.
[1] https://sourceware.org/ml/libc-alpha/2019-07/msg00157.html