public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Linux: Use 32-bit vDSO for clock_gettime, gettimeofday, time (bug 28071)
Date: Mon, 12 Jul 2021 11:20:26 -0300	[thread overview]
Message-ID: <03207aa6-6bf3-febe-2b7f-30174faede60@linaro.org> (raw)
In-Reply-To: <87zgurad11.fsf@oldenburg.str.redhat.com>



On 12/07/2021 10:15, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> On 12/07/2021 07:40, Florian Weimer wrote:
>>> * Adhemerval Zanella:
>>>
>>>> Using the test (a slight modified one from the bug report):
>>>>
>>>> --
>>>> #include <time.h>
>>>> #include <stdio.h>
>>>> #include <errno.h>
>>>>
>>>> int
>>>> main (void)
>>>> {
>>>>   struct timespec ts;
>>>>   errno = 0;
>>>>   clock_gettime (CLOCK_REALTIME, &ts);
>>>>   printf ("errno = %m (%d)\n", errno);
>>>>   errno = 0;
>>>>   clock_gettime (CLOCK_MONOTONIC, &ts);
>>>>   printf ("errno = %m (%d)\n", errno);
>>>> }
>>>> --
>>>>
>>>> I see no syscall on 5.11 kernel, only a clock_gettime (CLOCK_MONOTONIC)
>>>> on the 4.4 and a clock_gettime_time64 plus a clock_gettime on the 3.10.
>>>
>>> This still introduces a severe performance regression on older kernels.
>>> It may well make some exsting 32-bit applications unusable until the
>>> kernel is upgraded.  I'm not sure if this is a good idea.
>>>
>>> At least I can see that the clobbering of errno is gone.
>>
>> Yes and this how we initially decided to provide 64-bit time_t support,
>> where 32-bit implementations are done on top of 64-bit ones.  I am not
>> very fond of starting to adding 32-bit specific implementations, the
>> complexity to fix some specific cases do not really pay in the long
>> term imho.  
>>
>> We might also add back the global time64 internal variable that indicates
>> if the kernel supports 64-bit (removed by 9465c3a9fb557), but it also has
>> its ow issues (live migration like CRIU).
> 
> Hmm.  I see.  Let's fix the ENOSYS issue then because it breaks OpenJDK.
> 
> I'm a bit surprised that we still see the extra syscalls with your
> patch, but I suppose that's just the way the INTERNAL_VSYSCALL_CALL
> macro works.

The INTERNAL_VSYSCALL_CALL issues the syscall if the vDSO is not present
as a fallback mechanism.  It should not be really necessary on most 
implementation currently, but there are some architectures and kernel
version where the vDSO does not actually does it (I think mips on kernel
4.x version).

However, I think open-coding is should be simple; specially now for the
case we do not really want it to fallback to syscall.

> 
> Regarding the actual patch, there are a few missing spaces before
> parenthesis:
> 
> +  int (*vdso_time64)(clockid_t clock_id, struct __timespec64 *tp)
> +    = GLRO(dl_vdso_clock_gettime64);
> +  int (*vdso_time)(clockid_t clock_id, struct timespec *tp)
> +    = GLRO(dl_vdso_clock_gettime);

My understanding is for GLRO the space is not really required because the
macro is not used a function call.  I followed the same idea for the
function pointer definition.

Regardless of the missing space, are you ok with my patch then? 

> 
> Thanks,
> Florian
> 

  reply	other threads:[~2021-07-12 14:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-10 17:15 Florian Weimer
2021-07-10 18:22 ` Adhemerval Zanella
2021-07-10 18:54   ` Florian Weimer
2021-07-10 19:57     ` Adhemerval Zanella
2021-07-10 20:00       ` Florian Weimer
2021-07-10 20:03         ` Adhemerval Zanella
2021-07-10 20:30         ` Adhemerval Zanella
2021-07-12 10:40           ` Florian Weimer
2021-07-12 11:55             ` Adhemerval Zanella
2021-07-12 13:15               ` Florian Weimer
2021-07-12 14:20                 ` Adhemerval Zanella [this message]
2021-07-12 14:29                   ` Florian Weimer
2021-07-12 15:46                     ` Adhemerval Zanella
2021-07-12 17:55                       ` Florian Weimer
2021-07-12 18:00                         ` Adhemerval Zanella

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

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

  git send-email \
    --in-reply-to=03207aa6-6bf3-febe-2b7f-30174faede60@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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).