linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 2524/3504] kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long')
@ 2024-04-03 21:13 kernel test robot
  2024-04-04 17:44 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2024-04-03 21:13 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: llvm, oe-kbuild-all, Linux Memory Management List

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   727900b675b749c40ba1f6669c7ae5eb7eb8e837
commit: df35ee400e06b23ecd44fdb66451a5343932f834 [2524/3504] riscv: Emulate one-byte and two-byte cmpxchg
config: riscv-nommu_virt_defconfig (https://download.01.org/0day-ci/archive/20240404/202404040526.GVzaL2io-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 546dc2245ffc4cccd0b05b58b7a5955e355a3b27)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240404/202404040526.GVzaL2io-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404040526.GVzaL2io-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from kernel/locking/rtmutex_api.c:9:
>> kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
    4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
     210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
      65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
         |                             ^
   arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
     264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     265 |                                         _o_, _n_, sizeof(*(ptr)));      \
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/cmpxchg.h:225:48: note: expanded from macro '__cmpxchg_acquire'
     225 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
         |                                                              ^~~~~
   include/linux/cmpxchg-emu.h:13:52: note: passing argument to parameter 'old' here
      13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
         |                                                    ^
   In file included from kernel/locking/rtmutex_api.c:9:
>> kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
    4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
     210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
      65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
         |                             ^
   arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
     264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     265 |                                         _o_, _n_, sizeof(*(ptr)));      \
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/cmpxchg.h:225:55: note: expanded from macro '__cmpxchg_acquire'
     225 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
         |                                                                     ^~~~~
   include/linux/cmpxchg-emu.h:13:67: note: passing argument to parameter 'new' here
      13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
         |                                                                   ^
   In file included from kernel/locking/rtmutex_api.c:9:
>> kernel/locking/rtmutex.c:218:9: error: incompatible integer to pointer conversion assigning to 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') from 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
    4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
     210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
      65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
         |                             ^
   arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
     264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     265 |                                         _o_, _n_, sizeof(*(ptr)));      \
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/cmpxchg.h:225:9: note: expanded from macro '__cmpxchg_acquire'
     225 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
         |                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from kernel/locking/rtmutex_api.c:9:
>> kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
    4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
     210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
      65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
         |                             ^
   arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
     264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     265 |                                         _o_, _n_, sizeof(*(ptr)));      \
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/cmpxchg.h:229:50: note: expanded from macro '__cmpxchg_acquire'
     229 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
         |                                                                ^~~~~
   include/linux/cmpxchg-emu.h:14:54: note: passing argument to parameter 'old' here
      14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new);
         |                                                      ^
   In file included from kernel/locking/rtmutex_api.c:9:
>> kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
    4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
     210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
      65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
         |                             ^
   arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
     264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     265 |                                         _o_, _n_, sizeof(*(ptr)));      \
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/cmpxchg.h:229:57: note: expanded from macro '__cmpxchg_acquire'
     229 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
         |                                                                       ^~~~~
   include/linux/cmpxchg-emu.h:14:69: note: passing argument to parameter 'new' here
      14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new);
         |                                                                     ^
   In file included from kernel/locking/rtmutex_api.c:9:
