[v2,1/2] sysdeps: Add clock_gettime64 vDSO

Message ID 20191110025658.3149-1-alistair.francis@wdc.com
State New, archived
Headers

Commit Message

Alistair Francis Nov. 10, 2019, 2:56 a.m. UTC
  Add support for the clock_gettim64 vDSO calls. These are protected by
the HAVE_CLOCK_GETTIME64_VSYSCALL define.

HAVE_CLOCK_GETTIME64_VSYSCALL should be defined for 32-bit platforms
(WORDSIZE == 32) that only run on the 5.1 kernel or later. WORDSIZE ==
64 platforms can use #define __vdso_clock_gettime64 __vdso_clock_gettime
and use the __vdso_clock_gettime syscall as they don't have a
__vdso_clock_gettime64 call.

	* sysdeps/unix/sysv/linux/init-first.c: Add clock_gettime64
	vDSO.
	* sysdeps/unix/sysv/linux/libc-vdso.h: Likewise.
---
 sysdeps/unix/sysv/linux/init-first.c | 10 ++++++++++
 sysdeps/unix/sysv/linux/libc-vdso.h  |  4 ++++
 2 files changed, 14 insertions(+)
  

Comments

Alistair Francis Nov. 18, 2019, 9:40 p.m. UTC | #1
On Sat, Nov 9, 2019 at 7:02 PM Alistair Francis
<alistair.francis@wdc.com> wrote:
>
> Add support for the clock_gettim64 vDSO calls. These are protected by
> the HAVE_CLOCK_GETTIME64_VSYSCALL define.
>
> HAVE_CLOCK_GETTIME64_VSYSCALL should be defined for 32-bit platforms
> (WORDSIZE == 32) that only run on the 5.1 kernel or later. WORDSIZE ==
> 64 platforms can use #define __vdso_clock_gettime64 __vdso_clock_gettime
> and use the __vdso_clock_gettime syscall as they don't have a
> __vdso_clock_gettime64 call.
>
>         * sysdeps/unix/sysv/linux/init-first.c: Add clock_gettime64
>         vDSO.
>         * sysdeps/unix/sysv/linux/libc-vdso.h: Likewise.

Ping!

Alistair

> ---
>  sysdeps/unix/sysv/linux/init-first.c | 10 ++++++++++
>  sysdeps/unix/sysv/linux/libc-vdso.h  |  4 ++++
>  2 files changed, 14 insertions(+)
>
> diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
> index d90ca820be0..d005d133220 100644
> --- a/sysdeps/unix/sysv/linux/init-first.c
> +++ b/sysdeps/unix/sysv/linux/init-first.c
> @@ -24,6 +24,11 @@
>  int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
>    attribute_hidden;
>  #endif
> +/* vDSO symbol used on clock_gettime64 implementation.  */
> +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> +int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
> +  attribute_hidden;
> +#endif
>  /* vDSO symbol used on clock_getres implementation.  */
>  #ifdef HAVE_CLOCK_GETRES_VSYSCALL
>  int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
> @@ -52,6 +57,11 @@ __libc_vdso_platform_setup (void)
>      = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME_VSYSCALL);
>  #endif
>
> +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> +  VDSO_SYMBOL(clock_gettime64)
> +    = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME64_VSYSCALL);
> +#endif
> +
>  #ifdef HAVE_CLOCK_GETRES_VSYSCALL
>    VDSO_SYMBOL(clock_getres)
>      = get_vdso_mangle_symbol (HAVE_CLOCK_GETRES_VSYSCALL);
> diff --git a/sysdeps/unix/sysv/linux/libc-vdso.h b/sysdeps/unix/sysv/linux/libc-vdso.h
> index 792ac39d85a..c6d505bab39 100644
> --- a/sysdeps/unix/sysv/linux/libc-vdso.h
> +++ b/sysdeps/unix/sysv/linux/libc-vdso.h
> @@ -32,6 +32,10 @@
>  extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
>    attribute_hidden;
>  #endif
> +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> +extern int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
> +  attribute_hidden;
> +#endif
>  #ifdef HAVE_CLOCK_GETRES_VSYSCALL
>  extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
>    attribute_hidden;
> --
> 2.23.0
>
  
