public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: 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
Date: Thu, 27 Mar 2025 09:38:54 +0100	[thread overview]
Message-ID: <Z-UOnlDWeII5IbI6@gmail.com> (raw)
In-Reply-To: <Z-UI6KGxZyw4hsej@gmail.com>


* Ingo Molnar <mingo@kernel.org> 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)

  reply	other threads:[~2025-03-27  8:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26  8:47 [PATCH 0/5] Improve WARN_ON_ONCE() output by adding the condition string Ingo Molnar
2025-03-26  8:47 ` [PATCH 1/5] bugs/core: Extend __WARN_FLAGS() with the 'cond_str' parameter Ingo Molnar
2025-03-26  8:47 ` [PATCH 2/5] bugs/core: Pass down the condition string of WARN_ON_ONCE(cond) warnings to __WARN_FLAGS() Ingo Molnar
2025-03-26  8:47 ` [PATCH 3/5] bugs/x86: Extend _BUG_FLAGS() with the 'cond_str' parameter Ingo Molnar
2025-03-26  8:47 ` [PATCH 4/5] bugs/x86: Augment warnings output by concatenating 'cond_str' with the regular __FILE__ string in _BUG_FLAGS() Ingo Molnar
2025-03-26  8:53   ` Peter Zijlstra
2025-03-27  8:14     ` [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 Ingo Molnar
2025-03-27  8:38       ` Ingo Molnar [this message]
2025-03-27  9:36     ` [PATCH 4/5] bugs/x86: Augment warnings output by concatenating 'cond_str' with the regular __FILE__ string in _BUG_FLAGS() Ingo Molnar
2025-03-27 12:41       ` Peter Zijlstra
2025-03-27 19:51       ` Linus Torvalds
2025-03-27 21:18         ` Ingo Molnar
2025-03-26  8:47 ` [PATCH 5/5] bugs/core: Do not print CPU and PID values in__warn() output Ingo Molnar
2025-03-26  8:52   ` Peter Zijlstra
2025-03-27  9:05     ` Ingo Molnar
2025-04-01 12:35 ` [PATCH 0/5] Improve WARN_ON_ONCE() output by adding the condition string Rasmus Villemoes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z-UOnlDWeII5IbI6@gmail.com \
    --to=mingo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox