xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] build: add debug menu to Kconfig
@ 2016-03-24 16:48 Doug Goldstein
  2016-03-24 16:48 ` [RFC PATCH 2/2] build: convert crash_debug " Doug Goldstein
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Doug Goldstein @ 2016-03-24 16:48 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Jackson, Keir Fraser, Doug Goldstein, Jan Beulich, Tim Deegan

There are a number of debugging options for Xen so the idea is to have a
menu to group them all together.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
This is more of an RFC than a merge request. If this seems reasonable I'll
add all the other debugging options under this menu as well. Obviously if
this seems reasonable and the patch is fine we can merge it and I'll submit
the others as a follow up.


CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Keir Fraser <keir@xen.org>
CC: Tim Deegan <tim@xen.org>
---
 xen/Kconfig       | 2 ++
 xen/Kconfig.debug | 6 ++++++
 2 files changed, 8 insertions(+)
 create mode 100644 xen/Kconfig.debug

diff --git a/xen/Kconfig b/xen/Kconfig
index fa8b27c..0fe7a1a 100644
--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -26,3 +26,5 @@ config DEFCONFIG_LIST
 config EXPERT
 	string
 	option env="XEN_CONFIG_EXPERT"
+
+source "Kconfig.debug"
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
new file mode 100644
index 0000000..36890bd
--- /dev/null
+++ b/xen/Kconfig.debug
@@ -0,0 +1,6 @@
+
+menuconfig DEBUG
+	bool "Debugging Options"
+	---help---
+	  If you want to debug Xen say Y and select any additional debugging
+	  support options.
-- 
2.7.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* [RFC PATCH 2/2] build: convert crash_debug to Kconfig
  2016-03-24 16:48 [RFC PATCH 1/2] build: add debug menu to Kconfig Doug Goldstein
@ 2016-03-24 16:48 ` Doug Goldstein
  2016-03-25 19:49   ` Konrad Rzeszutek Wilk
  2016-03-25 19:42 ` [RFC PATCH 1/2] build: add debug menu " Konrad Rzeszutek Wilk
  2016-04-08 23:18 ` Jan Beulich
  2 siblings, 1 reply; 12+ messages in thread
From: Doug Goldstein @ 2016-03-24 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser, Doug Goldstein, Jan Beulich, Andrew Cooper

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>
---
This is an example of using the debug menu.


CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misc/crashdb.txt          |  4 ++--
 xen/Kconfig.debug              | 11 +++++++++++
 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 +-
 8 files changed, 21 insertions(+), 10 deletions(-)

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 36890bd..3336a64 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -4,3 +4,14 @@ menuconfig DEBUG
 	---help---
 	  If you want to debug Xen say Y and select any additional debugging
 	  support options.
+
+if DEBUG
+
+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.
+
+endif # DEBUG
diff --git a/xen/Rules.mk b/xen/Rules.mk
index f29491e..b5d8d33 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
 
@@ -30,6 +29,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)
@@ -53,7 +55,6 @@ CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS += '-D__OBJECT_FILE__="$@"'
 
 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 1bcb08b..21d7e5f 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -24,6 +24,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
@@ -62,8 +63,6 @@ obj-y += hpet.o
 obj-y += vm_event.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 77de27e..39a83fc 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
@@ -61,7 +62,6 @@ obj-y += xmalloc_tlsf.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..fb92ee4 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)
+#if defined(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 */
-- 
2.7.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 1/2] build: add debug menu to Kconfig
  2016-03-24 16:48 [RFC PATCH 1/2] build: add debug menu to Kconfig Doug Goldstein
  2016-03-24 16:48 ` [RFC PATCH 2/2] build: convert crash_debug " Doug Goldstein
@ 2016-03-25 19:42 ` Konrad Rzeszutek Wilk
  2016-03-25 20:59   ` Doug Goldstein
  2016-04-08 23:18 ` Jan Beulich
  2 siblings, 1 reply; 12+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-03-25 19:42 UTC (permalink / raw)
  To: Doug Goldstein
  Cc: Keir Fraser, Tim Deegan, Ian Jackson, Jan Beulich, xen-devel

On Thu, Mar 24, 2016 at 11:48:18AM -0500, Doug Goldstein wrote:
> There are a number of debugging options for Xen so the idea is to have a
> menu to group them all together.
> 
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
> ---
> This is more of an RFC than a merge request. If this seems reasonable I'll
> add all the other debugging options under this menu as well. Obviously if
> this seems reasonable and the patch is fine we can merge it and I'll submit
> the others as a follow up.

There would be more I presume - the lock profile, gcov, crash, etc..

And with the 'randconfig' that means we can turn on/off various options and
find interesting dependencies (if any).


Anyhow back to this patch.

The usual method for distros of compiling an Xen with and without debug (like Xenserver)
is:

make %{?_smp_mflags} max_phys_cpus=384 xen tools

make %{?_smp_mflags} -C xen clean
make %{?_smp_mflags} -C xen debug=y max_phys_cpus=384

It would be preferrable to still have this functionality. As in, if we
do 'debug=y' then verbose=y and frame_pointer=y are automatically enabled?

Is that something the Kconfig magic can still do?
> 
> 
> CC: Ian Jackson <ian.jackson@eu.citrix.com>
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Keir Fraser <keir@xen.org>
> CC: Tim Deegan <tim@xen.org>
> ---
>  xen/Kconfig       | 2 ++
>  xen/Kconfig.debug | 6 ++++++
>  2 files changed, 8 insertions(+)
>  create mode 100644 xen/Kconfig.debug
> 
> diff --git a/xen/Kconfig b/xen/Kconfig
> index fa8b27c..0fe7a1a 100644
> --- a/xen/Kconfig
> +++ b/xen/Kconfig
> @@ -26,3 +26,5 @@ config DEFCONFIG_LIST
>  config EXPERT
>  	string
>  	option env="XEN_CONFIG_EXPERT"
> +
> +source "Kconfig.debug"
> diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
> new file mode 100644
> index 0000000..36890bd
> --- /dev/null
> +++ b/xen/Kconfig.debug
> @@ -0,0 +1,6 @@
> +
> +menuconfig DEBUG
> +	bool "Debugging Options"
> +	---help---
> +	  If you want to debug Xen say Y and select any additional debugging
> +	  support options.

.. You can also add:

Should not be used for production builds.

Note that any _ASSERTS_ in the code without debug are emitted.

> -- 
> 2.7.3
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 2/2] build: convert crash_debug to Kconfig
  2016-03-24 16:48 ` [RFC PATCH 2/2] build: convert crash_debug " Doug Goldstein
@ 2016-03-25 19:49   ` Konrad Rzeszutek Wilk
  2016-03-25 21:02     ` Doug Goldstein
  0 siblings, 1 reply; 12+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-03-25 19:49 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Andrew Cooper, Keir Fraser, Jan Beulich, xen-devel

On Thu, Mar 24, 2016 at 11:48:19AM -0500, Doug Goldstein wrote:
> 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>
> ---
> This is an example of using the debug menu.
> 
> 
> CC: Keir Fraser <keir@xen.org>
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>  docs/misc/crashdb.txt          |  4 ++--
>  xen/Kconfig.debug              | 11 +++++++++++
>  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 +-
>  8 files changed, 21 insertions(+), 10 deletions(-)
> 
> 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 36890bd..3336a64 100644
> --- a/xen/Kconfig.debug
> +++ b/xen/Kconfig.debug
> @@ -4,3 +4,14 @@ menuconfig DEBUG
>  	---help---
>  	  If you want to debug Xen say Y and select any additional debugging
>  	  support options.
> +
> +if DEBUG

Perhaps if !defined then atuomatically enable it? Looking at Config.mk
it seems you could do crash_debug without debug=y?

