[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251126105651.GX3245006@noisy.programming.kicks-ass.net>
Date: Wed, 26 Nov 2025 11:56:51 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Linus Torvalds <torvalds@...uxfoundation.org>
Cc: x86@...nel.org, ardb@...nel.org, linux-kernel@...r.kernel.org,
kees@...nel.org, acarmina@...hat.com, jpoimboe@...nel.org,
mark.rutland@....com, maciej.wieczor-retman@...el.com
Subject: Re: [PATCH v2 08/12] x86/bug: Add BUG_FORMAT basics
On Tue, Nov 25, 2025 at 08:27:50AM -0800, Linus Torvalds wrote:
> (Slightly related thing: could we perhaps just make x86-32 also use
> the relative format, and get rid of some of the horrid #ifdef's in the
> x86 <asm/bug.h> implementation? Because that "__BUG_REL" thing is not
> a thing of beauty either).
This builds and appears to work. I'll slap a changelog on and stick on
top of those other patches.
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -381,7 +381,7 @@ config GENERIC_CSUM
config GENERIC_BUG
def_bool y
depends on BUG
- select GENERIC_BUG_RELATIVE_POINTERS if X86_64
+ select GENERIC_BUG_RELATIVE_POINTERS
config GENERIC_BUG_RELATIVE_POINTERS
bool
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -42,16 +42,10 @@ extern void __WARN_trap(struct bug_entry
#ifdef CONFIG_GENERIC_BUG
-#ifdef CONFIG_X86_32
-#define __BUG_REL(val) ".long " val
-#else
-#define __BUG_REL(val) ".long " val " - ."
-#endif
-
#ifdef CONFIG_DEBUG_BUGVERBOSE
#define __BUG_ENTRY_VERBOSE(file, line) \
- "\t" __BUG_REL(file) "\t# bug_entry::file\n" \
- "\t.word " line "\t# bug_entry::line\n"
+ "\t.long " file " - .\t# bug_entry::file\n" \
+ "\t.word " line "\t# bug_entry::line\n"
#else
#define __BUG_ENTRY_VERBOSE(file, line)
#endif
@@ -59,7 +53,7 @@ extern void __WARN_trap(struct bug_entry
#if defined(CONFIG_X86_64) || defined(CONFIG_DEBUG_BUGVERBOSE_DETAILED)
#define HAVE_ARCH_BUG_FORMAT
#define __BUG_ENTRY_FORMAT(format) \
- "\t" __BUG_REL(format) "\t# bug_entry::format\n"
+ "\t.long " format " - .\t# bug_entry::format\n"
#else
#define __BUG_ENTRY_FORMAT(format)
#endif
@@ -69,7 +63,7 @@ extern void __WARN_trap(struct bug_entry
#endif
#define __BUG_ENTRY(format, file, line, flags) \
- __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \
+ "\t.long 1b - ." "\t# bug_entry::bug_addr\n" \
__BUG_ENTRY_FORMAT(format) \
__BUG_ENTRY_VERBOSE(file, line) \
"\t.word " flags "\t# bug_entry::flags\n"
Powered by blists - more mailing lists