diff mbox

[v3,2/6] build: convert crash_debug to Kconfig

Message ID 1462914329-8797-3-git-send-email-cardoe@cardoe.com (mailing list archive)
State New, archived
Headers show

Commit Message

Douglas Goldstein May 10, 2016, 9:05 p.m. UTC
Convert the crash_debug option to Kconfig as CONFIG_CRASH_DEBUG. This
was previously togglable on the command line so this adds a message for
users enabling it from the command line to tell them to enable it from
make menuconfig.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: George Dunlap <George.Dunlap@eu.citrix.com>
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Tim Deegan <tim@xen.org>
CC: Wei Liu <wei.liu2@citrix.com>
---
 INSTALL                        | 1 -
 docs/misc/crashdb.txt          | 4 ++--
 xen/Kconfig.debug              | 7 +++++++
 xen/Rules.mk                   | 5 +++--
 xen/arch/x86/Makefile          | 3 +--
 xen/arch/x86/x86_64/Makefile   | 2 +-
 xen/common/Makefile            | 2 +-
 xen/include/asm-x86/debugger.h | 2 +-
 xen/include/xen/gdbstub.h      | 2 +-
 9 files changed, 17 insertions(+), 11 deletions(-)

Comments

Jan Beulich May 11, 2016, 9:47 a.m. UTC | #1
>>> On 10.05.16 at 23:05, <cardoe@cardoe.com> wrote:
> --- a/xen/Kconfig.debug
> +++ b/xen/Kconfig.debug
> @@ -1,6 +1,13 @@
>  
>  menu "Debugging Options"
>  
> +config CRASH_DEBUG
> +	bool "Crash Debugging Support"
> +	depends on X86
> +	---help---
> +	  If you want to be able to attach gdb to Xen to be able to debug
> +	  Xen if it crashes then say Y.
> +
>  config DEBUG
>  	bool "Developer Checks"
>  	---help---

Is this really meant to be independent of DEBUG (or EXPERT), as it's
being placed ahead of DEBUG?

Jan
Douglas Goldstein May 11, 2016, 5:35 p.m. UTC | #2
On 5/11/16 4:47 AM, Jan Beulich wrote:
>>>> On 10.05.16 at 23:05, <cardoe@cardoe.com> wrote:
>> --- a/xen/Kconfig.debug
>> +++ b/xen/Kconfig.debug
>> @@ -1,6 +1,13 @@
>>  
>>  menu "Debugging Options"
>>  
>> +config CRASH_DEBUG
>> +	bool "Crash Debugging Support"
>> +	depends on X86
>> +	---help---
>> +	  If you want to be able to attach gdb to Xen to be able to debug
>> +	  Xen if it crashes then say Y.
>> +
>>  config DEBUG
>>  	bool "Developer Checks"
>>  	---help---
> 
> Is this really meant to be independent of DEBUG (or EXPERT), as it's
> being placed ahead of DEBUG?
> 
> Jan
> 

That's what we talked about with v2. You wanted it to be independent if
EXPERT was set but when you have something defined as "menuconfig XXXX"
you cannot then have a rule "if XXXX || EXPERT" as you asked for in v2.
So I needed to make them independent always which is what I did.

Let me restate more generically, if things are dependent on a menu for
the sub-menu items to be displayed (as in v2) then the menu must be
enabled and cannot be conditionally displayed on another option.

Roughly think of it this way:

menuconfig SOME_STATE

if SOME_STATE || EXPERT

config OTHER

endif


is the following code:


if (SOME_STATE) {
  if (SOME_STATE or EXPERT) {
    printf("got here\n");
  }
}
Jan Beulich May 12, 2016, 9:03 a.m. UTC | #3
>>> On 11.05.16 at 19:35, <cardoe@cardoe.com> wrote:
> On 5/11/16 4:47 AM, Jan Beulich wrote:
>>>>> On 10.05.16 at 23:05, <cardoe@cardoe.com> wrote:
>>> --- a/xen/Kconfig.debug
>>> +++ b/xen/Kconfig.debug
>>> @@ -1,6 +1,13 @@
>>>  
>>>  menu "Debugging Options"
>>>  
>>> +config CRASH_DEBUG
>>> +	bool "Crash Debugging Support"
>>> +	depends on X86
>>> +	---help---
>>> +	  If you want to be able to attach gdb to Xen to be able to debug
>>> +	  Xen if it crashes then say Y.
>>> +
>>>  config DEBUG
>>>  	bool "Developer Checks"
>>>  	---help---
>> 
>> Is this really meant to be independent of DEBUG (or EXPERT), as it's
>> being placed ahead of DEBUG?
> 
> That's what we talked about with v2. You wanted it to be independent if
> EXPERT was set but when you have something defined as "menuconfig XXXX"
> you cannot then have a rule "if XXXX || EXPERT" as you asked for in v2.
> So I needed to make them independent always which is what I did.
> 
> Let me restate more generically, if things are dependent on a menu for
> the sub-menu items to be displayed (as in v2) then the menu must be
> enabled and cannot be conditionally displayed on another option.
> 
> Roughly think of it this way:
> 
> menuconfig SOME_STATE
> 
> if SOME_STATE || EXPERT
> 
> config OTHER
> 
> endif
> 
> 
> is the following code:
> 
> 
> if (SOME_STATE) {
>   if (SOME_STATE or EXPERT) {
>     printf("got here\n");
>   }
> }

But there's no menuconfig anymore, for precisely that reason (aiui).

Jan
Douglas Goldstein May 18, 2016, 2:15 a.m. UTC | #4
On 5/12/16 4:03 AM, Jan Beulich wrote:
>>>> On 11.05.16 at 19:35, <cardoe@cardoe.com> wrote:
>> On 5/11/16 4:47 AM, Jan Beulich wrote:
>>>>>> On 10.05.16 at 23:05, <cardoe@cardoe.com> wrote:
>>>> --- a/xen/Kconfig.debug
>>>> +++ b/xen/Kconfig.debug
>>>> @@ -1,6 +1,13 @@
>>>>  
>>>>  menu "Debugging Options"
>>>>  
>>>> +config CRASH_DEBUG
>>>> +	bool "Crash Debugging Support"
>>>> +	depends on X86
>>>> +	---help---
>>>> +	  If you want to be able to attach gdb to Xen to be able to debug
>>>> +	  Xen if it crashes then say Y.
>>>> +
>>>>  config DEBUG
>>>>  	bool "Developer Checks"
>>>>  	---help---
>>>
>>> Is this really meant to be independent of DEBUG (or EXPERT), as it's
>>> being placed ahead of DEBUG?
>>
>> That's what we talked about with v2. You wanted it to be independent if
>> EXPERT was set but when you have something defined as "menuconfig XXXX"
>> you cannot then have a rule "if XXXX || EXPERT" as you asked for in v2.
>> So I needed to make them independent always which is what I did.
>>
>> Let me restate more generically, if things are dependent on a menu for
>> the sub-menu items to be displayed (as in v2) then the menu must be
>> enabled and cannot be conditionally displayed on another option.
>>
>> Roughly think of it this way:
>>
>> menuconfig SOME_STATE
>>
>> if SOME_STATE || EXPERT
>>
>> config OTHER
>>
>> endif
>>
>>
>> is the following code:
>>
>>
>> if (SOME_STATE) {
>>   if (SOME_STATE or EXPERT) {
>>     printf("got here\n");
>>   }
>> }
> 
> But there's no menuconfig anymore, for precisely that reason (aiui).
> 
> Jan
> 