>> kernel/locking/rtmutex.c:218:9: error: incompatible integer to pointer conversion assigning to 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') from 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
    4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
     210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
      65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
         |                             ^
   arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
     264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     265 |                                         _o_, _n_, sizeof(*(ptr)));      \
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/cmpxchg.h:229:9: note: expanded from macro '__cmpxchg_acquire'
     229 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
         |                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from kernel/locking/rtmutex_api.c:9:
   kernel/locking/rtmutex.c:230:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     230 |         return try_cmpxchg_release(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4899:2: note: expanded from macro 'try_cmpxchg_release'
    4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:228:9: note: expanded from macro 'raw_try_cmpxchg_release'
     228 |         ___r = raw_cmpxchg_release((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:77:29: note: expanded from macro 'raw_cmpxchg_release'
      77 | #define raw_cmpxchg_release arch_cmpxchg_release
         |                             ^
   arch/riscv/include/asm/cmpxchg.h:316:23: note: expanded from macro 'arch_cmpxchg_release'
     316 |         (__typeof__(*(ptr))) __cmpxchg_release((ptr),                   \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     317 |                                         _o_, _n_, sizeof(*(ptr)));      \
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/cmpxchg.h:277:48: note: expanded from macro '__cmpxchg_release'
     277 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
         |                                                              ^~~~~
   include/linux/cmpxchg-emu.h:13:52: note: passing argument to parameter 'old' here
      13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
         |                                                    ^
   In file included from kernel/locking/rtmutex_api.c:9:
   kernel/locking/rtmutex.c:230:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     230 |         return try_cmpxchg_release(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4899:2: note: expanded from macro 'try_cmpxchg_release'
    4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:228:9: note: expanded from macro 'raw_try_cmpxchg_release'
     228 |         ___r = raw_cmpxchg_release((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:77:29: note: expanded from macro 'raw_cmpxchg_release'
      77 | #define raw_cmpxchg_release arch_cmpxchg_release
         |                             ^
   arch/riscv/include/asm/cmpxchg.h:316:23: note: expanded from macro 'arch_cmpxchg_release'
     316 |         (__typeof__(*(ptr))) __cmpxchg_release((ptr),                   \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     317 |                                         _o_, _n_, sizeof(*(ptr)));      \
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/cmpxchg.h:277:55: note: expanded from macro '__cmpxchg_release'
     277 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
         |                                                                     ^~~~~
   include/linux/cmpxchg-emu.h:13:67: note: passing argument to parameter 'new' here
      13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
         |                                                                   ^
   In file included from kernel/locking/rtmutex_api.c:9:
   kernel/locking/rtmutex.c:230:9: error: incompatible integer to pointer conversion assigning to 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') from 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     230 |         return try_cmpxchg_release(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4899:2: note: expanded from macro 'try_cmpxchg_release'
    4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:228:9: note: expanded from macro 'raw_try_cmpxchg_release'
     228 |         ___r = raw_cmpxchg_release((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:77:29: note: expanded from macro 'raw_cmpxchg_release'
      77 | #define raw_cmpxchg_release arch_cmpxchg_release
         |                             ^
   arch/riscv/include/asm/cmpxchg.h:316:23: note: expanded from macro 'arch_cmpxchg_release'
     316 |         (__typeof__(*(ptr))) __cmpxchg_release((ptr),                   \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     317 |                                         _o_, _n_, sizeof(*(ptr)));      \
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/cmpxchg.h:277:9: note: expanded from macro '__cmpxchg_release'
     277 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
         |                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from kernel/locking/rtmutex_api.c:9:
   kernel/locking/rtmutex.c:230:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
     230 |         return try_cmpxchg_release(&lock->owner, &old, new);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-instrumented.h:4899:2: note: expanded from macro 'try_cmpxchg_release'
    4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:228:9: note: expanded from macro 'raw_try_cmpxchg_release'
     228 |         ___r = raw_cmpxchg_release((_ptr), ___o, (_new)); \
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:77:29: note: expanded from macro 'raw_cmpxchg_release'
      77 | #define raw_cmpxchg_release arch_cmpxchg_release


vim +218 kernel/locking/rtmutex.c

23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  208  
bd197234b0a616 kernel/rtmutex.c         Thomas Gleixner           2007-06-17  209  /*
cede88418b385b kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2015-02-25  210   * We can speed up the acquire/release, if there's no debugging state to be
cede88418b385b kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2015-02-25  211   * set up.
bd197234b0a616 kernel/rtmutex.c         Thomas Gleixner           2007-06-17  212   */
cede88418b385b kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2015-02-25  213  #ifndef CONFIG_DEBUG_RT_MUTEXES
830e6acc8a1caf kernel/locking/rtmutex.c Peter Zijlstra            2021-08-15  214  static __always_inline bool rt_mutex_cmpxchg_acquire(struct rt_mutex_base *lock,
785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  215  						     struct task_struct *old,
785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  216  						     struct task_struct *new)
785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  217  {
709e0b62869f62 kernel/locking/rtmutex.c Thomas Gleixner           2021-08-15 @218  	return try_cmpxchg_acquire(&lock->owner, &old, new);
785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  219  }
785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  220  

:::::: The code at line 218 was first introduced by commit
:::::: 709e0b62869f625afd18edd79f190c38cb39dfb2 locking/rtmutex: Switch to from cmpxchg_*() to try_cmpxchg_*()

:::::: TO: Thomas Gleixner <tglx@linutronix.de>
:::::: CC: Ingo Molnar <mingo@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


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

* Re: [linux-next:master 2524/3504] kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long')
  2024-04-03 21:13 [linux-next:master 2524/3504] kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') kernel test robot
@ 2024-04-04 17:44 ` Paul E. McKenney
  2024-04-07  4:41   ` Liu, Yujie
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2024-04-04 17:44 UTC (permalink / raw)
  To: kernel test robot; +Cc: llvm, oe-kbuild-all, Linux Memory Management List

On Thu, Apr 04, 2024 at 05:13:20AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   727900b675b749c40ba1f6669c7ae5eb7eb8e837
> commit: df35ee400e06b23ecd44fdb66451a5343932f834 [2524/3504] riscv: Emulate one-byte and two-byte cmpxchg
> config: riscv-nommu_virt_defconfig (https://download.01.org/0day-ci/archive/20240404/202404040526.GVzaL2io-lkp@intel.com/config)
> compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 546dc2245ffc4cccd0b05b58b7a5955e355a3b27)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240404/202404040526.GVzaL2io-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202404040526.GVzaL2io-lkp@intel.com/

I believe that this is fixed by the following updated commit in -rcu:

27011e7159ef ("riscv: Emulate one-byte cmpxchg")

But please let me know if I am missing something.

							Thanx, Paul

> All errors (new ones prefixed by >>):
> 
>    In file included from kernel/locking/rtmutex_api.c:9:
> >> kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
>     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
>      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
>       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
>          |                             ^
>    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
>      264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
>          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      265 |                                         _o_, _n_, sizeof(*(ptr)));      \
>          |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/riscv/include/asm/cmpxchg.h:225:48: note: expanded from macro '__cmpxchg_acquire'
>      225 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
>          |                                                              ^~~~~
>    include/linux/cmpxchg-emu.h:13:52: note: passing argument to parameter 'old' here
>       13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
>          |                                                    ^
>    In file included from kernel/locking/rtmutex_api.c:9:
> >> kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
>     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
>      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
>       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
>          |                             ^
>    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
>      264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
>          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      265 |                                         _o_, _n_, sizeof(*(ptr)));      \
>          |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/riscv/include/asm/cmpxchg.h:225:55: note: expanded from macro '__cmpxchg_acquire'
>      225 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
>          |                                                                     ^~~~~
>    include/linux/cmpxchg-emu.h:13:67: note: passing argument to parameter 'new' here
>       13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
>          |                                                                   ^
>    In file included from kernel/locking/rtmutex_api.c:9:
> >> kernel/locking/rtmutex.c:218:9: error: incompatible integer to pointer conversion assigning to 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') from 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
>     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
>      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
>       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
>          |                             ^
>    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
>      264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
>          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      265 |                                         _o_, _n_, sizeof(*(ptr)));      \
>          |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/riscv/include/asm/cmpxchg.h:225:9: note: expanded from macro '__cmpxchg_acquire'
>      225 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
>          |                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    In file included from kernel/locking/rtmutex_api.c:9:
> >> kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
>     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
>      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
>       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
>          |                             ^
>    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
>      264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
>          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      265 |                                         _o_, _n_, sizeof(*(ptr)));      \
>          |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/riscv/include/asm/cmpxchg.h:229:50: note: expanded from macro '__cmpxchg_acquire'
>      229 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>          |                                                                ^~~~~
>    include/linux/cmpxchg-emu.h:14:54: note: passing argument to parameter 'old' here
>       14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new);
>          |                                                      ^
>    In file included from kernel/locking/rtmutex_api.c:9:
> >> kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
>     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
>      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
>       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
>          |                             ^
>    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
>      264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
>          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      265 |                                         _o_, _n_, sizeof(*(ptr)));      \
>          |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/riscv/include/asm/cmpxchg.h:229:57: note: expanded from macro '__cmpxchg_acquire'
>      229 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>          |                                                                       ^~~~~
>    include/linux/cmpxchg-emu.h:14:69: note: passing argument to parameter 'new' here
>       14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new);
>          |                                                                     ^
>    In file included from kernel/locking/rtmutex_api.c:9:
> >> kernel/locking/rtmutex.c:218:9: error: incompatible integer to pointer conversion assigning to 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') from 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      218 |         return try_cmpxchg_acquire(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4889:2: note: expanded from macro 'try_cmpxchg_acquire'
>     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:210:9: note: expanded from macro 'raw_try_cmpxchg_acquire'
>      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:65:29: note: expanded from macro 'raw_cmpxchg_acquire'
>       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
>          |                             ^
>    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from macro 'arch_cmpxchg_acquire'
>      264 |         (__typeof__(*(ptr))) __cmpxchg_acquire((ptr),                   \
>          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      265 |                                         _o_, _n_, sizeof(*(ptr)));      \
>          |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/riscv/include/asm/cmpxchg.h:229:9: note: expanded from macro '__cmpxchg_acquire'
>      229 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>          |                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    In file included from kernel/locking/rtmutex_api.c:9:
>    kernel/locking/rtmutex.c:230:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      230 |         return try_cmpxchg_release(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4899:2: note: expanded from macro 'try_cmpxchg_release'
>     4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:228:9: note: expanded from macro 'raw_try_cmpxchg_release'
>      228 |         ___r = raw_cmpxchg_release((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:77:29: note: expanded from macro 'raw_cmpxchg_release'
>       77 | #define raw_cmpxchg_release arch_cmpxchg_release
>          |                             ^
>    arch/riscv/include/asm/cmpxchg.h:316:23: note: expanded from macro 'arch_cmpxchg_release'
>      316 |         (__typeof__(*(ptr))) __cmpxchg_release((ptr),                   \
>          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      317 |                                         _o_, _n_, sizeof(*(ptr)));      \
>          |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/riscv/include/asm/cmpxchg.h:277:48: note: expanded from macro '__cmpxchg_release'
>      277 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
>          |                                                              ^~~~~
>    include/linux/cmpxchg-emu.h:13:52: note: passing argument to parameter 'old' here
>       13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
>          |                                                    ^
>    In file included from kernel/locking/rtmutex_api.c:9:
>    kernel/locking/rtmutex.c:230:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      230 |         return try_cmpxchg_release(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4899:2: note: expanded from macro 'try_cmpxchg_release'
>     4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:228:9: note: expanded from macro 'raw_try_cmpxchg_release'
>      228 |         ___r = raw_cmpxchg_release((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:77:29: note: expanded from macro 'raw_cmpxchg_release'
>       77 | #define raw_cmpxchg_release arch_cmpxchg_release
>          |                             ^
>    arch/riscv/include/asm/cmpxchg.h:316:23: note: expanded from macro 'arch_cmpxchg_release'
>      316 |         (__typeof__(*(ptr))) __cmpxchg_release((ptr),                   \
>          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      317 |                                         _o_, _n_, sizeof(*(ptr)));      \
>          |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/riscv/include/asm/cmpxchg.h:277:55: note: expanded from macro '__cmpxchg_release'
>      277 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
>          |                                                                     ^~~~~
>    include/linux/cmpxchg-emu.h:13:67: note: passing argument to parameter 'new' here
>       13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
>          |                                                                   ^
>    In file included from kernel/locking/rtmutex_api.c:9:
>    kernel/locking/rtmutex.c:230:9: error: incompatible integer to pointer conversion assigning to 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') from 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      230 |         return try_cmpxchg_release(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4899:2: note: expanded from macro 'try_cmpxchg_release'
>     4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:228:9: note: expanded from macro 'raw_try_cmpxchg_release'
>      228 |         ___r = raw_cmpxchg_release((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:77:29: note: expanded from macro 'raw_cmpxchg_release'
>       77 | #define raw_cmpxchg_release arch_cmpxchg_release
>          |                             ^
>    arch/riscv/include/asm/cmpxchg.h:316:23: note: expanded from macro 'arch_cmpxchg_release'
>      316 |         (__typeof__(*(ptr))) __cmpxchg_release((ptr),                   \
>          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      317 |                                         _o_, _n_, sizeof(*(ptr)));      \
>          |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/riscv/include/asm/cmpxchg.h:277:9: note: expanded from macro '__cmpxchg_release'
>      277 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
>          |                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    In file included from kernel/locking/rtmutex_api.c:9:
>    kernel/locking/rtmutex.c:230:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') [-Wint-conversion]
>      230 |         return try_cmpxchg_release(&lock->owner, &old, new);
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-instrumented.h:4899:2: note: expanded from macro 'try_cmpxchg_release'
>     4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:228:9: note: expanded from macro 'raw_try_cmpxchg_release'
>      228 |         ___r = raw_cmpxchg_release((_ptr), ___o, (_new)); \
>          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:77:29: note: expanded from macro 'raw_cmpxchg_release'
>       77 | #define raw_cmpxchg_release arch_cmpxchg_release
> 
> 
> vim +218 kernel/locking/rtmutex.c
> 
> 23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  208  
> bd197234b0a616 kernel/rtmutex.c         Thomas Gleixner           2007-06-17  209  /*
> cede88418b385b kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2015-02-25  210   * We can speed up the acquire/release, if there's no debugging state to be
> cede88418b385b kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2015-02-25  211   * set up.
> bd197234b0a616 kernel/rtmutex.c         Thomas Gleixner           2007-06-17  212   */
> cede88418b385b kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2015-02-25  213  #ifndef CONFIG_DEBUG_RT_MUTEXES
> 830e6acc8a1caf kernel/locking/rtmutex.c Peter Zijlstra            2021-08-15  214  static __always_inline bool rt_mutex_cmpxchg_acquire(struct rt_mutex_base *lock,
> 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  215  						     struct task_struct *old,
> 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  216  						     struct task_struct *new)
> 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  217  {
> 709e0b62869f62 kernel/locking/rtmutex.c Thomas Gleixner           2021-08-15 @218  	return try_cmpxchg_acquire(&lock->owner, &old, new);
> 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  219  }
> 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2021-08-15  220  
> 
> :::::: The code at line 218 was first introduced by commit
> :::::: 709e0b62869f625afd18edd79f190c38cb39dfb2 locking/rtmutex: Switch to from cmpxchg_*() to try_cmpxchg_*()
> 
> :::::: TO: Thomas Gleixner <tglx@linutronix.de>
> :::::: CC: Ingo Molnar <mingo@kernel.org>
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki


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

* Re: [linux-next:master 2524/3504] kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long')
  2024-04-04 17:44 ` Paul E. McKenney
@ 2024-04-07  4:41   ` Liu, Yujie
  2024-04-08 17:40     ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Liu, Yujie @ 2024-04-07  4:41 UTC (permalink / raw)
  To: paulmck, lkp; +Cc: linux-mm, llvm, oe-kbuild-all

Hi Paul,

On Thu, 2024-04-04 at 10:44 -0700, Paul E. McKenney wrote:
> On Thu, Apr 04, 2024 at 05:13:20AM +0800, kernel test robot wrote:
> > tree:  
> > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> >  master
> > head:   727900b675b749c40ba1f6669c7ae5eb7eb8e837
> > commit: df35ee400e06b23ecd44fdb66451a5343932f834 [2524/3504] riscv:
> > Emulate one-byte and two-byte cmpxchg
> > config: riscv-nommu_virt_defconfig
> > (https://download.01.org/0day-ci/archive/20240404/202404040526.GVza
> > L2io-lkp@intel.com/config)
> > compiler: clang version 19.0.0git
> > (https://github.com/llvm/llvm-project 546dc2245ffc4cccd0b05b58b7a59
> > 55e355a3b27)
> > reproduce (this is a W=1 build):
> > (https://download.01.org/0day-ci/archive/20240404/202404040526.GVza
> > L2io-lkp@intel.com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a
> > new version of
> > the same patch/commit), kindly add following tags
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Closes:
> > > https://lore.kernel.org/oe-kbuild-all/202404040526.GVzaL2io-lkp@intel.com/
> 
> I believe that this is fixed by the following updated commit in -rcu:
> 
> 27011e7159ef ("riscv: Emulate one-byte cmpxchg")
> 
> But please let me know if I am missing something.

Sorry for the delay of reply due to we were on public holidays in the
last few days.

The error still exists on the updated commit.

Commit 27011e7159ef added the uintptr_t cast for __old and __new only
in the first occurrence of __ret assignment, but missed that in the
remaining __ret assignments. Seems it needs another fixup as below:

-------------------------------------------------------------------

diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h
index abcd5543b861b..a9803825567cf 100644
--- a/arch/riscv/include/asm/cmpxchg.h
+++ b/arch/riscv/include/asm/cmpxchg.h
@@ -219,7 +219,7 @@
        register unsigned int __rc;                                     \
        switch (size) {                                                 \
        case 1:                                                         \
-               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
+               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
                break;                                                  \
        case 4:                                                         \
                __asm__ __volatile__ (                                  \
@@ -268,7 +268,7 @@
        register unsigned int __rc;                                     \
        switch (size) {                                                 \
        case 1:                                                         \
-               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
+               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
                break;                                                  \
        case 4:                                                         \
                __asm__ __volatile__ (                                  \
@@ -317,7 +317,7 @@
        register unsigned int __rc;                                     \
        switch (size) {                                                 \
        case 1:                                                         \
-               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
+               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
                break;                                                  \
        case 4:                                                         \
                __asm__ __volatile__ (                                  \

--
Thanks,
Yujie

>                                                         Thanx, Paul
> 
> > All errors (new ones prefixed by >>):
> > 
> >    In file included from kernel/locking/rtmutex_api.c:9:
> > > > kernel/locking/rtmutex.c:218:9: error: incompatible pointer to
> > > > integer conversion passing 'typeof (*(((__ai_ptr))))' (aka
> > > > 'struct task_struct *') to parameter of type 'uintptr_t' (aka
> > > > 'unsigned long') [-Wint-conversion]
> >      218 |         return try_cmpxchg_acquire(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4889:2: note:
> > expanded from macro 'try_cmpxchg_acquire'
> >     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:210:9: note:
> > expanded from macro 'raw_try_cmpxchg_acquire'
> >      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:65:29: note:
> > expanded from macro 'raw_cmpxchg_acquire'
> >       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
> >          |                             ^
> >    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from
> > macro 'arch_cmpxchg_acquire'
> >      264 |         (__typeof__(*(ptr)))
> > __cmpxchg_acquire((ptr),                   \
> >          |                             
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      265 |                                         _o_, _n_,
> > sizeof(*(ptr)));      \
> >          |                                        
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/riscv/include/asm/cmpxchg.h:225:48: note: expanded from
> > macro '__cmpxchg_acquire'
> >      225 |                 __ret = cmpxchg_emu_u8((volatile u8
> > *)__ptr, __old, __new); \
> >         
> > |                                                             
> > ^~~~~
> >    include/linux/cmpxchg-emu.h:13:52: note: passing argument to
> > parameter 'old' here
> >       13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old,
> > uintptr_t new);
> >          |                                                    ^
> >    In file included from kernel/locking/rtmutex_api.c:9:
> > > > kernel/locking/rtmutex.c:218:9: error: incompatible pointer to
> > > > integer conversion passing 'typeof (*(((__ai_ptr))))' (aka
> > > > 'struct task_struct *') to parameter of type 'uintptr_t' (aka
> > > > 'unsigned long') [-Wint-conversion]
> >      218 |         return try_cmpxchg_acquire(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4889:2: note:
> > expanded from macro 'try_cmpxchg_acquire'
> >     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:210:9: note:
> > expanded from macro 'raw_try_cmpxchg_acquire'
> >      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:65:29: note:
> > expanded from macro 'raw_cmpxchg_acquire'
> >       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
> >          |                             ^
> >    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from
> > macro 'arch_cmpxchg_acquire'
> >      264 |         (__typeof__(*(ptr)))
> > __cmpxchg_acquire((ptr),                   \
> >          |                             
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      265 |                                         _o_, _n_,
> > sizeof(*(ptr)));      \
> >          |                                        
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/riscv/include/asm/cmpxchg.h:225:55: note: expanded from
> > macro '__cmpxchg_acquire'
> >      225 |                 __ret = cmpxchg_emu_u8((volatile u8
> > *)__ptr, __old, __new); \
> >         
> > |                                                                  
> >    ^~~~~
> >    include/linux/cmpxchg-emu.h:13:67: note: passing argument to
> > parameter 'new' here
> >       13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old,
> > uintptr_t new);
> >         
> > |                                                                  
> > ^
> >    In file included from kernel/locking/rtmutex_api.c:9:
> > > > kernel/locking/rtmutex.c:218:9: error: incompatible integer to
> > > > pointer conversion assigning to 'typeof (*(((__ai_ptr))))' (aka
> > > > 'struct task_struct *') from 'uintptr_t' (aka 'unsigned long')
> > > > [-Wint-conversion]
> >      218 |         return try_cmpxchg_acquire(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4889:2: note:
> > expanded from macro 'try_cmpxchg_acquire'
> >     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:210:9: note:
> > expanded from macro 'raw_try_cmpxchg_acquire'
> >      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:65:29: note:
> > expanded from macro 'raw_cmpxchg_acquire'
> >       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
> >          |                             ^
> >    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from
> > macro 'arch_cmpxchg_acquire'
> >      264 |         (__typeof__(*(ptr)))
> > __cmpxchg_acquire((ptr),                   \
> >          |                             
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      265 |                                         _o_, _n_,
> > sizeof(*(ptr)));      \
> >          |                                        
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/riscv/include/asm/cmpxchg.h:225:9: note: expanded from
> > macro '__cmpxchg_acquire'
> >      225 |                 __ret = cmpxchg_emu_u8((volatile u8
> > *)__ptr, __old, __new); \
> >          |                       ^
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    In file included from kernel/locking/rtmutex_api.c:9:
> > > > kernel/locking/rtmutex.c:218:9: error: incompatible pointer to
> > > > integer conversion passing 'typeof (*(((__ai_ptr))))' (aka
> > > > 'struct task_struct *') to parameter of type 'uintptr_t' (aka
> > > > 'unsigned long') [-Wint-conversion]
> >      218 |         return try_cmpxchg_acquire(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4889:2: note:
> > expanded from macro 'try_cmpxchg_acquire'
> >     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:210:9: note:
> > expanded from macro 'raw_try_cmpxchg_acquire'
> >      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:65:29: note:
> > expanded from macro 'raw_cmpxchg_acquire'
> >       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
> >          |                             ^
> >    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from
> > macro 'arch_cmpxchg_acquire'
> >      264 |         (__typeof__(*(ptr)))
> > __cmpxchg_acquire((ptr),                   \
> >          |                             
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      265 |                                         _o_, _n_,
> > sizeof(*(ptr)));      \
> >          |                                        
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/riscv/include/asm/cmpxchg.h:229:50: note: expanded from
> > macro '__cmpxchg_acquire'
> >      229 |                 __ret = cmpxchg_emu_u16((volatile u16
> > *)__ptr, __old, __new); \
> >         
> > |                                                               
> > ^~~~~
> >    include/linux/cmpxchg-emu.h:14:54: note: passing argument to
> > parameter 'old' here
> >       14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t
> > old, uintptr_t new);
> >          |                                                      ^
> >    In file included from kernel/locking/rtmutex_api.c:9:
> > > > kernel/locking/rtmutex.c:218:9: error: incompatible pointer to
> > > > integer conversion passing 'typeof (*(((__ai_ptr))))' (aka
> > > > 'struct task_struct *') to parameter of type 'uintptr_t' (aka
> > > > 'unsigned long') [-Wint-conversion]
> >      218 |         return try_cmpxchg_acquire(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4889:2: note:
> > expanded from macro 'try_cmpxchg_acquire'
> >     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:210:9: note:
> > expanded from macro 'raw_try_cmpxchg_acquire'
> >      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:65:29: note:
> > expanded from macro 'raw_cmpxchg_acquire'
> >       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
> >          |                             ^
> >    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from
> > macro 'arch_cmpxchg_acquire'
> >      264 |         (__typeof__(*(ptr)))
> > __cmpxchg_acquire((ptr),                   \
> >          |                             
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      265 |                                         _o_, _n_,
> > sizeof(*(ptr)));      \
> >          |                                        
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/riscv/include/asm/cmpxchg.h:229:57: note: expanded from
> > macro '__cmpxchg_acquire'
> >      229 |                 __ret = cmpxchg_emu_u16((volatile u16
> > *)__ptr, __old, __new); \
> >         
> > |                                                                  
> >      ^~~~~
> >    include/linux/cmpxchg-emu.h:14:69: note: passing argument to
> > parameter 'new' here
> >       14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t
> > old, uintptr_t new);
> >         
> > |                                                                  
> >    ^
> >    In file included from kernel/locking/rtmutex_api.c:9:
> > > > kernel/locking/rtmutex.c:218:9: error: incompatible integer to
> > > > pointer conversion assigning to 'typeof (*(((__ai_ptr))))' (aka
> > > > 'struct task_struct *') from 'uintptr_t' (aka 'unsigned long')
> > > > [-Wint-conversion]
> >      218 |         return try_cmpxchg_acquire(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4889:2: note:
> > expanded from macro 'try_cmpxchg_acquire'
> >     4889 |         raw_try_cmpxchg_acquire(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:210:9: note:
> > expanded from macro 'raw_try_cmpxchg_acquire'
> >      210 |         ___r = raw_cmpxchg_acquire((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:65:29: note:
> > expanded from macro 'raw_cmpxchg_acquire'
> >       65 | #define raw_cmpxchg_acquire arch_cmpxchg_acquire
> >          |                             ^
> >    arch/riscv/include/asm/cmpxchg.h:264:23: note: expanded from
> > macro 'arch_cmpxchg_acquire'
> >      264 |         (__typeof__(*(ptr)))
> > __cmpxchg_acquire((ptr),                   \
> >          |                             
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      265 |                                         _o_, _n_,
> > sizeof(*(ptr)));      \
> >          |                                        
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/riscv/include/asm/cmpxchg.h:229:9: note: expanded from
> > macro '__cmpxchg_acquire'
> >      229 |                 __ret = cmpxchg_emu_u16((volatile u16
> > *)__ptr, __old, __new); \
> >          |                       ^
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    In file included from kernel/locking/rtmutex_api.c:9:
> >    kernel/locking/rtmutex.c:230:9: error: incompatible pointer to
> > integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct
> > task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned
> > long') [-Wint-conversion]
> >      230 |         return try_cmpxchg_release(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4899:2: note:
> > expanded from macro 'try_cmpxchg_release'
> >     4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:228:9: note:
> > expanded from macro 'raw_try_cmpxchg_release'
> >      228 |         ___r = raw_cmpxchg_release((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:77:29: note:
> > expanded from macro 'raw_cmpxchg_release'
> >       77 | #define raw_cmpxchg_release arch_cmpxchg_release
> >          |                             ^
> >    arch/riscv/include/asm/cmpxchg.h:316:23: note: expanded from
> > macro 'arch_cmpxchg_release'
> >      316 |         (__typeof__(*(ptr)))
> > __cmpxchg_release((ptr),                   \
> >          |                             
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      317 |                                         _o_, _n_,
> > sizeof(*(ptr)));      \
> >          |                                        
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/riscv/include/asm/cmpxchg.h:277:48: note: expanded from
> > macro '__cmpxchg_release'
> >      277 |                 __ret = cmpxchg_emu_u8((volatile u8
> > *)__ptr, __old, __new); \
> >         
> > |                                                             
> > ^~~~~
> >    include/linux/cmpxchg-emu.h:13:52: note: passing argument to
> > parameter 'old' here
> >       13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old,
> > uintptr_t new);
> >          |                                                    ^
> >    In file included from kernel/locking/rtmutex_api.c:9:
> >    kernel/locking/rtmutex.c:230:9: error: incompatible pointer to
> > integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct
> > task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned
> > long') [-Wint-conversion]
> >      230 |         return try_cmpxchg_release(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4899:2: note:
> > expanded from macro 'try_cmpxchg_release'
> >     4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:228:9: note:
> > expanded from macro 'raw_try_cmpxchg_release'
> >      228 |         ___r = raw_cmpxchg_release((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:77:29: note:
> > expanded from macro 'raw_cmpxchg_release'
> >       77 | #define raw_cmpxchg_release arch_cmpxchg_release
> >          |                             ^
> >    arch/riscv/include/asm/cmpxchg.h:316:23: note: expanded from
> > macro 'arch_cmpxchg_release'
> >      316 |         (__typeof__(*(ptr)))
> > __cmpxchg_release((ptr),                   \
> >          |                             
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      317 |                                         _o_, _n_,
> > sizeof(*(ptr)));      \
> >          |                                        
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/riscv/include/asm/cmpxchg.h:277:55: note: expanded from
> > macro '__cmpxchg_release'
> >      277 |                 __ret = cmpxchg_emu_u8((volatile u8
> > *)__ptr, __old, __new); \
> >         
> > |                                                                  
> >    ^~~~~
> >    include/linux/cmpxchg-emu.h:13:67: note: passing argument to
> > parameter 'new' here
> >       13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old,
> > uintptr_t new);
> >         
> > |                                                                  
> > ^
> >    In file included from kernel/locking/rtmutex_api.c:9:
> >    kernel/locking/rtmutex.c:230:9: error: incompatible integer to
> > pointer conversion assigning to 'typeof (*(((__ai_ptr))))' (aka
> > 'struct task_struct *') from 'uintptr_t' (aka 'unsigned long') [-
> > Wint-conversion]
> >      230 |         return try_cmpxchg_release(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4899:2: note:
> > expanded from macro 'try_cmpxchg_release'
> >     4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:228:9: note:
> > expanded from macro 'raw_try_cmpxchg_release'
> >      228 |         ___r = raw_cmpxchg_release((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:77:29: note:
> > expanded from macro 'raw_cmpxchg_release'
> >       77 | #define raw_cmpxchg_release arch_cmpxchg_release
> >          |                             ^
> >    arch/riscv/include/asm/cmpxchg.h:316:23: note: expanded from
> > macro 'arch_cmpxchg_release'
> >      316 |         (__typeof__(*(ptr)))
> > __cmpxchg_release((ptr),                   \
> >          |                             
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      317 |                                         _o_, _n_,
> > sizeof(*(ptr)));      \
> >          |                                        
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/riscv/include/asm/cmpxchg.h:277:9: note: expanded from
> > macro '__cmpxchg_release'
> >      277 |                 __ret = cmpxchg_emu_u8((volatile u8
> > *)__ptr, __old, __new); \
> >          |                       ^
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    In file included from kernel/locking/rtmutex_api.c:9:
> >    kernel/locking/rtmutex.c:230:9: error: incompatible pointer to
> > integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct
> > task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned
> > long') [-Wint-conversion]
> >      230 |         return try_cmpxchg_release(&lock->owner, &old,
> > new);
> >          |               
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-instrumented.h:4899:2: note:
> > expanded from macro 'try_cmpxchg_release'
> >     4899 |         raw_try_cmpxchg_release(__ai_ptr, __ai_oldp,
> > __VA_ARGS__); \
> >          |        
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:228:9: note:
> > expanded from macro 'raw_try_cmpxchg_release'
> >      228 |         ___r = raw_cmpxchg_release((_ptr), ___o,
> > (_new)); \
> >          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/linux/atomic/atomic-arch-fallback.h:77:29: note:
> > expanded from macro 'raw_cmpxchg_release'
> >       77 | #define raw_cmpxchg_release arch_cmpxchg_release
> > 
> > 
> > vim +218 kernel/locking/rtmutex.c
> > 
> > 23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar              
> > 2006-06-27  208  
> > bd197234b0a616 kernel/rtmutex.c         Thomas Gleixner          
> > 2007-06-17  209  /*
> > cede88418b385b kernel/locking/rtmutex.c Sebastian Andrzej Siewior
> > 2015-02-25  210   * We can speed up the acquire/release, if there's
> > no debugging state to be
> > cede88418b385b kernel/locking/rtmutex.c Sebastian Andrzej Siewior
> > 2015-02-25  211   * set up.
> > bd197234b0a616 kernel/rtmutex.c         Thomas Gleixner          
> > 2007-06-17  212   */
> > cede88418b385b kernel/locking/rtmutex.c Sebastian Andrzej Siewior
> > 2015-02-25  213  #ifndef CONFIG_DEBUG_RT_MUTEXES
> > 830e6acc8a1caf kernel/locking/rtmutex.c Peter Zijlstra           
> > 2021-08-15  214  static __always_inline bool
> > rt_mutex_cmpxchg_acquire(struct rt_mutex_base *lock,
> > 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior
> > 2021-08-15  215                                                   
> > struct task_struct *old,
> > 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior
> > 2021-08-15  216                                                   
> > struct task_struct *new)
> > 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior
> > 2021-08-15  217  {
> > 709e0b62869f62 kernel/locking/rtmutex.c Thomas Gleixner          
> > 2021-08-15 @218       return try_cmpxchg_acquire(&lock->owner,
> > &old, new);
> > 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior
> > 2021-08-15  219  }
> > 785159301bedea kernel/locking/rtmutex.c Sebastian Andrzej Siewior
> > 2021-08-15  220  
> > 
> > :::::: The code at line 218 was first introduced by commit
> > :::::: 709e0b62869f625afd18edd79f190c38cb39dfb2 locking/rtmutex:
> > Switch to from cmpxchg_*() to try_cmpxchg_*()
> > 
> > :::::: TO: Thomas Gleixner <tglx@linutronix.de>
> > :::::: CC: Ingo Molnar <mingo@kernel.org>
> > 
> > -- 
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
> 


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

* Re: [linux-next:master 2524/3504] kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long')
  2024-04-07  4:41   ` Liu, Yujie
@ 2024-04-08 17:40     ` Paul E. McKenney
  0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2024-04-08 17:40 UTC (permalink / raw)
  To: Liu, Yujie; +Cc: lkp, linux-mm, llvm, oe-kbuild-all

On Sun, Apr 07, 2024 at 04:41:02AM +0000, Liu, Yujie wrote:
> Hi Paul,
> 
> On Thu, 2024-04-04 at 10:44 -0700, Paul E. McKenney wrote:
> > On Thu, Apr 04, 2024 at 05:13:20AM +0800, kernel test robot wrote:
> > > tree:  
> > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> > >  master
> > > head:   727900b675b749c40ba1f6669c7ae5eb7eb8e837
> > > commit: df35ee400e06b23ecd44fdb66451a5343932f834 [2524/3504] riscv:
> > > Emulate one-byte and two-byte cmpxchg
> > > config: riscv-nommu_virt_defconfig
> > > (https://download.01.org/0day-ci/archive/20240404/202404040526.GVza
> > > L2io-lkp@intel.com/config)
> > > compiler: clang version 19.0.0git
> > > (https://github.com/llvm/llvm-project 546dc2245ffc4cccd0b05b58b7a59
> > > 55e355a3b27)
> > > reproduce (this is a W=1 build):
> > > (https://download.01.org/0day-ci/archive/20240404/202404040526.GVza
> > > L2io-lkp@intel.com/reproduce)
> > > 
> > > If you fix the issue in a separate patch/commit (i.e. not just a
> > > new version of
> > > the same patch/commit), kindly add following tags
> > > > Reported-by: kernel test robot <lkp@intel.com>
> > > > Closes:
> > > > https://lore.kernel.org/oe-kbuild-all/202404040526.GVzaL2io-lkp@intel.com/
> > 
> > I believe that this is fixed by the following updated commit in -rcu:
> > 
> > 27011e7159ef ("riscv: Emulate one-byte cmpxchg")
> > 
> > But please let me know if I am missing something.
> 
> Sorry for the delay of reply due to we were on public holidays in the
> last few days.
> 
> The error still exists on the updated commit.
> 
> Commit 27011e7159ef added the uintptr_t cast for __old and __new only
> in the first occurrence of __ret assignment, but missed that in the
> remaining __ret assignments. Seems it needs another fixup as below:
> 
> -------------------------------------------------------------------
> 
> diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h
> index abcd5543b861b..a9803825567cf 100644
> --- a/arch/riscv/include/asm/cmpxchg.h
> +++ b/arch/riscv/include/asm/cmpxchg.h
> @@ -219,7 +219,7 @@
>         register unsigned int __rc;                                     \
>         switch (size) {                                                 \
>         case 1:                                                         \
> -               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
> +               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
>                 break;                                                  \
>         case 4:                                                         \
>                 __asm__ __volatile__ (                                  \
> @@ -268,7 +268,7 @@
>         register unsigned int __rc;                                     \
>         switch (size) {                                                 \
>         case 1:                                                         \
> -               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
> +               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
>                 break;                                                  \
>         case 4:                                                         \
>                 __asm__ __volatile__ (                                  \
> @@ -317,7 +317,7 @@
>         register unsigned int __rc;                                     \
>         switch (size) {                                                 \
>         case 1:                                                         \
> -               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
> +               __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
>                 break;                                                  \
>         case 4:                                                         \
>                 __asm__ __volatile__ (                                  \
> 

Applied with attribution, thank you!

Quite the variety of casts required by the various architectures.  ;-)

Please see below for the updated patch.

							Thanx, Paul

------------------------------------------------------------------------

commit 4d5c72a34948625caf85c00b1db85372f4edbcae
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Wed Mar 27 17:13:02 2024 -0700

    riscv: Emulate one-byte cmpxchg
    
    Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on riscv.
    
    [ paulmck: Apply kernel test robot feedback, additional casts from Liu, Yujie. ]
    [ paulmck: Drop two-byte support per Arnd Bergmann feedback. ]
    
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Tested-by: Yujie Liu <yujie.liu@intel.com>
    Cc: Andi Shyti <andi.shyti@linux.intel.com>
    Cc: Andrzej Hajda <andrzej.hajda@intel.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: <linux-riscv@lists.infradead.org>
    Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index be09c8836d56b..3bab9c5c0f465 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -44,6 +44,7 @@ config RISCV
 	select ARCH_HAS_UBSAN
 	select ARCH_HAS_VDSO_DATA
 	select ARCH_KEEP_MEMBLOCK if ACPI
+	select ARCH_NEED_CMPXCHG_1_EMU
 	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
 	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
 	select ARCH_STACKWALK
diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h
index 2fee65cc84432..a9803825567cf 100644
--- a/arch/riscv/include/asm/cmpxchg.h
+++ b/arch/riscv/include/asm/cmpxchg.h
@@ -9,6 +9,7 @@
 #include <linux/bug.h>
 
 #include <asm/fence.h>
+#include <linux/cmpxchg-emu.h>
 
 #define __xchg_relaxed(ptr, new, size)					\
 ({									\
@@ -170,6 +171,9 @@
 	__typeof__(*(ptr)) __ret;					\
 	register unsigned int __rc;					\
 	switch (size) {							\
+	case 1:								\
+		__ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
+		break;							\
 	case 4:								\
 		__asm__ __volatile__ (					\
 			"0:	lr.w %0, %2\n"				\
@@ -214,6 +218,9 @@
 	__typeof__(*(ptr)) __ret;					\
 	register unsigned int __rc;					\
 	switch (size) {							\
+	case 1:								\
+		__ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
+		break;							\
 	case 4:								\
 		__asm__ __volatile__ (					\
 			"0:	lr.w %0, %2\n"				\
@@ -260,6 +267,9 @@
 	__typeof__(*(ptr)) __ret;					\
 	register unsigned int __rc;					\
 	switch (size) {							\
+	case 1:								\
+		__ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
+		break;							\
 	case 4:								\
 		__asm__ __volatile__ (					\
 			RISCV_RELEASE_BARRIER				\
@@ -306,6 +316,9 @@
 	__typeof__(*(ptr)) __ret;					\
 	register unsigned int __rc;					\
 	switch (size) {							\
+	case 1:								\
+		__ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \
+		break;							\
 	case 4:								\
 		__asm__ __volatile__ (					\
 			"0:	lr.w %0, %2\n"				\


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

end of thread, other threads:[~2024-04-08 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03 21:13 [linux-next:master 2524/3504] kernel/locking/rtmutex.c:218:9: error: incompatible pointer to integer conversion passing 'typeof (*(((__ai_ptr))))' (aka 'struct task_struct *') to parameter of type 'uintptr_t' (aka 'unsigned long') kernel test robot
2024-04-04 17:44 ` Paul E. McKenney
2024-04-07  4:41   ` Liu, Yujie
2024-04-08 17:40     ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox