diff mbox series

[08/18] linux: Remove supports_time64 () from clock_gettime

Message ID 20210617115104.1359598-9-adhemerval.zanella@linaro.org
State Committed
Commit 4ad8b4645c0869431dba632c3ace0061cc613379
Headers show
Series More y2038 fixes | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Adhemerval Zanella June 17, 2021, 11:50 a.m. UTC
It breaks the usage case of live migration like CRIU or similar.
The performance drawback is it would require an extra syscall
on older kernels without 64-bit time support.

Checked on i686-linux-gnu on a 4.15 kernel and on a 5.11 kernel
(with and without --enable-kernel=5.1) and on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/clock_gettime.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Comments

Lukasz Majewski June 21, 2021, 7:43 a.m. UTC | #1
On Thu, 17 Jun 2021 08:50:54 -0300
Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> It breaks the usage case of live migration like CRIU or similar.
> The performance drawback is it would require an extra syscall
> on older kernels without 64-bit time support.
> 
> Checked on i686-linux-gnu on a 4.15 kernel and on a 5.11 kernel
> (with and without --enable-kernel=5.1) and on x86_64-linux-gnu.
> ---
>  sysdeps/unix/sysv/linux/clock_gettime.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c
> b/sysdeps/unix/sysv/linux/clock_gettime.c index
> 781d05c2fd..cfe9370455 100644 ---
> a/sysdeps/unix/sysv/linux/clock_gettime.c +++
> b/sysdeps/unix/sysv/linux/clock_gettime.c @@ -22,7 +22,6 @@
>  #include <time.h>
>  #include "kernel-posix-cpu-timers.h"
>  #include <sysdep-vdso.h>
> -#include <time64-support.h>
>  #include <shlib-compat.h>
>  
>  /* Get current value of CLOCK and store it in TP.  */
> @@ -35,19 +34,14 @@ __clock_gettime64 (clockid_t clock_id, struct
> __timespec64 *tp) # define __NR_clock_gettime64 __NR_clock_gettime
>  #endif
>  
> -  if (supports_time64 ())
> -    {
>  #ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
> -      r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
> +  r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
>  #else
> -      r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
> +  r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
>  #endif
>  
> -      if (r == 0 || errno != ENOSYS)
> -	return r;
> -
> -      mark_time64_unsupported ();
> -   }
> +  if (r == 0 || errno != ENOSYS)
> +    return r;
>  
>  #ifndef __ASSUME_TIME64_SYSCALLS
>    /* Fallback code that uses 32-bit support.  */

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 781d05c2fd..cfe9370455 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -22,7 +22,6 @@ 
 #include <time.h>
 #include "kernel-posix-cpu-timers.h"
 #include <sysdep-vdso.h>
-#include <time64-support.h>
 #include <shlib-compat.h>
 
 /* Get current value of CLOCK and store it in TP.  */
@@ -35,19 +34,14 @@  __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
 # define __NR_clock_gettime64 __NR_clock_gettime
 #endif
 
-  if (supports_time64 ())
-    {
 #ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
-      r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
+  r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
 #else
-      r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
+  r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
 #endif
 
-      if (r == 0 || errno != ENOSYS)
-	return r;
-
-      mark_time64_unsupported ();
-   }
+  if (r == 0 || errno != ENOSYS)
+    return r;
 
 #ifndef __ASSUME_TIME64_SYSCALLS
   /* Fallback code that uses 32-bit support.  */