Right. That's what I was trying to get across. What I gathered from past
reviews is that it should to be independent of DEBUG correct?
Jan Beulich May 18, 2016, 9:14 a.m. UTC | #5
>>> On 18.05.16 at 04:15, <cardoe@cardoe.com> wrote:
> On 5/12/16 4:03 AM, Jan Beulich wrote:
>>>>> On 11.05.16 at 19:35, <cardoe@cardoe.com> wrote:
>>> On 5/11/16 4:47 AM, Jan Beulich wrote:
>>>>>>> On 10.05.16 at 23:05, <cardoe@cardoe.com> wrote:
>>>>> --- a/xen/Kconfig.debug
>>>>> +++ b/xen/Kconfig.debug
>>>>> @@ -1,6 +1,13 @@
>>>>>  
>>>>>  menu "Debugging Options"
>>>>>  
>>>>> +config CRASH_DEBUG
>>>>> +	bool "Crash Debugging Support"
>>>>> +	depends on X86
>>>>> +	---help---
>>>>> +	  If you want to be able to attach gdb to Xen to be able to debug
>>>>> +	  Xen if it crashes then say Y.
>>>>> +
>>>>>  config DEBUG
>>>>>  	bool "Developer Checks"
>>>>>  	---help---
>>>>
>>>> Is this really meant to be independent of DEBUG (or EXPERT), as it's
>>>> being placed ahead of DEBUG?
>>>
>>> That's what we talked about with v2. You wanted it to be independent if
>>> EXPERT was set but when you have something defined as "menuconfig XXXX"
>>> you cannot then have a rule "if XXXX || EXPERT" as you asked for in v2.
>>> So I needed to make them independent always which is what I did.
>>>
>>> Let me restate more generically, if things are dependent on a menu for
>>> the sub-menu items to be displayed (as in v2) then the menu must be
>>> enabled and cannot be conditionally displayed on another option.
>>>
>>> Roughly think of it this way:
>>>
>>> menuconfig SOME_STATE
>>>
>>> if SOME_STATE || EXPERT
>>>
>>> config OTHER
>>>
>>> endif
>>>
>>>
>>> is the following code:
>>>
>>>
>>> if (SOME_STATE) {
>>>   if (SOME_STATE or EXPERT) {
>>>     printf("got here\n");
>>>   }
>>> }
>> 
>> But there's no menuconfig anymore, for precisely that reason (aiui).
> 
> Right. That's what I was trying to get across. What I gathered from past
> reviews is that it should to be independent of DEBUG correct?

"It" being what? The CRASH_DEBUG above? That would be the
question I asked you in my initial reply (still visible above); I
don't think it should be, but instead should, like all the other
DEBUG controlled ones, be dependent on "DEBUG || EXPERT" as
said a number of times.

Jan
diff mbox

Patch

diff --git a/INSTALL b/INSTALL
index 95fa94d..2974b9b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -231,7 +231,6 @@  verbose=y
 perfc=y
 perfc_arrays=y
 lock_profile=y
-crash_debug=y
 frame_pointer=y
 lto=y
 
diff --git a/docs/misc/crashdb.txt b/docs/misc/crashdb.txt
index b41a538..9733666 100644
--- a/docs/misc/crashdb.txt
+++ b/docs/misc/crashdb.txt
@@ -5,7 +5,7 @@  Xen has a simple gdb stub for doing post-mortem debugging i.e. once
 you've crashed it, you get to poke around and find out why.  There's
 also a special key handler for making it crash, which is handy.
 
-You need to have crash_debug=y set when compiling , and you also need
+You need to have CRASH_DEBUG=y set when compiling, and you also need
 to enable it on the Xen command line, eg by gdb=com1.
 
 If you need to have a serial port shared between gdb and the console,
@@ -19,7 +19,7 @@  if you have a simple null modem connection between the test box and
 the workstation, and aren't using a H/L split console:
 
   * Set debug=y in Config.mk
-  * Set crash_debug=y in xen/Rules.mk
+  * Set CRASH_DEBUG=y with `make -C xen menuconfig`
   * Make the changes in the attached patch, and build.
   * Arrange to pass gdb=com1 as a hypervisor command line argument
     (I already have com1=38400,8n1 console=com1,vga sync_console)
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index 47dc885..8abfbaa 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -1,6 +1,13 @@ 
 
 menu "Debugging Options"
 
