linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] powerpc/vdso: fix clock_gettime_fallback for vdso32
@ 2021-01-11 16:52 Christophe Leroy
  2021-01-11 22:19 ` kernel test robot
  2021-01-12  1:13 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe Leroy @ 2021-01-11 16:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, schwab
  Cc: linux-kernel, linuxppc-dev

From: Andreas Schwab <schwab@linux-m68k.org>

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>
[chleroy: Moved into the #ifdef CONFIG_VDSO32 block]
Fixes: d0e3fc69d00d ("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/vdso/gettimeofday.h | 27 +++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h
index 7a215cc5da77..3ecddd9c6302 100644
--- a/arch/powerpc/include/asm/vdso/gettimeofday.h
+++ b/arch/powerpc/include/asm/vdso/gettimeofday.h
@@ -102,22 +102,22 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
 	return do_syscall_2(__NR_gettimeofday, (unsigned long)_tv, (unsigned long)_tz);
 }
 
+#ifdef CONFIG_VDSO32
+
+#define BUILD_VDSO32		1
+
 static __always_inline
 int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
 {
-	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
+	return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
 }
 
 static __always_inline
 int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
 {
-	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
+	return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
 }
 
-#ifdef CONFIG_VDSO32
-
-#define BUILD_VDSO32		1
-
 static __always_inline
 int clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
 {
@@ -129,6 +129,21 @@ int clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
 {
 	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
 }
+
+#else
+
+static __always_inline
+int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
+{
+	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
+}
+
+static __always_inline
+int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
+{
+	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
+}
+
 #endif
 
 static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
-- 
2.25.0


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

* Re: [PATCH v2] powerpc/vdso: fix clock_gettime_fallback for vdso32
  2021-01-11 16:52 [PATCH v2] powerpc/vdso: fix clock_gettime_fallback for vdso32 Christophe Leroy
@ 2021-01-11 22:19 ` kernel test robot
  2021-01-12  1:13 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-01-11 22:19 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, schwab
  Cc: kbuild-all, linuxppc-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 5962 bytes --]

Hi Christophe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v5.11-rc3 next-20210111]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/powerpc-vdso-fix-clock_gettime_fallback-for-vdso32/20210112-005359
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/49b084da4df1e1cf12240826b7d6db743c761e7c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Christophe-Leroy/powerpc-vdso-fix-clock_gettime_fallback-for-vdso32/20210112-005359
        git checkout 49b084da4df1e1cf12240826b7d6db743c761e7c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/vdso/datapage.h:137,
                    from arch/powerpc/include/asm/vdso_datapage.h:39,
                    from arch/powerpc/kernel/asm-offsets.c:37:
   arch/powerpc/include/asm/vdso/gettimeofday.h: In function 'clock_gettime_fallback':
>> arch/powerpc/include/asm/vdso/gettimeofday.h:113:22: error: '__NR_clock_gettime64' undeclared (first use in this function)
     113 |  return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
         |                      ^~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/vdso/gettimeofday.h:113:22: note: each undeclared identifier is reported only once for each function it appears in
   arch/powerpc/include/asm/vdso/gettimeofday.h: In function 'clock_getres_fallback':
>> arch/powerpc/include/asm/vdso/gettimeofday.h:119:22: error: '__NR_clock_getres_time64' undeclared (first use in this function)
     119 |  return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
         |                      ^~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/vdso/datapage.h:137,
                    from arch/powerpc/include/asm/vdso_datapage.h:39,
                    from arch/powerpc/kernel/asm-offsets.c:37:
   arch/powerpc/include/asm/vdso/gettimeofday.h: In function 'clock_gettime_fallback':
>> arch/powerpc/include/asm/vdso/gettimeofday.h:113:22: error: '__NR_clock_gettime64' undeclared (first use in this function)
     113 |  return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
         |                      ^~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/vdso/gettimeofday.h:113:22: note: each undeclared identifier is reported only once for each function it appears in
   arch/powerpc/include/asm/vdso/gettimeofday.h: In function 'clock_getres_fallback':
>> arch/powerpc/include/asm/vdso/gettimeofday.h:119:22: error: '__NR_clock_getres_time64' undeclared (first use in this function)
     119 |  return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
         |                      ^~~~~~~~~~~~~~~~~~~~~~~~
   make[2]: *** [scripts/Makefile.build:117: arch/powerpc/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [Makefile:1206: prepare0] Error 2
   make[1]: Target 'modules_prepare' not remade because of errors.
   make: *** [Makefile:185: __sub-make] Error 2
   make: Target 'modules_prepare' not remade because of errors.
--
   In file included from include/vdso/datapage.h:137,
                    from arch/powerpc/include/asm/vdso_datapage.h:39,
                    from arch/powerpc/kernel/asm-offsets.c:37:
   arch/powerpc/include/asm/vdso/gettimeofday.h: In function 'clock_gettime_fallback':
>> arch/powerpc/include/asm/vdso/gettimeofday.h:113:22: error: '__NR_clock_gettime64' undeclared (first use in this function)
     113 |  return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
         |                      ^~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/vdso/gettimeofday.h:113:22: note: each undeclared identifier is reported only once for each function it appears in
   arch/powerpc/include/asm/vdso/gettimeofday.h: In function 'clock_getres_fallback':
>> arch/powerpc/include/asm/vdso/gettimeofday.h:119:22: error: '__NR_clock_getres_time64' undeclared (first use in this function)
     119 |  return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
         |                      ^~~~~~~~~~~~~~~~~~~~~~~~
   make[2]: *** [scripts/Makefile.build:117: arch/powerpc/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [Makefile:1206: prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:185: __sub-make] Error 2
   make: Target 'prepare' not remade because of errors.


vim +/__NR_clock_gettime64 +113 arch/powerpc/include/asm/vdso/gettimeofday.h

   109	
   110	static __always_inline
   111	int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
   112	{
 > 113		return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
   114	}
   115	
   116	static __always_inline
   117	int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
   118	{
 > 119		return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
   120	}
   121	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 72492 bytes --]

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

* Re: [PATCH v2] powerpc/vdso: fix clock_gettime_fallback for vdso32
  2021-01-11 16:52 [PATCH v2] powerpc/vdso: fix clock_gettime_fallback for vdso32 Christophe Leroy
  2021-01-11 22:19 ` kernel test robot
@ 2021-01-12  1:13 ` Michael Ellerman
  2021-01-12 12:48   ` Christophe Leroy
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2021-01-12  1:13 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras, schwab
  Cc: linux-kernel, linuxppc-dev

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> From: Andreas Schwab <schwab@linux-m68k.org>
>
> 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>
> [chleroy: Moved into the #ifdef CONFIG_VDSO32 block]

That doesn't build for 64-bit with compat VDSO. Should I just take
Andreas' version, or do you want to send a v3?

cheers

> Fixes: d0e3fc69d00d ("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32")
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>  arch/powerpc/include/asm/vdso/gettimeofday.h | 27 +++++++++++++++-----
>  1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h
> index 7a215cc5da77..3ecddd9c6302 100644
> --- a/arch/powerpc/include/asm/vdso/gettimeofday.h
> +++ b/arch/powerpc/include/asm/vdso/gettimeofday.h
> @@ -102,22 +102,22 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
>  	return do_syscall_2(__NR_gettimeofday, (unsigned long)_tv, (unsigned long)_tz);
>  }
>  
> +#ifdef CONFIG_VDSO32
> +
> +#define BUILD_VDSO32		1
> +
>  static __always_inline
>  int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>  {
> -	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
> +	return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
>  }
>  
>  static __always_inline
>  int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>  {
> -	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
> +	return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
>  }
>  
> -#ifdef CONFIG_VDSO32
> -
> -#define BUILD_VDSO32		1
> -
>  static __always_inline
>  int clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
>  {
> @@ -129,6 +129,21 @@ int clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
>  {
>  	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
>  }
> +
> +#else
> +
> +static __always_inline
> +int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
> +{
> +	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
> +}
> +
> +static __always_inline
> +int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
> +{
> +	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
> +}
> +
>  #endif
>  
>  static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
> -- 
> 2.25.0

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

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



Le 12/01/2021 à 02:13, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> From: Andreas Schwab <schwab@linux-m68k.org>
>>
>> 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>
>> [chleroy: Moved into the #ifdef CONFIG_VDSO32 block]
> 
> That doesn't build for 64-bit with compat VDSO. Should I just take
> Andreas' version, or do you want to send a v3?

Yes, that #ifdef CONFIG_VDSO32 is crazy, should use __powerpc64__ instead, or __VDSO32__ but that 
one is defined in asflags-y so not sure we have it in C.

I sent v3 just before lunch.

Christophe

> 
> cheers
> 
>> Fixes: d0e3fc69d00d ("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32")
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>>   arch/powerpc/include/asm/vdso/gettimeofday.h | 27 +++++++++++++++-----
>>   1 file changed, 21 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h
>> index 7a215cc5da77..3ecddd9c6302 100644
>> --- a/arch/powerpc/include/asm/vdso/gettimeofday.h
>> +++ b/arch/powerpc/include/asm/vdso/gettimeofday.h
>> @@ -102,22 +102,22 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
>>   	return do_syscall_2(__NR_gettimeofday, (unsigned long)_tv, (unsigned long)_tz);
>>   }
>>   
>> +#ifdef CONFIG_VDSO32
>> +
>> +#define BUILD_VDSO32		1
>> +
>>   static __always_inline
>>   int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>>   {
>> -	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
>> +	return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
>>   }
>>   
>>   static __always_inline
>>   int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>>   {
>> -	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
>> +	return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
>>   }
>>   
>> -#ifdef CONFIG_VDSO32
>> -
>> -#define BUILD_VDSO32		1
>> -
>>   static __always_inline
>>   int clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
>>   {
>> @@ -129,6 +129,21 @@ int clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
>>   {
>>   	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
>>   }
>> +
>> +#else
>> +
>> +static __always_inline
>> +int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>> +{
>> +	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
>> +}
>> +
>> +static __always_inline
>> +int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>> +{
>> +	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
>> +}
>> +
>>   #endif
>>   
>>   static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
>> -- 
>> 2.25.0

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

end of thread, other threads:[~2021-01-12 12:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 16:52 [PATCH v2] powerpc/vdso: fix clock_gettime_fallback for vdso32 Christophe Leroy
2021-01-11 22:19 ` kernel test robot
2021-01-12  1:13 ` Michael Ellerman
2021-01-12 12:48   ` Christophe Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).