Why is this called crash_debug and not 'crash_gdb' ..? Ah [after reading the docs]
it can't do breakpoints or any of that. Just to pour over the data after a crash.
Ah, you can resume the hypervisor after this. OK, definitly not for field
analysis.

And kexec/kdump is much more powerful than this.


> +
> +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.

Should it have a link to the docs ? On how to use it?

And maybe mention that kexec/kdump is better suited for capturing the whole
machine and one can do post-mortem analysis much more intensly?

> +
> +endif # DEBUG
> diff --git a/xen/Rules.mk b/xen/Rules.mk
> index f29491e..b5d8d33 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
>  
> @@ -30,6 +29,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)
> @@ -53,7 +55,6 @@ CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
>  CFLAGS += '-D__OBJECT_FILE__="$@"'
>  
>  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 1bcb08b..21d7e5f 100644
> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -24,6 +24,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
> @@ -62,8 +63,6 @@ obj-y += hpet.o
>  obj-y += vm_event.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 77de27e..39a83fc 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
> @@ -61,7 +62,6 @@ obj-y += xmalloc_tlsf.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..fb92ee4 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)
> +#if defined(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 */
> -- 
> 2.7.3
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 1/2] build: add debug menu to Kconfig
  2016-03-25 19:42 ` [RFC PATCH 1/2] build: add debug menu " Konrad Rzeszutek Wilk
@ 2016-03-25 20:59   ` Doug Goldstein
  2016-03-30 15:29     ` Dario Faggioli
  0 siblings, 1 reply; 12+ messages in thread
From: Doug Goldstein @ 2016-03-25 20:59 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Keir Fraser, Tim Deegan, Ian Jackson, Jan Beulich, xen-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 4039 bytes --]

On 3/25/16 2:42 PM, Konrad Rzeszutek Wilk wrote:
> On Thu, Mar 24, 2016 at 11:48:18AM -0500, Doug Goldstein wrote:
>> There are a number of debugging options for Xen so the idea is to have a
>> menu to group them all together.
>>
>> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
>> ---
>> This is more of an RFC than a merge request. If this seems reasonable I'll
>> add all the other debugging options under this menu as well. Obviously if
>> this seems reasonable and the patch is fine we can merge it and I'll submit
>> the others as a follow up.
> 
> There would be more I presume - the lock profile, gcov, crash, etc..

Yes. I just wanted to do one to get an idea of how people felt about the
menu.

> 
> And with the 'randconfig' that means we can turn on/off various options and
> find interesting dependencies (if any).

Exactly. We've found a number of interesting cases with randconfig
already and fixed them. I previously checked some of them against some
of the stable trees and found the combos failed so Travis CI +
randconfig are finding issues but not commonly used ones.

Anyway back to this patch.

> 
> 
> Anyhow back to this patch.

:-D

> 
> The usual method for distros of compiling an Xen with and without debug (like Xenserver)
> is:
> 

This feels very... http://xkcd.com/1172/


> make %{?_smp_mflags} max_phys_cpus=384 xen tools

So two comments on this line.

1) ick! "xen" and "tools" targets have been marked as Legacy since
October 5th 2005!
2) That's been broken since I got rid of max_phys_cpus and moved it to
CONFIG_NR_CPUS (I think that's the name).

spec files for things like busybox include the config file and just copy
it in before running make

cp someplace/config.release xen/.config
make %{?_smp_mflags} dist-xen dist-tools

> 
> make %{?_smp_mflags} -C xen clean

why use the directory here but not in the first step?

make %{?_smp_mflags} clean-xen

would be the matching target

> make %{?_smp_mflags} -C xen debug=y max_phys_cpus=384

ok mind blown. We build xen in the first step with the Legacy target and
then changing to the directory here.

> 
> It would be preferrable to still have this functionality. As in, if we
> do 'debug=y' then verbose=y and frame_pointer=y are automatically enabled?
> 
> Is that something the Kconfig magic can still do?

I could do some wizard-y to allow debug=y to turn things on. Not sure if
the lowercase will work but I can definitely think of a way to make the
uppercase DEBUG=y work. But at that point I don't see the point. I see
the point of debug=y since that's a top level thing.

<continuing the conversation in the other patch since you brought up
some good points there>

>>
>>
>> CC: Ian Jackson <ian.jackson@eu.citrix.com>
>> CC: Jan Beulich <jbeulich@suse.com>
>> CC: Keir Fraser <keir@xen.org>
>> CC: Tim Deegan <tim@xen.org>
>> ---
>>  xen/Kconfig       | 2 ++
>>  xen/Kconfig.debug | 6 ++++++
>>  2 files changed, 8 insertions(+)
>>  create mode 100644 xen/Kconfig.debug
>>
>> diff --git a/xen/Kconfig b/xen/Kconfig
>> index fa8b27c..0fe7a1a 100644
>> --- a/xen/Kconfig
>> +++ b/xen/Kconfig
>> @@ -26,3 +26,5 @@ config DEFCONFIG_LIST
>>  config EXPERT
>>  	string
>>  	option env="XEN_CONFIG_EXPERT"
>> +
>> +source "Kconfig.debug"
>> diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
>> new file mode 100644
>> index 0000000..36890bd
>> --- /dev/null
>> +++ b/xen/Kconfig.debug
>> @@ -0,0 +1,6 @@
>> +
>> +menuconfig DEBUG
>> +	bool "Debugging Options"
>> +	---help---
>> +	  If you want to debug Xen say Y and select any additional debugging
>> +	  support options.
> 
> .. You can also add:
> 
> Should not be used for production builds.
> 
> Note that any _ASSERTS_ in the code without debug are emitted.
> 
>> -- 
>> 2.7.3
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel


-- 
Doug Goldstein


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 959 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 2/2] build: convert crash_debug to Kconfig
  2016-03-25 19:49   ` Konrad Rzeszutek Wilk
