Re: [COMBO PATCH 6/5] bugs/arch: Wire in the 'cond_str' string to the WARN/BUG output machinery of PowerPC, LoongArch, S390, RISC-V, PA-RISC and SH
From: Ingo Molnar
Date: Thu Mar 27 2025 - 04:39:04 EST
* Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> ... some time later:
>
> b2becbe8b469 bugs/s390: Pass in 'cond_str' to __EMIT_BUG() and use it
> --- a/arch/s390/include/asm/bug.h
> +++ b/arch/s390/include/asm/bug.h
> @@ -8,7 +8,7 @@
>
> #ifdef CONFIG_DEBUG_BUGVERBOSE
>
> -#define __EMIT_BUG(x) do { \
> +#define __EMIT_BUG(cond_str, x) do { \
> asm_inline volatile( \
> "0: mc 0,0\n" \
> ".section .rodata.str,\"aMS\",@progbits,1\n" \
> @@ -20,14 +20,14 @@
> " .short %0,%1\n" \
> " .org 2b+%2\n" \
> ".previous\n" \
> - : : "i" (__LINE__), \
> + : : "i" (cond_str __LINE__), \
> "i" (x), \
> "i" (sizeof(struct bug_entry))); \
> } while (0)
>
> #else /* CONFIG_DEBUG_BUGVERBOSE */
>
> -#define __EMIT_BUG(x) do { \
> +#define __EMIT_BUG(cond_str, x) do { \
> asm_inline volatile( \
> "0: mc 0,0\n" \
> ".section __bug_table,\"aw\"\n" \
> @@ -42,12 +42,12 @@
> #endif /* CONFIG_DEBUG_BUGVERBOSE */
>
> #define BUG() do { \
> - __EMIT_BUG(0); \
> + __EMIT_BUG("", 0); \
> unreachable(); \
> } while (0)
>
> #define __WARN_FLAGS(cond_str, flags) do { \
> - __EMIT_BUG(BUGFLAG_WARNING|(flags)); \
> + __EMIT_BUG(cond_str, BUGFLAG_WARNING|(flags)); \
> } while (0)
>
> #define WARN_ON(x) ({ \
So the fix below makes it build on S390, but it won't link:
kernel/exit.o:(__bug_table+0x8): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
kernel/exit.o:(__bug_table+0x14): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
kernel/exit.o:(__bug_table+0x20): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
kernel/exit.o:(__bug_table+0x2c): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
kernel/exit.o:(__bug_table+0x38): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
kernel/exit.o:(__bug_table+0x44): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
kernel/exit.o:(__bug_table+0x50): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
init/main.o:(__bug_table+0x8): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
init/main.o:(__bug_table+0x14): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
init/main.o:(__bug_table+0x20): relocation truncated to fit: R_390_16 against `.rodata.str1.2'
init/main.o:(__bug_table+0x2c): additional relocation overflows omitted from the output
>From the _16 name my rough guess is that the larger string table has
overflown 16 bits (64k)?
At which point I'd much rather go back to plan-A: pass in cond_str to
__WARN_FLAGS(), and wash my hands and leave architectures to make use
of them as they wish to. :-)
Thanks,
Ingo
=====================>
arch/s390/include/asm/bug.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
index e3d839517c17..7eb9b44f78cb 100644
--- a/arch/s390/include/asm/bug.h
+++ b/arch/s390/include/asm/bug.h
@@ -20,7 +20,7 @@
" .short %0,%1\n" \
" .org 2b+%2\n" \
".previous\n" \
- : : "i" (cond_str __LINE__), \
+ : : "i" (__stringify(cond_str __LINE__)), \
"i" (x), \
"i" (sizeof(struct bug_entry))); \
} while (0)