[RFC,v3,23/23] RISC-V: Use 64-bit vdso syscalls

Message ID 2bf63d1fc37727b7ed77dd20a69ae525a0cee859.1563321716.git.alistair.francis@wdc.com
State New, archived
Headers

Commit Message

Alistair Francis July 17, 2019, 12:09 a.m. UTC
  Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 sysdeps/unix/sysv/linux/riscv/init-first.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Florian Weimer July 17, 2019, 5:33 a.m. UTC | #1
* Alistair Francis:

> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  sysdeps/unix/sysv/linux/riscv/init-first.c | 4 ++--
>  1 file 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 155a4a2c0c..fa9c690cdd 100644
> --- a/sysdeps/unix/sysv/linux/riscv/init-first.c
> +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c
> @@ -43,11 +43,11 @@ _libc_vdso_platform_setup (void)
>    PTR_MANGLE (p);
>    VDSO_SYMBOL (gettimeofday) = p;
>  
> -  p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version);
> +  p = _dl_vdso_vsym ("__vdso_clock_gettime64", &linux_version);
>    PTR_MANGLE (p);
>    VDSO_SYMBOL (clock_gettime) = p;
>  
> -  p = _dl_vdso_vsym ("__vdso_clock_getres", &linux_version);
> +  p = _dl_vdso_vsym ("__vdso_clock_getres_time64", &linux_version);
>    PTR_MANGLE (p);
>    VDSO_SYMBOL (clock_getres) = p;
>  }

I believe this will lose vDSO acceleration for RV64 on older kernels
which do not define __vdso_clock_getres_time64.

Thanks,
Florian
  
Arnd Bergmann July 17, 2019, 8:02 a.m. UTC | #2
On Wed, Jul 17, 2019 at 7:33 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Alistair Francis:
>
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > ---
> >  sysdeps/unix/sysv/linux/riscv/init-first.c | 4 ++--
> >  1 file 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 155a4a2c0c..fa9c690cdd 100644
> > --- a/sysdeps/unix/sysv/linux/riscv/init-first.c
> > +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c
> > @@ -43,11 +43,11 @@ _libc_vdso_platform_setup (void)
> >    PTR_MANGLE (p);
> >    VDSO_SYMBOL (gettimeofday) = p;
> >
> > -  p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version);
> > +  p = _dl_vdso_vsym ("__vdso_clock_gettime64", &linux_version);
> >    PTR_MANGLE (p);
> >    VDSO_SYMBOL (clock_gettime) = p;
> >
> > -  p = _dl_vdso_vsym ("__vdso_clock_getres", &linux_version);
> > +  p = _dl_vdso_vsym ("__vdso_clock_getres_time64", &linux_version);
> >    PTR_MANGLE (p);
> >    VDSO_SYMBOL (clock_getres) = p;
> >  }
>
> I believe this will lose vDSO acceleration for RV64 on older kernels
> which do not define __vdso_clock_getres_time64.

Also newer kernels, as 64-bit kernels only have __vdso_clock_getres,
not __vdso_clock_getres_time64.

       Arnd
  
Alistair Francis July 17, 2019, 10:23 p.m. UTC | #3
On Wed, Jul 17, 2019 at 1:02 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Wed, Jul 17, 2019 at 7:33 AM Florian Weimer <fweimer@redhat.com> wrote:
> >
> > * Alistair Francis:
> >
> > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > > ---
> > >  sysdeps/unix/sysv/linux/riscv/init-first.c | 4 ++--
> > >  1 file 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 155a4a2c0c..fa9c690cdd 100644
> > > --- a/sysdeps/unix/sysv/linux/riscv/init-first.c
> > > +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c
> > > @@ -43,11 +43,11 @@ _libc_vdso_platform_setup (void)
> > >    PTR_MANGLE (p);
> > >    VDSO_SYMBOL (gettimeofday) = p;
> > >
> > > -  p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version);
> > > +  p = _dl_vdso_vsym ("__vdso_clock_gettime64", &linux_version);
> > >    PTR_MANGLE (p);
> > >    VDSO_SYMBOL (clock_gettime) = p;
> > >
> > > -  p = _dl_vdso_vsym ("__vdso_clock_getres", &linux_version);
> > > +  p = _dl_vdso_vsym ("__vdso_clock_getres_time64", &linux_version);
> > >    PTR_MANGLE (p);
> > >    VDSO_SYMBOL (clock_getres) = p;
> > >  }
> >
> > I believe this will lose vDSO acceleration for RV64 on older kernels
> > which do not define __vdso_clock_getres_time64.
>
> Also newer kernels, as 64-bit kernels only have __vdso_clock_getres,
> not __vdso_clock_getres_time64.

Ok, I can #ifdef this based on word size.

Alistair

>
>        Arnd
  
Alistair Francis July 17, 2019, 11:42 p.m. UTC | #4
On Wed, Jul 17, 2019 at 3:23 PM Alistair Francis <alistair23@gmail.com> wrote:
>
> On Wed, Jul 17, 2019 at 1:02 AM Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > On Wed, Jul 17, 2019 at 7:33 AM Florian Weimer <fweimer@redhat.com> wrote:
> > >
> > > * Alistair Francis:
> > >
> > > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > > > ---
> > > >  sysdeps/unix/sysv/linux/riscv/init-first.c | 4 ++--
> > > >  1 file 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 155a4a2c0c..fa9c690cdd 100644
> > > > --- a/sysdeps/unix/sysv/linux/riscv/init-first.c
> > > > +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c
> > > > @@ -43,11 +43,11 @@ _libc_vdso_platform_setup (void)
> > > >    PTR_MANGLE (p);
> > > >    VDSO_SYMBOL (gettimeofday) = p;
> > > >
> > > > -  p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version);
> > > > +  p = _dl_vdso_vsym ("__vdso_clock_gettime64", &linux_version);
> > > >    PTR_MANGLE (p);
> > > >    VDSO_SYMBOL (clock_gettime) = p;
> > > >
> > > > -  p = _dl_vdso_vsym ("__vdso_clock_getres", &linux_version);
> > > > +  p = _dl_vdso_vsym ("__vdso_clock_getres_time64", &linux_version);
> > > >    PTR_MANGLE (p);
> > > >    VDSO_SYMBOL (clock_getres) = p;
> > > >  }
> > >
> > > I believe this will lose vDSO acceleration for RV64 on older kernels
> > > which do not define __vdso_clock_getres_time64.
> >
> > Also newer kernels, as 64-bit kernels only have __vdso_clock_getres,
> > not __vdso_clock_getres_time64.

Just to confirm (based on this thread and "RISC-V: Use 64-bit timespec
in clock_gettime vdso calls"):
 - change the clock_gettime64 vdso symbol to  __clock_gettime64 for
RV32 to match the kernel
 - Remove clock_gettime, clock_getres and gettimeofday vdso calls for RV32

Alistair

>
> Ok, I can #ifdef this based on word size.
>
> Alistair
>
> >
> >        Arnd
  
Alistair Francis July 18, 2019, 12:01 a.m. UTC | #5
On Wed, Jul 17, 2019 at 4:42 PM Alistair Francis <alistair23@gmail.com> wrote:
>
>  On Wed, Jul 17, 2019 at 3:23 PM Alistair Francis <alistair23@gmail.com> wrote:
> >
> > On Wed, Jul 17, 2019 at 1:02 AM Arnd Bergmann <arnd@arndb.de> wrote:
> > >
> > > On Wed, Jul 17, 2019 at 7:33 AM Florian Weimer <fweimer@redhat.com> wrote:
> > > >
> > > > * Alistair Francis:
> > > >
> > > > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > > > > ---
> > > > >  sysdeps/unix/sysv/linux/riscv/init-first.c | 4 ++--
> > > > >  1 file 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 155a4a2c0c..fa9c690cdd 100644
> > > > > --- a/sysdeps/unix/sysv/linux/riscv/init-first.c
> > > > > +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c
> > > > > @@ -43,11 +43,11 @@ _libc_vdso_platform_setup (void)
> > > > >    PTR_MANGLE (p);
> > > > >    VDSO_SYMBOL (gettimeofday) = p;
> > > > >
> > > > > -  p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version);
> > > > > +  p = _dl_vdso_vsym ("__vdso_clock_gettime64", &linux_version);
> > > > >    PTR_MANGLE (p);
> > > > >    VDSO_SYMBOL (clock_gettime) = p;
> > > > >
> > > > > -  p = _dl_vdso_vsym ("__vdso_clock_getres", &linux_version);
> > > > > +  p = _dl_vdso_vsym ("__vdso_clock_getres_time64", &linux_version);
> > > > >    PTR_MANGLE (p);
> > > > >    VDSO_SYMBOL (clock_getres) = p;
> > > > >  }
> > > >
> > > > I believe this will lose vDSO acceleration for RV64 on older kernels
> > > > which do not define __vdso_clock_getres_time64.
> > >
> > > Also newer kernels, as 64-bit kernels only have __vdso_clock_getres,
> > > not __vdso_clock_getres_time64.
>
> Just to confirm (based on this thread and "RISC-V: Use 64-bit timespec
> in clock_gettime vdso calls"):
>  - change the clock_gettime64 vdso symbol to  __clock_gettime64 for
> RV32 to match the kernel

Wait this breaks all of the callers of INTERNAL_VSYSCALL() as the
syscall is just __NR_clock_gettime64 not __NR___clock_gettime64.

Alistair

>  - Remove clock_gettime, clock_getres and gettimeofday vdso calls for RV32
>
> Alistair
>
> >
> > Ok, I can #ifdef this based on word size.
> >
> > Alistair
> >
> > >
> > >        Arnd
  

Patch

diff --git a/sysdeps/unix/sysv/linux/riscv/init-first.c b/sysdeps/unix/sysv/linux/riscv/init-first.c
index 155a4a2c0c..fa9c690cdd 100644
--- a/sysdeps/unix/sysv/linux/riscv/init-first.c
+++ b/sysdeps/unix/sysv/linux/riscv/init-first.c
@@ -43,11 +43,11 @@  _libc_vdso_platform_setup (void)
   PTR_MANGLE (p);
   VDSO_SYMBOL (gettimeofday) = p;
 
-  p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version);
+  p = _dl_vdso_vsym ("__vdso_clock_gettime64", &linux_version);
   PTR_MANGLE (p);
   VDSO_SYMBOL (clock_gettime) = p;
 
-  p = _dl_vdso_vsym ("__vdso_clock_getres", &linux_version);
+  p = _dl_vdso_vsym ("__vdso_clock_getres_time64", &linux_version);
   PTR_MANGLE (p);
   VDSO_SYMBOL (clock_getres) = p;
 }