]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bugs/core: Introduce the CONFIG_DEBUG_BUGVERBOSE_DETAILED Kconfig switch
authorIngo Molnar <mingo@kernel.org>
Thu, 15 May 2025 12:46:32 +0000 (14:46 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 13 Jun 2025 08:25:29 +0000 (10:25 +0200)
Allow configurability of the inclusion of more detailed
WARN_ON() strings, to be implemented in subsequent
commits.

Since the full cost will be around 100K more memory on
an x86 defconfig, disable it by default.

Provide the WARN_CONDITION_STR() macro to allow the conditional
passing of extra strings to lower level BUG/WARN handlers.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-arch@vger.kernel.org
Link: https://lore.kernel.org/r/20250515124644.2958810-4-mingo@kernel.org
include/asm-generic/bug.h
lib/Kconfig.debug

index c8e7126bc26e3f0163d6cb6984c93d91b4d9ee8a..2d9f61346dab8c1dfcf60a821321421d3f6efea0 100644 (file)
 #define BUG_GET_TAINT(bug)     ((bug)->flags >> 8)
 #endif
 
+#ifdef CONFIG_DEBUG_BUGVERBOSE_DETAILED
+# define WARN_CONDITION_STR(cond_str) cond_str
+#else
+# define WARN_CONDITION_STR(cond_str)
+#endif
+
 #ifndef __ASSEMBLY__
 #include <linux/panic.h>
 #include <linux/printk.h>
index ebe33181b6e6e0fb4243b400e9187881707efe23..ef00752a2b67ee98d193a6279a44a7503f46d814 100644 (file)
@@ -206,6 +206,16 @@ config DEBUG_BUGVERBOSE
          of the BUG call as well as the EIP and oops trace.  This aids
          debugging but costs about 70-100K of memory.
 
+config DEBUG_BUGVERBOSE_DETAILED
+       bool "Verbose WARN_ON_ONCE() reporting (adds 100K)" if DEBUG_BUGVERBOSE
+       help
+         Say Y here to make WARN_ON_ONCE() output the condition string of the
+         warning, in addition to the file name and line number.
+         This helps debugging, but costs about 100K of memory.
+
+         Say N if unsure.
+
+
 endmenu # "printk and dmesg options"
 
 config DEBUG_KERNEL