@ 2016-03-25 21:02     ` Doug Goldstein
  2016-03-29  8:50       ` Jan Beulich
  2016-04-08 23:24       ` Jan Beulich
  0 siblings, 2 replies; 12+ messages in thread
From: Doug Goldstein @ 2016-03-25 21:02 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: Andrew Cooper, Keir Fraser, Jan Beulich, xen-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 4345 bytes --]

On 3/25/16 2:49 PM, Konrad Rzeszutek Wilk wrote:
> On Thu, Mar 24, 2016 at 11:48:19AM -0500, Doug Goldstein wrote:
>> 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>
>> ---
>> This is an example of using the debug menu.
>>
>>
>> CC: Keir Fraser <keir@xen.org>
>> CC: Jan Beulich <jbeulich@suse.com>
>> CC: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>>  docs/misc/crashdb.txt          |  4 ++--
>>  xen/Kconfig.debug              | 11 +++++++++++
>>  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 +-
>>  8 files changed, 21 insertions(+), 10 deletions(-)
>>
>> 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 36890bd..3336a64 100644
>> --- a/xen/Kconfig.debug
>> +++ b/xen/Kconfig.debug
>> @@ -4,3 +4,14 @@ menuconfig DEBUG
>>  	---help---
>>  	  If you want to debug Xen say Y and select any additional debugging
>>  	  support options.
>> +
>> +if DEBUG
> 
> Perhaps if !defined then atuomatically enable it? Looking at Config.mk
> it seems you could do crash_debug without debug=y?

debug=y unfortunately is more than just a "meta" option that selects
verbose=y and frame_pointer=y. It also turns off NDEBUG so that debug
messages appear. I'm not sure how that should be mapped in the context
of this patch. Should the messages be enabled when DEBUG is enabled or
should there be another option?

If debug messages are enabled with DEBUG that would certainly be a
behavior change since now someone could have crash_debug=y debug=n but
I'm not sure if that's desired?

> 
> Why is this called crash_debug and not 'crash_gdb' ..? Ah [after reading the docs]
> it can't do breakpoints or any of that. Just to pour over the data after a crash.
> Ah, you can resume the hypervisor after this. OK, definitly not for field
> analysis.
> 
> And kexec/kdump is much more powerful than this.

yeah I wondered that myself as well and came to the conclusion it was
limited. Good point about kexec/kdump. I should definitely update the
description to be more verbose.

> 
> 
>> +
>> +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.
> 
> Should it have a link to the docs ? On how to use it?

yeah I think maybe just pointing someone to docs/misc/crashdb.txt cause
its not immediately obvious that's the doc file to go with crash_debug.

> 
> And maybe mention that kexec/kdump is better suited for capturing the whole
> machine and one can do post-mortem analysis much more intensly?

Yeah that's a really good point. I didn't think of that.


-- 
Doug Goldstein


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 959 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 2/2] build: convert crash_debug to Kconfig
  2016-03-25 21:02     ` Doug Goldstein
