[RFC,v3,13/23] RISC-V: Use 64-bit timespec in clock_gettime vdso calls

Message ID e6aea1c15190c5555e859775dac70c5ef8eab12c.1563321715.git.alistair.francis@wdc.com
State Superseded
Headers show
Series
  • RISC-V glibc port for the 32-bit
Related show

Commit Message

Alistair Francis July 17, 2019, 12:09 a.m.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

---
 sysdeps/unix/sysv/linux/riscv/init-first.c | 2 +-
 sysdeps/unix/sysv/linux/riscv/libc-vdso.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.22.0

Comments

Arnd Bergmann July 17, 2019, 8:13 a.m. | #1
On Wed, Jul 17, 2019 at 2:12 AM Alistair Francis
<alistair.francis@wdc.com> wrote:
>

> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

> ---

>  sysdeps/unix/sysv/linux/riscv/init-first.c | 2 +-

>  sysdeps/unix/sysv/linux/riscv/libc-vdso.h  | 2 +-

>  2 files changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/sysdeps/unix/sysv/linux/riscv/init-first.c b/sysdeps/unix/sysv/linux/riscv/init-first.c

> index 8134c79695..155a4a2c0c 100644

> --- a/sysdeps/unix/sysv/linux/riscv/init-first.c

> +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c

> @@ -25,7 +25,7 @@ long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *)

>      attribute_hidden;

>  long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *)

>      attribute_hidden;

> -long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *)

> +long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct __timespec64 *)


The vdso symbol in the kernel should be __clock_gettime64().

The gettimeofday() and clock_getres() functions should not have a
vdso symbol on 32-bit but instead get implemented by claling __clock_gettime64()
or the clock_getres() syscall.

If someone has a good reason for introducing a clock_getres_time64() vdso
symbol, we can do that as well, but so far I am not aware of any performance
critical caller of clock_getres().

      Arnd

Patch

diff --git a/sysdeps/unix/sysv/linux/riscv/init-first.c b/sysdeps/unix/sysv/linux/riscv/init-first.c
index 8134c79695..155a4a2c0c 100644
--- a/sysdeps/unix/sysv/linux/riscv/init-first.c
+++ b/sysdeps/unix/sysv/linux/riscv/init-first.c
@@ -25,7 +25,7 @@  long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *)
     attribute_hidden;
 long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *)
     attribute_hidden;
-long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *)
+long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct __timespec64 *)
     attribute_hidden;
 long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *)
     attribute_hidden;
diff --git a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h
index b0c46f3cb7..406801746f 100644
--- a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h
@@ -28,7 +28,7 @@  extern long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *)
     attribute_hidden;
 extern long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *)
     attribute_hidden;
-extern long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *)
+extern long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct __timespec64 *)
     attribute_hidden;
 extern long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *)
     attribute_hidden;