Skip to contentSkip to conversation

xen: some CONFIG_DEBUG_INFO changes

PATCH Superseded Juergen Gross 2 participants 8 messages Apr 3, 2023 – Apr 5, 2023

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover xen: some CONFIG_DEBUG_INFO changes

Enabling crash dump analysis of the hypervisor requires the hypervisor having been built with CONFIG_DEBUG_INFO enabled. Today this requires either CONFIG_DEBUG or CONFIG_EXPERT set, which are both not security supported.

This small series changes that in order to allow security supported Xen builds with the capability to do crash dump analysis via the "crash" tool.

Note that due to problems with test machines proper support for EFI booted systems hasn't been verified, so this will likely need some more work.

Changes in V2:
- comments addressed

Juergen Gross (2):
xen: move CONFIG_DEBUG_INFO out of EXPERT section
xen: update CONFIG_DEBUG_INFO help text

 xen/Kconfig.debug | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH v2 1/2 xen: move CONFIG_DEBUG_INFO out of EXPERT section

In order to support hypervisor analysis of crash dumps, xen-syms needs to contain debug_info. It should be allowed to configure the hypervisor to be built with CONFIG_DEBUG_INFO in non-debug builds without having to enable EXPERT.

Using a rather oldish gcc (7.5) it was verified that code generation doesn't really differ between CONFIG_DEBUG_INFO on or off without CONFIG_DEBUG being set (only observed differences were slightly different symbol addresses, verified via "objdump -d", resulting from the different config.gz in the binary). The old gcc version selection was based on the assumption, that newer gcc won't regress in this regard.

So move CONFIG_DEBUG_INFO out of the section guarded by EXPERT.

It should be mentioned that there have been reports that the linking of the xen.efi might take considerably longer with CONFIG_DEBUG_INFO selected when using newer binutils.

---
V2:
- expanded commit message (Jan Beulich)

---
 xen/Kconfig.debug | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
xen/Kconfig.debug +7 -7
index fad3050d4f..e0d773d347 100644
@@ -11,6 +11,13 @@ config DEBUG
 
 	  You probably want to say 'N' here.
 
+config DEBUG_INFO
+	bool "Compile Xen with debug info"
+	default DEBUG
+	help
+	  If you say Y here the resulting Xen will include debugging info
+	  resulting in a larger binary image.
+
 if DEBUG || EXPERT
 
 config CRASH_DEBUG
@@ -28,13 +35,6 @@ config GDBSX
 	  If you want to enable support for debugging guests from dom0 via
 	  gdbsx then say Y.
 
-config DEBUG_INFO
-	bool "Compile Xen with debug info"
-	default y
-	---help---
-	  If you say Y here the resulting Xen will include debugging info
-	  resulting in a larger binary image.
-
 config FRAME_POINTER
 	bool "Compile Xen with frame pointers"
 	default DEBUG
Signature · 1 line
2.35.3
#2 lore raw

Re: [PATCH v2 1/2] xen: move CONFIG_DEBUG_INFO out of EXPERT section

Quoted 13 lines · Juergen Gross

In order to support hypervisor analysis of crash dumps, xen-syms needs to contain debug_info. It should be allowed to configure the hypervisor to be built with CONFIG_DEBUG_INFO in non-debug builds without having to enable EXPERT.

Using a rather oldish gcc (7.5) it was verified that code generation doesn't really differ between CONFIG_DEBUG_INFO on or off without CONFIG_DEBUG being set (only observed differences were slightly different symbol addresses, verified via "objdump -d", resulting from the different config.gz in the binary). The old gcc version selection was based on the assumption, that newer gcc won't regress in this regard.

Quoted 5 lines

So move CONFIG_DEBUG_INFO out of the section guarded by EXPERT.

It should be mentioned that there have been reports that the linking of the xen.efi might take considerably longer with CONFIG_DEBUG_INFO selected when using newer binutils.

Thinking of it: Because of the need to deal with older binutils, we already force --strip-debug as a linking option for xen.efi in certain cases. Perhaps we could make another (x86-only) Kconfig control which allows to force this mode even with recent binutils? If so, would you be willing to include this right here, or should I take care of this afterwards (or maybe even in parallel)?

Quoted 4 lines
xen/Kconfig.debug +0 -0
@@ -11,6 +11,13 @@ config DEBUG
 

xen/Kconfig.debug config DEBUG · line 21

Quoted 10 lines
xen/Kconfig.debug +7 -0
 	  You probably want to say 'N' here.
 
+config DEBUG_INFO
+	bool "Compile Xen with debug info"
+	default DEBUG
+	help
+	  If you say Y here the resulting Xen will include debugging info
+	  resulting in a larger binary image.
+
 if DEBUG || EXPERT

Just to repeat my v1 comment (to which your response was "Fine with me"):

The new placement isn't very helpful when considering some of the ways kconfig data is presented. At least for the non-graphical presentation it used to be the case that hierarchies were presented properly only when dependencies immediately followed their dependents (i.e. here:
DEBUG is a dependent of everything inside the "if" above). Therefore I think rather than moving the block up you may better move it down past the "endif".

Jan

#3 lore raw

Re: [PATCH v2 1/2] xen: move CONFIG_DEBUG_INFO out of EXPERT section

Quoted 20 lines · Jan Beulich
Quoted 13 lines · Juergen Gross

In order to support hypervisor analysis of crash dumps, xen-syms needs to contain debug_info. It should be allowed to configure the hypervisor to be built with CONFIG_DEBUG_INFO in non-debug builds without having to enable EXPERT.

Using a rather oldish gcc (7.5) it was verified that code generation doesn't really differ between CONFIG_DEBUG_INFO on or off without CONFIG_DEBUG being set (only observed differences were slightly different symbol addresses, verified via "objdump -d", resulting from the different config.gz in the binary). The old gcc version selection was based on the assumption, that newer gcc won't regress in this regard.

Quoted 5 lines

So move CONFIG_DEBUG_INFO out of the section guarded by EXPERT.

It should be mentioned that there have been reports that the linking of the xen.efi might take considerably longer with CONFIG_DEBUG_INFO selected when using newer binutils.

Quoted 6 lines

Thinking of it: Because of the need to deal with older binutils, we already force --strip-debug as a linking option for xen.efi in certain cases. Perhaps we could make another (x86-only) Kconfig control which allows to force this mode even with recent binutils? If so, would you be willing to include this right here, or should I take care of this afterwards (or maybe even in parallel)?

I'm planning to do the EFI side in the next days, hoping that I can setup the test system.

I'd include that additional config option in the probably needed patch(es) then (crash isn't happy with xen.efi anyway, so I'll need some kind of xen-syms.efi or whatever you want to call it).

Quoted 18 lines
Quoted 5 lines
xen/Kconfig.debug +0 -0
@@ -11,6 +11,13 @@ config DEBUG
 

xen/Kconfig.debug config DEBUG · line 21

Quoted 10 lines
xen/Kconfig.debug +7 -0
  	  You probably want to say 'N' here.
 
+config DEBUG_INFO
+	bool "Compile Xen with debug info"
+	default DEBUG
+	help
+	  If you say Y here the resulting Xen will include debugging info
+	  resulting in a larger binary image.
+
  if DEBUG || EXPERT

Just to repeat my v1 comment (to which your response was "Fine with me"):

Quoted 7 lines

The new placement isn't very helpful when considering some of the ways kconfig data is presented. At least for the non-graphical presentation it used to be the case that hierarchies were presented properly only when dependencies immediately followed their dependents (i.e. here:
DEBUG is a dependent of everything inside the "if" above). Therefore I think rather than moving the block up you may better move it down past the "endif".

Oh, I seem to have missed that last paragraph when going through the thread.

Will correct it.

Juergen

#4 lore raw

PATCH v2 2/2 xen: update CONFIG_DEBUG_INFO help text

In reply to Juergen Gross

Update the help text of the CONFIG_DEBUG_INFO option to be a little bit more specific.

---
V2:
- expand help text, especially mentioning INSTALL_EFI_STRIP (Jan Beulich)

---
 xen/Kconfig.debug | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
xen/Kconfig.debug +8 -2
index e0d773d347..e6e609f813 100644
@@ -15,8 +15,14 @@ config DEBUG_INFO
 	bool "Compile Xen with debug info"
 	default DEBUG
 	help
-	  If you say Y here the resulting Xen will include debugging info
-	  resulting in a larger binary image.
+	  Say Y here if you want to build Xen with debug information. This
+	  information is needed e.g. for doing crash dump analysis of the
+	  hypervisor via the "crash" tool.
+	  Saying Y will increase the size of the xen-syms and xen.efi
+	  binaries. In case the space on the EFI boot partition is rather
+	  limited, you may want to make use of the INSTALL_EFI_STRIP make
+	  variable when building the hypervisor, in order to strip xen.efi
+	  before installing it to the EFI partition.
 
 if DEBUG || EXPERT
 
Signature · 1 line
2.35.3
#5 lore raw

Re: [PATCH v2 2/2] xen: update CONFIG_DEBUG_INFO help text

Quoted 6 lines · Juergen Gross
xen/Kconfig.debug +0 -0
@@ -15,8 +15,14 @@ config DEBUG_INFO
 	bool "Compile Xen with debug info"
 	default DEBUG
 	help

xen/Kconfig.debug config DEBUG_INFO · line 25