@ 2016-03-29  8:50       ` Jan Beulich
  2016-03-30 15:38         ` Doug Goldstein
  2016-04-08 23:24       ` Jan Beulich
  1 sibling, 1 reply; 12+ messages in thread
From: Jan Beulich @ 2016-03-29  8:50 UTC (permalink / raw)
  To: Doug Goldstein, Konrad Rzeszutek Wilk
  Cc: Andrew Cooper, Keir Fraser, xen-devel

>>> On 25.03.16 at 22:02, <cardoe@cardoe.com> wrote:
> On 3/25/16 2:49 PM, Konrad Rzeszutek Wilk wrote:
>> On Thu, Mar 24, 2016 at 11:48:19AM -0500, Doug Goldstein wrote:
>>> --- a/xen/Kconfig.debug
>>> +++ b/xen/Kconfig.debug
>>> @@ -4,3 +4,14 @@ menuconfig DEBUG
>>>  	---help---
>>>  	  If you want to debug Xen say Y and select any additional debugging
>>>  	  support options.
>>> +
>>> +if DEBUG
>> 
>> Perhaps if !defined then atuomatically enable it? Looking at Config.mk
>> it seems you could do crash_debug without debug=y?
> 
> debug=y unfortunately is more than just a "meta" option that selects
> verbose=y and frame_pointer=y. It also turns off NDEBUG so that debug
> messages appear. I'm not sure how that should be mapped in the context
> of this patch. Should the messages be enabled when DEBUG is enabled or
> should there be another option?

Let's not make this too fine grained, at least for now. I.e. enabling
DEBUG should mean exactly what "debug=y" so far meant.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 1/2] build: add debug menu to Kconfig
  2016-03-25 20:59   ` Doug Goldstein
@ 2016-03-30 15:29     ` Dario Faggioli
  0 siblings, 0 replies; 12+ messages in thread
From: Dario Faggioli @ 2016-03-30 15:29 UTC (permalink / raw)
  To: Doug Goldstein, Konrad Rzeszutek Wilk
  Cc: Tim Deegan, Keir Fraser, Ian Jackson, Jan Beulich, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1078 bytes --]

On Fri, 2016-03-25 at 15:59 -0500, Doug Goldstein wrote:
> On 3/25/16 2:42 PM, Konrad Rzeszutek Wilk wrote:
> > 
> > > This is more of an RFC than a merge request. If this seems
> > > reasonable I'll
> > > add all the other debugging options under this menu as well.
> > > Obviously if
> > > this seems reasonable and the patch is fine we can merge it and
> > > I'll submit
> > > the others as a follow up.
> > There would be more I presume - the lock profile, gcov, crash,
> > etc..
> Yes. I just wanted to do one to get an idea of how people felt about
> the
> menu.
> 
Cpupools have some kind of very verbose debugging that could fit in
here, and scheduling too.

So, FWIW, I indeed like this menu, and am up for plumbing the two
components above under it. :-)

Thanks and Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 2/2] build: convert crash_debug to Kconfig
  2016-03-29  8:50       ` Jan Beulich
