All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/vdso: fix clock_gettime_fallback for vdso32
@ 2021-01-11 15:18 ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2021-01-11 15:18 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Christophe Leroy, linux-kernel

The second argument of __kernel_clock_gettime64 points to a struct
__kernel_timespec, with 64-bit time_t, so use the clock_gettime64 syscall
in the fallback function for the 32-bit vdso.  Similarily,
clock_getres_fallback should use the clock_getres_time64 syscall, though
it isn't yet called from the 32-bit vdso.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
 arch/powerpc/include/asm/vdso/gettimeofday.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h
index 81671aa365b3..a26c12df2c9a 100644
--- a/arch/powerpc/include/asm/vdso/gettimeofday.h
+++ b/arch/powerpc/include/asm/vdso/gettimeofday.h
@@ -106,13 +106,21 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
 static __always_inline
 int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
 {
+#ifndef __powerpc64__
+	return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
+#else
 	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
+#endif
 }
 
 static __always_inline
 int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
 {
+#ifndef __powerpc64__
+	return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
+#else
 	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
+#endif
 }
 
 #ifdef CONFIG_VDSO32
-- 
2.30.0


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] powerpc/vdso: fix clock_gettime_fallback for vdso32
@ 2021-01-11 15:18 ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2021-01-11 15:18 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras, linux-kernel

The second argument of __kernel_clock_gettime64 points to a struct
__kernel_timespec, with 64-bit time_t, so use the clock_gettime64 syscall
in the fallback function for the 32-bit vdso.  Similarily,
clock_getres_fallback should use the clock_getres_time64 syscall, though
it isn't yet called from the 32-bit vdso.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
 arch/powerpc/include/asm/vdso/gettimeofday.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h
index 81671aa365b3..a26c12df2c9a 100644
--- a/arch/powerpc/include/asm/vdso/gettimeofday.h
+++ b/arch/powerpc/include/asm/vdso/gettimeofday.h
@@ -106,13 +106,21 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
 static __always_inline
 int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
 {
+#ifndef __powerpc64__
+	return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
+#else
 	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
+#endif
 }
 
 static __always_inline
 int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
 {
+#ifndef __powerpc64__
+	return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
+#else
 	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
+#endif
 }
 
 #ifdef CONFIG_VDSO32
-- 
2.30.0


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/vdso: fix clock_gettime_fallback for vdso32
  2021-01-11 15:18 ` Andreas Schwab
@ 2021-01-11 16:43   ` Christophe Leroy
  -1 siblings, 0 replies; 4+ messages in thread
From: Christophe Leroy @ 2021-01-11 16:43 UTC (permalink / raw)
  To: Andreas Schwab, linuxppc-dev
  Cc: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras, linux-kernel



Le 11/01/2021 à 16:18, Andreas Schwab a écrit :
> The second argument of __kernel_clock_gettime64 points to a struct
> __kernel_timespec, with 64-bit time_t, so use the clock_gettime64 syscall
> in the fallback function for the 32-bit vdso.  Similarily,
> clock_getres_fallback should use the clock_getres_time64 syscall, though
> it isn't yet called from the 32-bit vdso.
> 
> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>

Fixes: d0e3fc69d00d ("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32")

> ---
>   arch/powerpc/include/asm/vdso/gettimeofday.h | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h
> index 81671aa365b3..a26c12df2c9a 100644
> --- a/arch/powerpc/include/asm/vdso/gettimeofday.h
> +++ b/arch/powerpc/include/asm/vdso/gettimeofday.h
> @@ -106,13 +106,21 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
>   static __always_inline
>   int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>   {
> +#ifndef __powerpc64__

I think we should do like x86, create a second version of clock_gettime_fallback() inside the #ifdef 
CONFIG_VDSO32, and move that one in a matching (non existing yet) #else

> +	return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
> +#else
>   	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
> +#endif
>   }
>   
>   static __always_inline
>   int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>   {
> +#ifndef __powerpc64__

Same.

> +	return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
> +#else
>   	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
> +#endif
>   }
>   
>   #ifdef CONFIG_VDSO32
> 

Christophe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/vdso: fix clock_gettime_fallback for vdso32
@ 2021-01-11 16:43   ` Christophe Leroy
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe Leroy @ 2021-01-11 16:43 UTC (permalink / raw)
  To: Andreas Schwab, linuxppc-dev; +Cc: Paul Mackerras, linux-kernel



Le 11/01/2021 à 16:18, Andreas Schwab a écrit :
> The second argument of __kernel_clock_gettime64 points to a struct
> __kernel_timespec, with 64-bit time_t, so use the clock_gettime64 syscall
> in the fallback function for the 32-bit vdso.  Similarily,
> clock_getres_fallback should use the clock_getres_time64 syscall, though
> it isn't yet called from the 32-bit vdso.
> 
> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>

Fixes: d0e3fc69d00d ("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32")

> ---
>   arch/powerpc/include/asm/vdso/gettimeofday.h | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h
> index 81671aa365b3..a26c12df2c9a 100644
> --- a/arch/powerpc/include/asm/vdso/gettimeofday.h
> +++ b/arch/powerpc/include/asm/vdso/gettimeofday.h
> @@ -106,13 +106,21 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
>   static __always_inline
>   int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>   {
> +#ifndef __powerpc64__

I think we should do like x86, create a second version of clock_gettime_fallback() inside the #ifdef 
CONFIG_VDSO32, and move that one in a matching (non existing yet) #else

> +	return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
> +#else
>   	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
> +#endif
>   }
>   
>   static __always_inline
>   int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>   {
> +#ifndef __powerpc64__

Same.

> +	return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
> +#else
>   	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
> +#endif
>   }
>   
>   #ifdef CONFIG_VDSO32
> 

Christophe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-11 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 15:18 [PATCH] powerpc/vdso: fix clock_gettime_fallback for vdso32 Andreas Schwab
2021-01-11 15:18 ` Andreas Schwab
2021-01-11 16:43 ` Christophe Leroy
2021-01-11 16:43   ` Christophe Leroy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.