Quoted 10 lines
xen/Kconfig.debug +8 -2
-	  If you say Y here the resulting Xen will include debugging info
-	  resulting in a larger binary image.
+	  Say Y here if you want to build Xen with debug information. This
+	  information is needed e.g. for doing crash dump analysis of the
+	  hypervisor via the "crash" tool.
+	  Saying Y will increase the size of the xen-syms and xen.efi
+	  binaries. In case the space on the EFI boot partition is rather
+	  limited, you may want to make use of the INSTALL_EFI_STRIP make
+	  variable when building the hypervisor, in order to strip xen.efi
+	  before installing it to the EFI partition.

Hmm, INSTALL_EFI_STRIP is only a courtesy to developers wanting to install xen.efi directly into the EFI partition. It wouldn't affect the normal flow, and hence I think this wants expressing here such that both kinds of people have at least a hint what they need to do. I.e. in the normal case they'd need to adjust the way xen.efi is "propagated" from its installed location onto the EFI partition, to do the desired stripping at that time.

Jan

#6 lore raw

Re: [PATCH v2 2/2] xen: update CONFIG_DEBUG_INFO help text

Quoted 16 lines · Jan Beulich
Quoted 15 lines · Juergen Gross
xen/Kconfig.debug +7 -2
@@ -15,8 +15,14 @@ config DEBUG_INFO
  	bool "Compile Xen with debug info"
  	default DEBUG
  	help
-	  If you say Y here the resulting Xen will include debugging info
-	  resulting in a larger binary image.
+	  Say Y here if you want to build Xen with debug information. This
+	  information is needed e.g. for doing crash dump analysis of the
+	  hypervisor via the "crash" tool.
+	  Saying Y will increase the size of the xen-syms and xen.efi
+	  binaries. In case the space on the EFI boot partition is rather
+	  limited, you may want to make use of the INSTALL_EFI_STRIP make
+	  variable when building the hypervisor, in order to strip xen.efi
Quoted 8 lines

xen/Kconfig.debug config DEBUG_INFO · line 25

Quoted 1 line
xen/Kconfig.debug +1 -0
+	  before installing it to the EFI partition.

Hmm, INSTALL_EFI_STRIP is only a courtesy to developers wanting to install xen.efi directly into the EFI partition. It wouldn't affect the normal flow, and hence I think this wants expressing here such that both kinds of people have at least a hint what they need to do. I.e. in the normal case they'd need to adjust the way xen.efi is "propagated" from its installed location onto the EFI partition, to do the desired stripping at that time.

Would you be fine with:

In case the space on the EFI boot partition is rather limited, you may want to install a stripped variant of xen.efi in the EFI boot partition (look for "INSTALL_EFI_STRIP" in docs/misc/efi.pandoc for more information - when not using "make install-xen" for installing xen.efi, stripping needs to be done outside the Xen build environment).

Juergen

#7 lore raw

Re: [PATCH v2 2/2] xen: update CONFIG_DEBUG_INFO help text

Quoted 26 lines · Juergen Gross
Quoted 16 lines · Jan Beulich
Quoted 15 lines · Juergen Gross
xen/Kconfig.debug +7 -2
@@ -15,8 +15,14 @@ config DEBUG_INFO
  	bool "Compile Xen with debug info"
  	default DEBUG
  	help
-	  If you say Y here the resulting Xen will include debugging info
-	  resulting in a larger binary image.
+	  Say Y here if you want to build Xen with debug information. This
+	  information is needed e.g. for doing crash dump analysis of the
+	  hypervisor via the "crash" tool.
+	  Saying Y will increase the size of the xen-syms and xen.efi
+	  binaries. In case the space on the EFI boot partition is rather
+	  limited, you may want to make use of the INSTALL_EFI_STRIP make
+	  variable when building the hypervisor, in order to strip xen.efi
Quoted 8 lines

xen/Kconfig.debug config DEBUG_INFO · line 25

Quoted 1 line
xen/Kconfig.debug +1 -0
+	  before installing it to the EFI partition.

Hmm, INSTALL_EFI_STRIP is only a courtesy to developers wanting to install xen.efi directly into the EFI partition. It wouldn't affect the normal flow, and hence I think this wants expressing here such that both kinds of people have at least a hint what they need to do. I.e. in the normal case they'd need to adjust the way xen.efi is "propagated" from its installed location onto the EFI partition, to do the desired stripping at that time.

Quoted 8 lines

Would you be fine with:

In case the space on the EFI boot partition is rather limited, you may want to install a stripped variant of xen.efi in the EFI boot partition (look for "INSTALL_EFI_STRIP" in docs/misc/efi.pandoc for more information - when not using "make install-xen" for installing xen.efi, stripping needs to be done outside the Xen build environment).

SGTM, thanks.

Jan