Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locking/rwlock: Fix write_trylock_irqsave() with CONFIG_INLINE_WRITE_TRYLOCK

Move _raw_write_trylock_irqsave() after the _raw_write_trylock macro to
ensure it uses the inlined version, fixing a linker error when inlining
is enabled. This is the case on s390:

>> ld.lld: error: undefined symbol: _raw_write_trylock
>>> referenced by rwlock_api_smp.h:48 (include/linux/rwlock_api_smp.h:48)
>>> lib/test_context-analysis.o:(test_write_trylock_extra) in archive vmlinux.a
>>> referenced by rwlock_api_smp.h:48 (include/linux/rwlock_api_smp.h:48)
>>> lib/test_context-analysis.o:(test_write_trylock_extra) in archive vmlinux.a

Closes: https://lore.kernel.org/oe-kbuild-all/202602032101.dbxRfsWO-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20260203225114.3493538-1-elver@google.com

authored by

Marco Elver and committed by
Peter Zijlstra
7a562d5d 451c3a03

+10 -10
+10 -10
include/linux/rwlock_api_smp.h
··· 41 41 _raw_write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 42 42 __releases(lock); 43 43 44 - static inline bool _raw_write_trylock_irqsave(rwlock_t *lock, unsigned long *flags) 45 - __cond_acquires(true, lock) 46 - { 47 - local_irq_save(*flags); 48 - if (_raw_write_trylock(lock)) 49 - return true; 50 - local_irq_restore(*flags); 51 - return false; 52 - } 53 - 54 44 #ifdef CONFIG_INLINE_READ_LOCK 55 45 #define _raw_read_lock(lock) __raw_read_lock(lock) 56 46 #endif ··· 135 145 } 136 146 preempt_enable(); 137 147 return 0; 148 + } 149 + 150 + static inline bool _raw_write_trylock_irqsave(rwlock_t *lock, unsigned long *flags) 151 + __cond_acquires(true, lock) __no_context_analysis 152 + { 153 + local_irq_save(*flags); 154 + if (_raw_write_trylock(lock)) 155 + return true; 156 + local_irq_restore(*flags); 157 + return false; 138 158 } 139 159 140 160 /*