]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
s390/spinlock: Implement SPINLOCK_LOCKVAL with inline assembly
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 10 Mar 2025 09:33:41 +0000 (10:33 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 18 Mar 2025 16:13:04 +0000 (17:13 +0100)
commitb46525437e1728596fda558894011ce64e5b0a9f
treec24a8fba989d8568035626c48808879367df4a2d
parent4797e9b5067e3682020b3f6745a929d690370be3
s390/spinlock: Implement SPINLOCK_LOCKVAL with inline assembly

Implement SPINLOCK_LOCKVAL with an inline assembly, which makes use of the
ALTERNATIVE macro, to read spinlock_lockval from lowcore. Provide an
alternative instruction with a different offset in case lowcore is
relocated.

This replaces sequences of two instructions with one instruction.

Before:
  10602a:       a7 78 00 00             lhi     %r7,0
  10602e:       a5 8e 00 00             llilh   %r8,0
  106032:       58 d0 83 ac             l       %r13,940(%r8)
  106036:       ba 7d b5 80             cs      %r7,%r13,1408(%r11)

After:
  10602a:       a7 88 00 00             lhi     %r8,0
  10602e:       e3 70 03 ac 00 58       ly      %r7,940
  106034:       ba 87 b5 80             cs      %r8,%r7,1408(%r11)

Kernel image size change:
add/remove: 756/750 grow/shrink: 646/3435 up/down: 30778/-46326 (-15548)

Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/spinlock.h
arch/s390/lib/spinlock.c