@ 2016-03-30 15:38         ` Doug Goldstein
  0 siblings, 0 replies; 12+ messages in thread
From: Doug Goldstein @ 2016-03-30 15:38 UTC (permalink / raw)
  To: Jan Beulich, Konrad Rzeszutek Wilk; +Cc: Andrew Cooper, Keir Fraser, xen-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1437 bytes --]

On 3/29/16 3:50 AM, Jan Beulich wrote:
>>>> On 25.03.16 at 22:02, <cardoe@cardoe.com> wrote:
>> On 3/25/16 2:49 PM, Konrad Rzeszutek Wilk wrote:
>>> On Thu, Mar 24, 2016 at 11:48:19AM -0500, Doug Goldstein wrote:
>>>> --- a/xen/Kconfig.debug
>>>> +++ b/xen/Kconfig.debug
>>>> @@ -4,3 +4,14 @@ menuconfig DEBUG
>>>>  	---help---
>>>>  	  If you want to debug Xen say Y and select any additional debugging
>>>>  	  support options.
>>>> +
>>>> +if DEBUG
>>>
>>> Perhaps if !defined then atuomatically enable it? Looking at Config.mk
>>> it seems you could do crash_debug without debug=y?
>>
>> debug=y unfortunately is more than just a "meta" option that selects
>> verbose=y and frame_pointer=y. It also turns off NDEBUG so that debug
>> messages appear. I'm not sure how that should be mapped in the context
>> of this patch. Should the messages be enabled when DEBUG is enabled or
>> should there be another option?
> 
> Let's not make this too fine grained, at least for now. I.e. enabling
> DEBUG should mean exactly what "debug=y" so far meant.
> 
> Jan
> 

That's what I was stating this patch does. The question revolved around
the fact that you can do crash_debug=y debug=n right now and if that
made sense. Should crash_debug=y imply debug=y as well.

So things are more fine grained and I was proposing we make it less so
if the fine grained choices didn't make sense.

-- 
Doug Goldstein


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 959 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 1/2] build: add debug menu to Kconfig
  2016-03-24 16:48 [RFC PATCH 1/2] build: add debug menu to Kconfig Doug Goldstein
  2016-03-24 16:48 ` [RFC PATCH 2/2] build: convert crash_debug " Doug Goldstein
  2016-03-25 19:42 ` [RFC PATCH 1/2] build: add debug menu " Konrad Rzeszutek Wilk
@ 2016-04-08 23:18 ` Jan Beulich
  2 siblings, 0 replies; 12+ messages in thread
From: Jan Beulich @ 2016-04-08 23:18 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Keir Fraser, Tim Deegan, Ian Jackson, xen-devel

>>> On 24.03.16 at 17:48, <cardoe@cardoe.com> wrote:
> There are a number of debugging options for Xen so the idea is to have a
> menu to group them all together.
> 
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
> ---
> This is more of an RFC than a merge request. If this seems reasonable I'll
> add all the other debugging options under this menu as well. Obviously if
> this seems reasonable and the patch is fine we can merge it and I'll submit
> the others as a follow up.

I certainly welcome this, provided a solution to the so far shared
meaning of "debug=y" for the xen/ and tools/ subtrees can be
found. Allowing them to use different settings is maybe a nice
option, but by default the build mode for both subtrees should
imo be the same.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 2/2] build: convert crash_debug to Kconfig
  2016-03-25 21:02     ` Doug Goldstein
  2016-03-29  8:50       ` Jan Beulich
@ 2016-04-08 23:24       ` Jan Beulich
  2016-04-08 23:30         ` Jan Beulich
  1 sibling, 1 reply; 12+ messages in thread
From: Jan Beulich @ 2016-04-08 23:24 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Andrew Cooper, Keir Fraser, xen-devel

