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

s390/alternatives: make use of asm_inline

This is the s390 version of commit 40576e5e63ea ("x86: alternative.h:
use asm_inline for all alternative variants").

See commit eb111869301e ("compiler-types.h: add asm_inline
definition") for more details.

With this change the compiler will not generate many out-of-line
versions for the three instruction sized arch_spin_unlock() function
anymore. Due to this gcc seems to change a lot of other inline
decisions which results in a net 6k text size growth according to
bloat-o-meter (gcc 9.2 with defconfig).
But that's still better than having many out-of-line versions of
arch_spin_unlock().

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Heiko Carstens and committed by
Vasily Gorbik
cceb0183 6a3035da

+5 -5
+2 -2
arch/s390/include/asm/alternative.h
··· 139 139 * without volatile and memory clobber. 140 140 */ 141 141 #define alternative(oldinstr, altinstr, facility) \ 142 - asm volatile(ALTERNATIVE(oldinstr, altinstr, facility) : : : "memory") 142 + asm_inline volatile(ALTERNATIVE(oldinstr, altinstr, facility) : : : "memory") 143 143 144 144 #define alternative_2(oldinstr, altinstr1, facility1, altinstr2, facility2) \ 145 - asm volatile(ALTERNATIVE_2(oldinstr, altinstr1, facility1, \ 145 + asm_inline volatile(ALTERNATIVE_2(oldinstr, altinstr1, facility1, \ 146 146 altinstr2, facility2) ::: "memory") 147 147 148 148 #endif /* __ASSEMBLY__ */
+1 -1
arch/s390/include/asm/spinlock.h
··· 85 85 static inline void arch_spin_unlock(arch_spinlock_t *lp) 86 86 { 87 87 typecheck(int, lp->lock); 88 - asm volatile( 88 + asm_inline volatile( 89 89 ALTERNATIVE("", ".long 0xb2fa0070", 49) /* NIAI 7 */ 90 90 " sth %1,%0\n" 91 91 : "=Q" (((unsigned short *) &lp->lock)[1])
+2 -2
arch/s390/lib/spinlock.c
··· 74 74 { 75 75 int owner; 76 76 77 - asm volatile( 77 + asm_inline volatile( 78 78 ALTERNATIVE("", ".long 0xb2fa0040", 49) /* NIAI 4 */ 79 79 " l %0,%1\n" 80 80 : "=d" (owner) : "Q" (*lock) : "memory"); ··· 85 85 { 86 86 int expected = old; 87 87 88 - asm volatile( 88 + asm_inline volatile( 89 89 ALTERNATIVE("", ".long 0xb2fa0080", 49) /* NIAI 8 */ 90 90 " cs %0,%3,%1\n" 91 91 : "=d" (old), "=Q" (*lock)