Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19d43626 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar
Browse files

debug: Add _ONCE() logic to report_bug()



Josh suggested moving the _ONCE logic inside the trap handler, using a
bit in the bug_entry::flags field, avoiding the need for the extra
variable.

Sadly this only works for WARN_ON_ONCE(), since the others have
printk() statements prior to triggering the trap.

Still, this saves a fair amount of text and some data:

  text         data       filename
  10682460     4530992    defconfig-build/vmlinux.orig
  10665111     4530096    defconfig-build/vmlinux.patched

Suggested-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 70579a86
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
	unreachable();				\
} while (0)

#define __WARN_TAINT(taint) _BUG_FLAGS(BUGFLAG_TAINT(taint))
#define __WARN_FLAGS(flags) _BUG_FLAGS(BUGFLAG_WARNING|(flags))

#endif /* ! CONFIG_GENERIC_BUG */

+4 −4
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
#endif

#ifdef CONFIG_DEBUG_BUGVERBOSE
#define __WARN_TAINT(taint)						\
#define __WARN_FLAGS(flags)						\
	do {								\
		asm volatile("\n"					\
			     "1:\t" PARISC_BUG_BREAK_ASM "\n"		\
@@ -56,11 +56,11 @@
			     "\t.org 2b+%c3\n"				\
			     "\t.popsection"				\
			     : : "i" (__FILE__), "i" (__LINE__),	\
			     "i" (BUGFLAG_TAINT(taint)), 		\
			     "i" (BUGFLAG_WARNING|(flags)),		\
			     "i" (sizeof(struct bug_entry)) );		\
	} while(0)
#else
#define __WARN_TAINT(taint)						\
#define __WARN_FLAGS(flags)						\
	do {								\
		asm volatile("\n"					\
			     "1:\t" PARISC_BUG_BREAK_ASM "\n"		\
@@ -69,7 +69,7 @@
			     "\t.short %c0\n"				\
			     "\t.org 2b+%c1\n"				\
			     "\t.popsection"				\
			     : : "i" (BUGFLAG_TAINT(taint)),		\
			     : : "i" (BUGFLAG_WARNING|(flags)),		\
			     "i" (sizeof(struct bug_entry)) );		\
	} while(0)
#endif
+2 −2
Original line number Diff line number Diff line
@@ -85,12 +85,12 @@
	}							\
} while (0)

#define __WARN_TAINT(taint) do {				\
#define __WARN_FLAGS(flags) do {				\
	__asm__ __volatile__(					\
		"1:	twi 31,0,0\n"				\
		_EMIT_BUG_ENTRY					\
		: : "i" (__FILE__), "i" (__LINE__),		\
		  "i" (BUGFLAG_TAINT(taint)),			\
		  "i" (BUGFLAG_WARNING|(flags)),		\
		  "i" (sizeof(struct bug_entry)));		\
} while (0)

+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@
	unreachable();					\
} while (0)

#define __WARN_TAINT(taint) do {			\
	__EMIT_BUG(BUGFLAG_TAINT(taint));		\
#define __WARN_FLAGS(flags) do {			\
	__EMIT_BUG(BUGFLAG_WARNING|(flags));		\
} while (0)

#define WARN_ON(x) ({					\
+2 −2
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ do { \
		   "i" (sizeof(struct bug_entry)));	\
} while (0)

#define __WARN_TAINT(taint)				\
#define __WARN_FLAGS(flags)				\
do {							\
	__asm__ __volatile__ (				\
		"1:\t.short %O0\n"			\
@@ -59,7 +59,7 @@ do { \
		 : "n" (TRAPA_BUG_OPCODE),		\
		   "i" (__FILE__),			\
		   "i" (__LINE__),			\
		   "i" (BUGFLAG_TAINT(taint)),		\
		   "i" (BUGFLAG_WARNING|(flags)),	\
		   "i" (sizeof(struct bug_entry)));	\
} while (0)

Loading