]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/lowcore: Use inline qualifier for get_lowcore() inline assembly
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 10 Mar 2025 09:33:38 +0000 (10:33 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 18 Mar 2025 16:13:04 +0000 (17:13 +0100)
Use asm_inline to let the compiler know that the get_lowcore() inline
assembly has the smallest possible size. The ALTERNATIVE construct is used
to generate a single instruction, however the macro expands to multiple
lines. GCC uses the number of lines of an inline assembly to count the
number of instructions within an inline assembly, which then has an effect
on inlining decisions.

In order to avoid incorrect assumptions use asm_inline. The result is that
more functions are inlined, which results in a small growth of the kernel
image:

add/remove: 59/480 grow/shrink: 854/647 up/down: 168780/-162394 (6386)

Reviewed-by: Juergen Christ <jchrist@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/lowcore.h

index 8067edd120ebcfc3df22665c816738caac348fc0..ada93ab7802a674e70760b41873178e2ec2f0745 100644 (file)
@@ -223,9 +223,12 @@ static __always_inline struct lowcore *get_lowcore(void)
 
        if (__is_defined(__DECOMPRESSOR))
                return NULL;
-       asm(ALTERNATIVE("llilh %[lc],0", "llilh %[lc],%[alt]", ALT_FEATURE(MFEATURE_LOWCORE))
-           : [lc] "=d" (lc)
-           : [alt] "i" (LOWCORE_ALT_ADDRESS >> 16));
+       asm_inline(
+               ALTERNATIVE("   llilh   %[lc],0",
+                           "   llilh   %[lc],%[alt]",
+                           ALT_FEATURE(MFEATURE_LOWCORE))
+               : [lc] "=d" (lc)
+               : [alt] "i" (LOWCORE_ALT_ADDRESS >> 16));
        return lc;
 }