All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 1/3] Add BUG_XX() debugging options
@ 2016-02-02  2:33 Jeffrey Merkey
  2016-02-02  2:33 ` [PATCH v5 2/3] Add BUG_XX() debugging options Kconfig.debug Jeffrey Merkey
  2016-02-02  2:33 ` [PATCH v5 3/3] Add BUG_XX() debugging hard/soft lockup detection Jeffrey Merkey
  0 siblings, 2 replies; 14+ messages in thread
From: Jeffrey Merkey @ 2016-02-02  2:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: hpa, jeffmerkey, mingo, tglx, x86

This patch series adds config options which can be set during compile to
direct the compiler to output a breakpoint instruction anywhere a BUG()
macro has been placed in the kernel to trigger the system to
enter a debugger if a bug is detected by the system.  Use of this
compile time option also allows conditional breakpoints to be set in the
kernel with these currently used macros.

This addition is extremely useful for debugging hard and soft lockups
real time and quickly from a console debugger, and other areas of the
kernel.

Signed-off-by: Jeffrey Merkey <jeffmerkey@gmail.com>
---
 arch/x86/include/asm/bug.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index ba38ebb..df26c2b 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -11,6 +11,13 @@
 # define __BUG_C0	"2:\t.long 1b - 2b, %c0 - 2b\n"
 #endif
 
+#ifdef CONFIG_DEBUG_BUG
+#define BUG()							\
+do {								\
+	asm volatile("int3");					\
+	unreachable();						\
+} while (0)
+#else
 #define BUG()							\
 do {								\
 	asm volatile("1:\tud2\n"				\
@@ -23,7 +30,14 @@ do {								\
 		     "i" (sizeof(struct bug_entry)));		\
 	unreachable();						\
 } while (0)
-
+#endif
+#else
+#ifdef CONFIG_DEBUG_BUG
+#define BUG()							\
+do {								\
+	asm volatile("int3");					\
+	unreachable();						\
+} while (0)
 #else
 #define BUG()							\
 do {								\
@@ -31,6 +45,7 @@ do {								\
 	unreachable();						\
 } while (0)
 #endif
+#endif
 
 #include <asm-generic/bug.h>
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-02-04  2:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02  2:33 [PATCH v5 1/3] Add BUG_XX() debugging options Jeffrey Merkey
2016-02-02  2:33 ` [PATCH v5 2/3] Add BUG_XX() debugging options Kconfig.debug Jeffrey Merkey
2016-02-02  2:33 ` [PATCH v5 3/3] Add BUG_XX() debugging hard/soft lockup detection Jeffrey Merkey
2016-02-02 17:30   ` Don Zickus
2016-02-02 22:40     ` Jeffrey Merkey
2016-02-03  4:17       ` Jeffrey Merkey
2016-02-03  4:39         ` Jeffrey Merkey
2016-02-03 15:45       ` Don Zickus
2016-02-03 17:23         ` Jeffrey Merkey
2016-02-03 20:14           ` Don Zickus
2016-02-03 20:18             ` Jeffrey Merkey
2016-02-04  2:48               ` Jeffrey Merkey
2016-02-03 15:47       ` Don Zickus
2016-02-03 17:26         ` Jeffrey Merkey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.