+config CRASH_DEBUG
+	bool "Crash Debugging Support"
+	depends on X86
+	---help---
+	  If you want to be able to attach gdb to Xen to be able to debug
+	  Xen if it crashes then say Y.
+
 config DEBUG
 	bool "Developer Checks"
 	---help---
diff --git a/xen/Rules.mk b/xen/Rules.mk
index f73d86e..1a220bd 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -7,7 +7,6 @@  verbose       ?= n
 perfc         ?= n
 perfc_arrays  ?= n
 lock_profile  ?= n
-crash_debug   ?= n
 frame_pointer ?= n
 lto           ?= n
 
@@ -28,6 +27,9 @@  endif
 ifneq ($(origin kexec),undefined)
 $(error "You must use 'make menuconfig' to enable/disable kexec now.")
 endif
+ifneq ($(origin crash_debug),undefined)
+$(error "You must use 'make menuconfig' to enable/disable crash_debug now.")
+endif
 
 # Set ARCH/SUBARCH appropriately.
 override TARGET_SUBARCH  := $(XEN_TARGET_ARCH)
@@ -56,7 +58,6 @@  CFLAGS += -Wa,--strip-local-absolute
 endif
 
 CFLAGS-$(verbose)       += -DVERBOSE
-CFLAGS-$(crash_debug)   += -DCRASH_DEBUG
 CFLAGS-$(perfc)         += -DPERF_COUNTERS
 CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 4665a68..4ccef4a 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -27,6 +27,7 @@  obj-y += domain_page.o
 obj-y += e820.o
 obj-y += extable.o
 obj-y += flushtlb.o
+obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o
 obj-y += i387.o
 obj-y += i8259.o
 obj-y += io_apic.o
@@ -66,8 +67,6 @@  obj-y += vm_event.o
 obj-$(CONFIG_XSPLICE) += alternative.o xsplice.o
 obj-y += xstate.o
 
-obj-$(crash_debug) += gdbstub.o
-
 x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
 
 efi-y := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \
diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index 5b54c16..d8815e7 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -14,4 +14,4 @@  obj-y += cpu_idle.o
 obj-y += cpufreq.o
 obj-bin-$(CONFIG_KEXEC) += kexec_reloc.o
 
-obj-$(crash_debug)   += gdbstub.o
+obj-$(CONFIG_CRASH_DEBUG)   += gdbstub.o
diff --git a/xen/common/Makefile b/xen/common/Makefile
index afd84b6..a98bcc2 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -8,6 +8,7 @@  obj-y += domain.o
 obj-y += event_2l.o
 obj-y += event_channel.o
 obj-y += event_fifo.o
+obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o
 obj-y += grant_table.o
 obj-y += guestcopy.o
 obj-bin-y += gunzip.init.o
@@ -64,7 +65,6 @@  obj-$(CONFIG_XSPLICE) += xsplice_elf.o
 obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma unlzo unlz4 earlycpio,$(n).init.o)
 
 obj-$(perfc)       += perfc.o
-obj-$(crash_debug) += gdbstub.o
 
 obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o xlat.o)
 
diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h
index 33f4700..271cbaa 100644
--- a/xen/include/asm-x86/debugger.h
+++ b/xen/include/asm-x86/debugger.h
@@ -39,7 +39,7 @@ 
 #define DEBUGGER_trap_fatal(_v, _r) \
     if ( debugger_trap_fatal(_v, _r) ) return;
 
-#if defined(CRASH_DEBUG)
+#ifdef CONFIG_CRASH_DEBUG
 
 #include <xen/gdbstub.h>
 
diff --git a/xen/include/xen/gdbstub.h b/xen/include/xen/gdbstub.h
index ab710da..a5e6714 100644
--- a/xen/include/xen/gdbstub.h
+++ b/xen/include/xen/gdbstub.h
@@ -23,7 +23,7 @@ 
 #include <asm/atomic.h>
 #include <asm/page.h>
 
-#ifdef CRASH_DEBUG
+#ifdef CONFIG_CRASH_DEBUG
 
 struct gdb_context {
     int                 serhnd;           /* handle on our serial line */