Hi Sebastian, Thank you for the patch! Yet something to improve: [auto build test ERROR on tip/locking/core] [also build test ERROR on linus/master v6.1-rc7 next-20221128] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Sebastian-Andrzej-Siewior/Re-Crash-with-PREEMPT_RT-on-aarch64-machine/20221129-000000 patch link: https://lore.kernel.org/r/Y4Tapja2qq8HiHBZ%40linutronix.de patch subject: Re: Crash with PREEMPT_RT on aarch64 machine config: hexagon-randconfig-r041-20221128 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6e4cea55f0d1104408b26ac574566a0e4de48036) 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/intel-lab-lkp/linux/commit/d4aea399f0b5472dc15a4c623d99b4ae79005050 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Sebastian-Andrzej-Siewior/Re-Crash-with-PREEMPT_RT-on-aarch64-machine/20221129-000000 git checkout d4aea399f0b5472dc15a4c623d99b4ae79005050 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All error/warnings (new ones prefixed by >>): In file included from kernel/locking/rtmutex_api.c:9: >> kernel/locking/rtmutex.c:100:15: error: incompatible integer to pointer conversion initializing 'typeof (*(__ai_ptr))' (aka 'struct task_struct *') with an expression of type 'unsigned long' [-Wint-conversion] WARN_ON_ONCE(cmpxchg_acquire(&lock->owner, RT_MUTEX_HAS_WAITERS, val) != RT_MUTEX_HAS_WAITERS); ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/atomic/atomic-instrumented.h:1923:2: note: expanded from macro 'cmpxchg_acquire' arch_cmpxchg_acquire(__ai_ptr, __VA_ARGS__); \ ^ include/linux/atomic/atomic-arch-fallback.h:35:30: note: expanded from macro 'arch_cmpxchg_acquire' #define arch_cmpxchg_acquire arch_cmpxchg ^ arch/hexagon/include/asm/cmpxchg.h:57:21: note: expanded from macro 'arch_cmpxchg' __typeof__(*(ptr)) __old = (old); \ ^ include/asm-generic/bug.h:180:41: note: expanded from macro 'WARN_ON_ONCE' #define WARN_ON_ONCE(condition) WARN_ON(condition) ~~~~~~~~^~~~~~~~~~ include/asm-generic/bug.h:167:25: note: expanded from macro 'WARN_ON' int __ret_warn_on = !!(condition); \ ^~~~~~~~~ In file included from kernel/locking/rtmutex_api.c:9: >> kernel/locking/rtmutex.c:100:15: error: incompatible integer to pointer conversion initializing 'typeof (*(__ai_ptr))' (aka 'struct task_struct *') with an expression of type 'unsigned long' [-Wint-conversion] WARN_ON_ONCE(cmpxchg_acquire(&lock->owner, RT_MUTEX_HAS_WAITERS, val) != RT_MUTEX_HAS_WAITERS); ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/atomic/atomic-instrumented.h:1923:2: note: expanded from macro 'cmpxchg_acquire' arch_cmpxchg_acquire(__ai_ptr, __VA_ARGS__); \ ^ include/linux/atomic/atomic-arch-fallback.h:35:30: note: expanded from macro 'arch_cmpxchg_acquire' #define arch_cmpxchg_acquire arch_cmpxchg ^ arch/hexagon/include/asm/cmpxchg.h:58:21: note: expanded from macro 'arch_cmpxchg' __typeof__(*(ptr)) __new = (new); \ ^ include/asm-generic/bug.h:180:41: note: expanded from macro 'WARN_ON_ONCE' #define WARN_ON_ONCE(condition) WARN_ON(condition) ~~~~~~~~^~~~~~~~~~ include/asm-generic/bug.h:167:25: note: expanded from macro 'WARN_ON' int __ret_warn_on = !!(condition); \ ^~~~~~~~~ In file included from kernel/locking/rtmutex_api.c:9: >> kernel/locking/rtmutex.c:100:72: warning: comparison between pointer and integer ('typeof (*(__ai_ptr))' (aka 'struct task_struct *') and 'unsigned long') [-Wpointer-integer-compare] WARN_ON_ONCE(cmpxchg_acquire(&lock->owner, RT_MUTEX_HAS_WAITERS, val) != RT_MUTEX_HAS_WAITERS); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/asm-generic/bug.h:180:41: note: expanded from macro 'WARN_ON_ONCE' #define WARN_ON_ONCE(condition) WARN_ON(condition) ~~~~~~~~^~~~~~~~~~ include/asm-generic/bug.h:167:25: note: expanded from macro 'WARN_ON' int __ret_warn_on = !!(condition); \ ^~~~~~~~~ In file included from kernel/locking/rtmutex_api.c:9: >> kernel/locking/rtmutex.c:117:2: error: incompatible integer to pointer conversion assigning to 'volatile typeof (lock->owner)' (aka 'struct task_struct *volatile') from 'unsigned long' [-Wint-conversion] WRITE_ONCE(lock->owner, val); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/asm-generic/rwonce.h:61:2: note: expanded from macro 'WRITE_ONCE' __WRITE_ONCE(x, val); \ ^~~~~~~~~~~~~~~~~~~~ include/asm-generic/rwonce.h:55:30: note: expanded from macro '__WRITE_ONCE' *(volatile typeof(x) *)&(x) = (val); \ ^ ~~~~~ 1 warning and 3 errors generated. vim +100 kernel/locking/rtmutex.c 64 65 /* 66 * lock->owner state tracking: 67 * 68 * lock->owner holds the task_struct pointer of the owner. Bit 0 69 * is used to keep track of the "lock has waiters" state. 70 * 71 * owner bit0 72 * NULL 0 lock is free (fast acquire possible) 73 * NULL 1 lock is free and has waiters and the top waiter 74 * is going to take the lock* 75 * taskpointer 0 lock is held (fast release possible) 76 * taskpointer 1 lock is held and has waiters** 77 * 78 * The fast atomic compare exchange based acquire and release is only 79 * possible when bit 0 of lock->owner is 0. 80 * 81 * (*) It also can be a transitional state when grabbing the lock 82 * with ->wait_lock is held. To prevent any fast path cmpxchg to the lock, 83 * we need to set the bit0 before looking at the lock, and the owner may be 84 * NULL in this small time, hence this can be a transitional state. 85 * 86 * (**) There is a small time when bit 0 is set but there are no 87 * waiters. This can happen when grabbing the lock in the slow path. 88 * To prevent a cmpxchg of the owner releasing the lock, we need to 89 * set this bit before looking at the lock. 90 */ 91 92 static __always_inline void 93 rt_mutex_set_owner(struct rt_mutex_base *lock, struct task_struct *owner) 94 { 95 unsigned long val = (unsigned long)owner; 96 97 if (rt_mutex_has_waiters(lock)) 98 val |= RT_MUTEX_HAS_WAITERS; 99 > 100 WARN_ON_ONCE(cmpxchg_acquire(&lock->owner, RT_MUTEX_HAS_WAITERS, val) != RT_MUTEX_HAS_WAITERS); 101 } 102 103 static __always_inline void clear_rt_mutex_waiters(struct rt_mutex_base *lock) 104 { 105 lock->owner = (struct task_struct *) 106 ((unsigned long)lock->owner & ~RT_MUTEX_HAS_WAITERS); 107 } 108 109 static __always_inline void 110 rt_mutex_set_owner_pi(struct rt_mutex_base *lock, struct task_struct *owner) 111 { 112 unsigned long val = (unsigned long)owner; 113 114 if (rt_mutex_has_waiters(lock)) 115 val |= RT_MUTEX_HAS_WAITERS; 116 > 117 WRITE_ONCE(lock->owner, val); 118 } 119 -- 0-DAY CI Kernel Test Service https://01.org/lkp