Adhemerval Zanella Nov. 21, 2019, 5:46 p.m. UTC | #2
On 09/11/2019 23:56, Alistair Francis wrote:
> Add support for the clock_gettim64 vDSO calls. These are protected by
> the HAVE_CLOCK_GETTIME64_VSYSCALL define.
> 
> HAVE_CLOCK_GETTIME64_VSYSCALL should be defined for 32-bit platforms
> (WORDSIZE == 32) that only run on the 5.1 kernel or later. WORDSIZE ==
> 64 platforms can use #define __vdso_clock_gettime64 __vdso_clock_gettime
> and use the __vdso_clock_gettime syscall as they don't have a
> __vdso_clock_gettime64 call.
> 
> 	* sysdeps/unix/sysv/linux/init-first.c: Add clock_gettime64
> 	vDSO.
> 	* sysdeps/unix/sysv/linux/libc-vdso.h: Likewise.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/init-first.c | 10 ++++++++++
>  sysdeps/unix/sysv/linux/libc-vdso.h  |  4 ++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
> index d90ca820be0..d005d133220 100644
> --- a/sysdeps/unix/sysv/linux/init-first.c
> +++ b/sysdeps/unix/sysv/linux/init-first.c
> @@ -24,6 +24,11 @@
>  int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
>    attribute_hidden;
>  #endif
> +/* vDSO symbol used on clock_gettime64 implementation.  */
> +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> +int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
> +  attribute_hidden;
> +#endif
>  /* vDSO symbol used on clock_getres implementation.  */
>  #ifdef HAVE_CLOCK_GETRES_VSYSCALL
>  int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
> @@ -52,6 +57,11 @@ __libc_vdso_platform_setup (void)
>      = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME_VSYSCALL);
>  #endif
>  
> +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> +  VDSO_SYMBOL(clock_gettime64)
> +    = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME64_VSYSCALL);
> +#endif
> +
>  #ifdef HAVE_CLOCK_GETRES_VSYSCALL
>    VDSO_SYMBOL(clock_getres)
>      = get_vdso_mangle_symbol (HAVE_CLOCK_GETRES_VSYSCALL);

Ok.

> diff --git a/sysdeps/unix/sysv/linux/libc-vdso.h b/sysdeps/unix/sysv/linux/libc-vdso.h
> index 792ac39d85a..c6d505bab39 100644
> --- a/sysdeps/unix/sysv/linux/libc-vdso.h
> +++ b/sysdeps/unix/sysv/linux/libc-vdso.h
> @@ -32,6 +32,10 @@
>  extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
>    attribute_hidden;
>  #endif
> +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> +extern int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
> +  attribute_hidden;
> +#endif
>  #ifdef HAVE_CLOCK_GETRES_VSYSCALL
>  extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
>    attribute_hidden;
> 

Ok.
  
Alistair Francis Nov. 21, 2019, 6:19 p.m. UTC | #3
On Thu, Nov 21, 2019 at 9:46 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 09/11/2019 23:56, Alistair Francis wrote:
> > Add support for the clock_gettim64 vDSO calls. These are protected by
> > the HAVE_CLOCK_GETTIME64_VSYSCALL define.
> >
> > HAVE_CLOCK_GETTIME64_VSYSCALL should be defined for 32-bit platforms
> > (WORDSIZE == 32) that only run on the 5.1 kernel or later. WORDSIZE ==
> > 64 platforms can use #define __vdso_clock_gettime64 __vdso_clock_gettime
> > and use the __vdso_clock_gettime syscall as they don't have a
> > __vdso_clock_gettime64 call.
> >
> >       * sysdeps/unix/sysv/linux/init-first.c: Add clock_gettime64
> >       vDSO.
> >       * sysdeps/unix/sysv/linux/libc-vdso.h: Likewise.
>
> LGTM, thanks.
>
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

Thanks! I added your reviewed line to the commit message.

Alistair

>
> > ---
> >  sysdeps/unix/sysv/linux/init-first.c | 10 ++++++++++
> >  sysdeps/unix/sysv/linux/libc-vdso.h  |  4 ++++
> >  2 files changed, 14 insertions(+)
> >
> > diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
> > index d90ca820be0..d005d133220 100644
> > --- a/sysdeps/unix/sysv/linux/init-first.c
> > +++ b/sysdeps/unix/sysv/linux/init-first.c
> > @@ -24,6 +24,11 @@
> >  int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
> >    attribute_hidden;
> >  #endif
> > +/* vDSO symbol used on clock_gettime64 implementation.  */
> > +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> > +int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
> > +  attribute_hidden;
> > +#endif
> >  /* vDSO symbol used on clock_getres implementation.  */
> >  #ifdef HAVE_CLOCK_GETRES_VSYSCALL
> >  int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
> > @@ -52,6 +57,11 @@ __libc_vdso_platform_setup (void)
> >      = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME_VSYSCALL);
> >  #endif
> >
> > +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> > +  VDSO_SYMBOL(clock_gettime64)
> > +    = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME64_VSYSCALL);
> > +#endif
> > +
> >  #ifdef HAVE_CLOCK_GETRES_VSYSCALL
> >    VDSO_SYMBOL(clock_getres)
> >      = get_vdso_mangle_symbol (HAVE_CLOCK_GETRES_VSYSCALL);
>
> Ok.
>
> > diff --git a/sysdeps/unix/sysv/linux/libc-vdso.h b/sysdeps/unix/sysv/linux/libc-vdso.h
> > index 792ac39d85a..c6d505bab39 100644
> > --- a/sysdeps/unix/sysv/linux/libc-vdso.h
> > +++ b/sysdeps/unix/sysv/linux/libc-vdso.h
> > @@ -32,6 +32,10 @@
> >  extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
> >    attribute_hidden;
> >  #endif
> > +#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> > +extern int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
> > +  attribute_hidden;
> > +#endif
> >  #ifdef HAVE_CLOCK_GETRES_VSYSCALL
> >  extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
> >    attribute_hidden;
> >
>
> Ok.
  

Patch

diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index d90ca820be0..d005d133220 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -24,6 +24,11 @@ 
 int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
   attribute_hidden;
 #endif
+/* vDSO symbol used on clock_gettime64 implementation.  */
+#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
+  attribute_hidden;
+#endif
 /* vDSO symbol used on clock_getres implementation.  */
 #ifdef HAVE_CLOCK_GETRES_VSYSCALL
 int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
@@ -52,6 +57,11 @@  __libc_vdso_platform_setup (void)
     = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME_VSYSCALL);
 #endif
 
+#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+  VDSO_SYMBOL(clock_gettime64)
+    = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME64_VSYSCALL);
+#endif
+
 #ifdef HAVE_CLOCK_GETRES_VSYSCALL
   VDSO_SYMBOL(clock_getres)
     = get_vdso_mangle_symbol (HAVE_CLOCK_GETRES_VSYSCALL);
diff --git a/sysdeps/unix/sysv/linux/libc-vdso.h b/sysdeps/unix/sysv/linux/libc-vdso.h
index 792ac39d85a..c6d505bab39 100644
--- a/sysdeps/unix/sysv/linux/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/libc-vdso.h
@@ -32,6 +32,10 @@ 
 extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
   attribute_hidden;
 #endif
+#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+extern int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
+  attribute_hidden;
+#endif
 #ifdef HAVE_CLOCK_GETRES_VSYSCALL
 extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
   attribute_hidden;