Skip to content

Commit

Permalink
s390/atomic,cmpxchg: always inline __xchg/__cmpxchg
Browse files Browse the repository at this point in the history
Make sure to always inline __xchg() and __cmpxchg() otherwise the
compiler might decide to generate out-of-line versions which will
fail at link time:

   s390-linux-ld: lib/atomic64_test.o: in function `__xchg':
>> atomic64_test.c:(.text.unlikely+0xa4): undefined reference to `__xchg_called_with_bad_pointer'

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/linux-mm/202104170449.SIIFKVjT-lkp@intel.com/
Fixes: d2b1f6d ("s390/cmpxchg: get rid of gcc atomic builtins")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
  • Loading branch information
Heiko Carstens committed Apr 18, 2021
1 parent b44913f commit a637b3b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arch/s390/include/asm/cmpxchg.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

void __xchg_called_with_bad_pointer(void);

static inline unsigned long __xchg(unsigned long x, unsigned long address, int size)
static __always_inline unsigned long __xchg(unsigned long x,
unsigned long address, int size)
{
unsigned long old;
int shift;
Expand Down Expand Up @@ -83,8 +84,9 @@ static inline unsigned long __xchg(unsigned long x, unsigned long address, int s

void __cmpxchg_called_with_bad_pointer(void);

static inline unsigned long __cmpxchg(unsigned long address, unsigned long old,
unsigned long new, int size)
static __always_inline unsigned long __cmpxchg(unsigned long address,
unsigned long old,
unsigned long new, int size)
{
unsigned long prev, tmp;
int shift;
Expand Down

0 comments on commit a637b3b

Please sign in to comment.