All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Add BUG_XX() debugging options
@ 2016-02-01 20:01 Jeffrey Merkey
  2016-02-01 20:27 ` kbuild test robot
  0 siblings, 1 reply; 4+ messages in thread
From: Jeffrey Merkey @ 2016-02-01 20:01 UTC (permalink / raw)
  To: hpa, jeffmerkey, linux-kernel, 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()
or WARN() 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..debbbfd 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
 
+#if 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
+#if 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] 4+ messages in thread

* Re: [PATCH 1/4] Add BUG_XX() debugging options
  2016-02-01 20:01 [PATCH 1/4] Add BUG_XX() debugging options Jeffrey Merkey
@ 2016-02-01 20:27 ` kbuild test robot
  2016-02-01 20:33   ` Jeffrey Merkey
  0 siblings, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2016-02-01 20:27 UTC (permalink / raw)
  To: Jeffrey Merkey
  Cc: kbuild-all, hpa, jeffmerkey, linux-kernel, mingo, tglx, x86

[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]

Hi Jeffrey,

[auto build test WARNING on v4.5-rc2]
[also build test WARNING on next-20160201]
[cannot apply to tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Jeffrey-Merkey/Add-BUG_XX-debugging-options/20160202-040506
config: x86_64-randconfig-x012-201605 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/bug.h:4:0,
                    from include/linux/page-flags.h:9,
                    from kernel/bounds.c:9:
>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not defined [-Wundef]
    #if CONFIG_DEBUG_BUG
        ^
--
   In file included from include/linux/bug.h:4:0,
                    from include/linux/page-flags.h:9,
                    from kernel/bounds.c:9:
>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not defined [-Wundef]
    #if CONFIG_DEBUG_BUG
        ^
   In file included from include/linux/bug.h:4:0,
                    from include/linux/crypto.h:23,
                    from arch/x86/kernel/asm-offsets.c:8:
>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not defined [-Wundef]
    #if CONFIG_DEBUG_BUG
        ^

vim +/CONFIG_DEBUG_BUG +14 arch/x86/include/asm/bug.h

     1	#ifndef _ASM_X86_BUG_H
     2	#define _ASM_X86_BUG_H
     3	
     4	#define HAVE_ARCH_BUG
     5	
     6	#ifdef CONFIG_DEBUG_BUGVERBOSE
     7	
     8	#ifdef CONFIG_X86_32
     9	# define __BUG_C0	"2:\t.long 1b, %c0\n"
    10	#else
    11	# define __BUG_C0	"2:\t.long 1b - 2b, %c0 - 2b\n"
    12	#endif
    13	
  > 14	#if CONFIG_DEBUG_BUG
    15	#define BUG()							\
    16	do {								\
    17		asm volatile("int3");					\
    18		unreachable();						\
    19	} while (0)
    20	#else
    21	#define BUG()							\
    22	do {								\

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 20303 bytes --]

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

* Re: [PATCH 1/4] Add BUG_XX() debugging options
  2016-02-01 20:27 ` kbuild test robot
@ 2016-02-01 20:33   ` Jeffrey Merkey
  2016-02-01 20:36     ` Jeffrey Merkey
  0 siblings, 1 reply; 4+ messages in thread
From: Jeffrey Merkey @ 2016-02-01 20:33 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, hpa, linux-kernel, mingo, tglx, x86

On 2/1/16, kbuild test robot <lkp@intel.com> wrote:
> Hi Jeffrey,
>
> [auto build test WARNING on v4.5-rc2]
> [also build test WARNING on next-20160201]
> [cannot apply to tip/x86/core]
> [if your patch is applied to the wrong git tree, please drop us a note to
> help improving the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Jeffrey-Merkey/Add-BUG_XX-debugging-options/20160202-040506
> config: x86_64-randconfig-x012-201605 (attached as .config)
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64
>
> All warnings (new ones prefixed by >>):
>
>    In file included from include/linux/bug.h:4:0,
>                     from include/linux/page-flags.h:9,
>                     from kernel/bounds.c:9:
>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>> defined [-Wundef]
>     #if CONFIG_DEBUG_BUG
>         ^
> --
>    In file included from include/linux/bug.h:4:0,
>                     from include/linux/page-flags.h:9,
>                     from kernel/bounds.c:9:
>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>> defined [-Wundef]
>     #if CONFIG_DEBUG_BUG
>         ^
>    In file included from include/linux/bug.h:4:0,
>                     from include/linux/crypto.h:23,
>                     from arch/x86/kernel/asm-offsets.c:8:
>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>> defined [-Wundef]
>     #if CONFIG_DEBUG_BUG
>         ^
>
> vim +/CONFIG_DEBUG_BUG +14 arch/x86/include/asm/bug.h
>
>      1	#ifndef _ASM_X86_BUG_H
>      2	#define _ASM_X86_BUG_H
>      3	
>      4	#define HAVE_ARCH_BUG
>      5	
>      6	#ifdef CONFIG_DEBUG_BUGVERBOSE
>      7	
>      8	#ifdef CONFIG_X86_32
>      9	# define __BUG_C0	"2:\t.long 1b, %c0\n"
>     10	#else
>     11	# define __BUG_C0	"2:\t.long 1b - 2b, %c0 - 2b\n"
>     12	#endif
>     13	
>   > 14	#if CONFIG_DEBUG_BUG
>     15	#define BUG()							\
>     16	do {								\
>     17		asm volatile("int3");					\
>     18		unreachable();						\
>     19	} while (0)
>     20	#else
>     21	#define BUG()							\
>     22	do {								\
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology
> Center
> https://lists.01.org/pipermail/kbuild-all                   Intel
> Corporation
>


I am looking at this one, but I'm not sure what the point is of
running a test to build something where the defines are ignored.  Is
this file off limits to use CONFIG options in the build?

Jeff

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

* Re: [PATCH 1/4] Add BUG_XX() debugging options
  2016-02-01 20:33   ` Jeffrey Merkey
@ 2016-02-01 20:36     ` Jeffrey Merkey
  0 siblings, 0 replies; 4+ messages in thread
From: Jeffrey Merkey @ 2016-02-01 20:36 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, hpa, linux-kernel, mingo, tglx, x86

On 2/1/16, Jeffrey Merkey <jeffmerkey@gmail.com> wrote:
> On 2/1/16, kbuild test robot <lkp@intel.com> wrote:
>> Hi Jeffrey,
>>
>> [auto build test WARNING on v4.5-rc2]
>> [also build test WARNING on next-20160201]
>> [cannot apply to tip/x86/core]
>> [if your patch is applied to the wrong git tree, please drop us a note to
>> help improving the system]
>>
>> url:
>> https://github.com/0day-ci/linux/commits/Jeffrey-Merkey/Add-BUG_XX-debugging-options/20160202-040506
>> config: x86_64-randconfig-x012-201605 (attached as .config)
>> reproduce:
>>         # save the attached .config to linux build tree
>>         make ARCH=x86_64
>>
>> All warnings (new ones prefixed by >>):
>>
>>    In file included from include/linux/bug.h:4:0,
>>                     from include/linux/page-flags.h:9,
>>                     from kernel/bounds.c:9:
>>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>>> defined [-Wundef]
>>     #if CONFIG_DEBUG_BUG
>>         ^
>> --
>>    In file included from include/linux/bug.h:4:0,
>>                     from include/linux/page-flags.h:9,
>>                     from kernel/bounds.c:9:
>>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>>> defined [-Wundef]
>>     #if CONFIG_DEBUG_BUG
>>         ^
>>    In file included from include/linux/bug.h:4:0,
>>                     from include/linux/crypto.h:23,
>>                     from arch/x86/kernel/asm-offsets.c:8:
>>>> arch/x86/include/asm/bug.h:14:5: warning: "CONFIG_DEBUG_BUG" is not
>>>> defined [-Wundef]
>>     #if CONFIG_DEBUG_BUG
>>         ^
>>
>> vim +/CONFIG_DEBUG_BUG +14 arch/x86/include/asm/bug.h
>>
>>      1	#ifndef _ASM_X86_BUG_H
>>      2	#define _ASM_X86_BUG_H
>>      3	
>>      4	#define HAVE_ARCH_BUG
>>      5	
>>      6	#ifdef CONFIG_DEBUG_BUGVERBOSE
>>      7	
>>      8	#ifdef CONFIG_X86_32
>>      9	# define __BUG_C0	"2:\t.long 1b, %c0\n"
>>     10	#else
>>     11	# define __BUG_C0	"2:\t.long 1b - 2b, %c0 - 2b\n"
>>     12	#endif
>>     13	
>>   > 14	#if CONFIG_DEBUG_BUG
>>     15	#define BUG()							\
>>     16	do {								\
>>     17		asm volatile("int3");					\
>>     18		unreachable();						\
>>     19	} while (0)
>>     20	#else
>>     21	#define BUG()							\
>>     22	do {								\
>>
>> ---
>> 0-DAY kernel test infrastructure                Open Source Technology
>> Center
>> https://lists.01.org/pipermail/kbuild-all                   Intel
>> Corporation
>>
>
>
> I am looking at this one, but I'm not sure what the point is of
> running a test to build something where the defines are ignored.  Is
> this file off limits to use CONFIG options in the build?
>
> Jeff
>

Never mind.  I just found it.  LOL

:-)

Jeff

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

end of thread, other threads:[~2016-02-01 20:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-01 20:01 [PATCH 1/4] Add BUG_XX() debugging options Jeffrey Merkey
2016-02-01 20:27 ` kbuild test robot
2016-02-01 20:33   ` Jeffrey Merkey
2016-02-01 20:36     ` 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.