]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
s390/bug: Convert to inline assembly with input operands
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 9 Jan 2026 15:31:37 +0000 (16:31 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 27 Jan 2026 11:16:15 +0000 (12:16 +0100)
commite3abd056ffc9d6397766817eadbd4297632aceaf
tree999b96178e657a36aea4f3f6042fee36d844cde2
parente5f3e67de587b8e876ca04d5bd021d751fe9c4d2
s390/bug: Convert to inline assembly with input operands

Rewrite the bug inline assembly so it uses input operands again instead of
pure macro replacements. This more or less reverts the conversion done when
'cond_str' support was added [1].

Reason for this is that the upcoming __WARN_printf() implementation
requires an inline assembly with an output operand. At the same time input
strings (format specifier and condition string) may contain the special '%'
character. As soon as an inline assembly is specified to have input/output
operands the '%' has a special meaning: e.g. converting the existing

 #define __BUG_FLAGS(cond_str, flags) \
   asm_inline volatile(__stringify(ASM_BUG_FLAGS(cond_str, flags)));

to

 #define __BUG_FLAGS(cond_str, flags) \
   asm_inline volatile(__stringify(ASM_BUG_FLAGS(cond_str, flags))::);

will result in a compile error as soon as 'cond_str' contains a '%'
character:

net/core/neighbour.c: In function ‘neigh_table_init’:
././include/linux/compiler_types.h:546:20: error: invalid 'asm': invalid %-code
...
net/core/neighbour.c:1838:17: note: in expansion of macro ‘WARN_ON’
 1838 |                 WARN_ON(tbl->entry_size % NEIGH_PRIV_ALIGN);
      |                 ^~~~~~~

Convert the code, use immediate operands, and also add comments similar to
x86 which are emitted to the generated assembly file, which makes debugging
much easier.

Note: since gcc-8 does not support strings as immediate input operands,
guard the new implementation with CC_HAS_ASM_IMMEDIATE_STRINGS and fallback
to the generic non-exception based warning implementation for incompatible
compilers.

[1] 6584ff203aec ("bugs/s390: Use 'cond_str' in __EMIT_BUG()")

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/bug.h