>>> On 25.03.16 at 22:02, <cardoe@cardoe.com> wrote:
> On 3/25/16 2:49 PM, Konrad Rzeszutek Wilk wrote:
>> On Thu, Mar 24, 2016 at 11:48:19AM -0500, Doug Goldstein wrote:
>>> --- a/xen/Kconfig.debug
>>> +++ b/xen/Kconfig.debug
>>> @@ -4,3 +4,14 @@ menuconfig DEBUG
>>>  	---help---
>>>  	  If you want to debug Xen say Y and select any additional debugging
>>>  	  support options.
>>> +
>>> +if DEBUG
>> 
>> Perhaps if !defined then atuomatically enable it? Looking at Config.mk
>> it seems you could do crash_debug without debug=y?
> 
> debug=y unfortunately is more than just a "meta" option that selects
> verbose=y and frame_pointer=y. It also turns off NDEBUG so that debug
> messages appear. I'm not sure how that should be mapped in the context
> of this patch. Should the messages be enabled when DEBUG is enabled or
> should there be another option?

I think this should be each another option, defaulting in a way
matching what the current implications are. Perhaps, as elsewhere,
the prompts should again be made dependent upon EXPERT.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [RFC PATCH 2/2] build: convert crash_debug to Kconfig
  2016-04-08 23:24       ` Jan Beulich
@ 2016-04-08 23:30         ` Jan Beulich
  0 siblings, 0 replies; 12+ messages in thread
From: Jan Beulich @ 2016-04-08 23:30 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Andrew Cooper, Keir Fraser, xen-devel

>>> On 09.04.16 at 01:24, <JBeulich@suse.com> wrote:
>>>> On 25.03.16 at 22:02, <cardoe@cardoe.com> wrote:
>> On 3/25/16 2:49 PM, Konrad Rzeszutek Wilk wrote:
>>> On Thu, Mar 24, 2016 at 11:48:19AM -0500, Doug Goldstein wrote:
>>>> --- a/xen/Kconfig.debug
>>>> +++ b/xen/Kconfig.debug
>>>> @@ -4,3 +4,14 @@ menuconfig DEBUG
>>>>  	---help---
>>>>  	  If you want to debug Xen say Y and select any additional debugging
>>>>  	  support options.
>>>> +
>>>> +if DEBUG
>>> 
>>> Perhaps if !defined then atuomatically enable it? Looking at Config.mk
>>> it seems you could do crash_debug without debug=y?
>> 
>> debug=y unfortunately is more than just a "meta" option that selects
>> verbose=y and frame_pointer=y. It also turns off NDEBUG so that debug
>> messages appear. I'm not sure how that should be mapped in the context
>> of this patch. Should the messages be enabled when DEBUG is enabled or
>> should there be another option?
> 
> I think this should be each another option, defaulting in a way
> matching what the current implications are. Perhaps, as elsewhere,
> the prompts should again be made dependent upon EXPERT.

And, realizing this kind of contradicts an earlier reply, please take
this as a partial override to the earlier one. I'm really mainly
concerned of things getting too fine grained if they're not made
EXPERT dependent. Apart from that I think flexibility is generally
useful.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-04-08 23:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-24 16:48 [RFC PATCH 1/2] build: add debug menu to Kconfig Doug Goldstein
2016-03-24 16:48 ` [RFC PATCH 2/2] build: convert crash_debug " Doug Goldstein
2016-03-25 19:49   ` Konrad Rzeszutek Wilk
2016-03-25 21:02     ` Doug Goldstein
2016-03-29  8:50       ` Jan Beulich
2016-03-30 15:38         ` Doug Goldstein
2016-04-08 23:24       ` Jan Beulich
2016-04-08 23:30         ` Jan Beulich
2016-03-25 19:42 ` [RFC PATCH 1/2] build: add debug menu " Konrad Rzeszutek Wilk
2016-03-25 20:59   ` Doug Goldstein
2016-03-30 15:29     ` Dario Faggioli
2016-04-08 23:18 ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).