Skip to contentSkip to conversation

xen: some CONFIG_DEBUG_INFO changes

PATCH Superseded Juergen Gross 2 participants 16 messages Mar 7, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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.

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

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

PATCH 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"). 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.

---
 xen/Kconfig.debug | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
xen/Kconfig.debug +7 -7
index fad3050d4f..a2691f4239 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 1/2] xen: move CONFIG_DEBUG_INFO out of EXPERT section

Quoted 4 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.

In how far does this apply to xen.efi as well? (You can't really use xen-syms for crash debugging when the crash occurred with xen.efi in use.)

Quoted 6 lines

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"). The old gcc version selection was based on the assumption, that newer gcc won't regress in this regard.

This is good to know, but I'm still curious about the mentioned differences in symbol addresses: If code generation didn't change, what caused addresses to differ? Is that merely because individual functions or objects are emitted in different order by the compiler? (If so I'd be inclined to infer that comparing generated code must have been quite a bit of effort, as first of all you would have had to undo that re-ordering.)

The other thing to at least mention here is that with new enough binutils, when Dwarf debug info can be enabled for keeping in xen.efi, linking time of xen.efi increases quite a bit with DEBUG_INFO=y (which is a result of linking ELF objects into a non-ELF binary, when at least GNU ld optimizes only the ELF -> ELF case when processing the [massive amount of] relocations).

Quoted 1 line

So move CONFIG_DEBUG_INFO out of the section guarded by EXPERT.

Isn't the prior DEBUG dependency as relevant?

xen/Kconfig.debug config DEBUG · line 17

Quoted 10 lines
xen/Kconfig.debug +4 -0
@@ -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---

Nit: Even if just code movement, please use "help" in the moved instance.

xen/Kconfig.debug config DEBUG · line 21

Quoted 4 lines
xen/Kconfig.debug +3 -0
+	  If you say Y here the resulting Xen will include debugging info
+	  resulting in a larger binary image.
+
 if DEBUG || EXPERT

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 1/2] xen: move CONFIG_DEBUG_INFO out of EXPERT section

Quoted 9 lines · Jan Beulich
Quoted 4 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.

In how far does this apply to xen.efi as well? (You can't really use xen-syms for crash debugging when the crash occurred with xen.efi in use.)

TBH I don't know what is needed for analysis of crash dumps with the xen.efi binary.

Quoted 8 lines
Quoted 7 lines

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"). The old gcc version selection was based on the assumption, that newer gcc won't regress in this regard.

Quoted 7 lines

This is good to know, but I'm still curious about the mentioned differences in symbol addresses: If code generation didn't change, what caused addresses to differ? Is that merely because individual functions or objects are emitted in different order by the compiler? (If so I'd be inclined to infer that comparing generated code must have been quite a bit of effort, as first of all you would have had to undo that re-ordering.)

I did a simple diff of the two disassembly outputs and got only small differences for %rip relative addresses (the differences were in the range of +/- 32 bytes).

Quoted 6 lines

The other thing to at least mention here is that with new enough binutils, when Dwarf debug info can be enabled for keeping in xen.efi, linking time of xen.efi increases quite a bit with DEBUG_INFO=y (which is a result of linking ELF objects into a non-ELF binary, when at least GNU ld optimizes only the ELF -> ELF case when processing the [massive amount of] relocations).

Okay, I can add this.

Quoted 4 lines
Quoted 2 lines

So move CONFIG_DEBUG_INFO out of the section guarded by EXPERT.

Isn't the prior DEBUG dependency as relevant?

Not for the case "non-debug builds" the patch is addressing.

Quoted 7 lines
Quoted 7 lines
xen/Kconfig.debug +0 -0
@@ -11,6 +11,13 @@ config DEBUG
 
  	  You probably want to say 'N' here.
 
Quoted 7 lines

xen/Kconfig.debug config DEBUG · line 17

Quoted 4 lines
xen/Kconfig.debug +4 -0
+config DEBUG_INFO
+	bool "Compile Xen with debug info"
+	default DEBUG
+	---help---

Nit: Even if just code movement, please use "help" in the moved instance.

Okay.

Quoted 13 lines

xen/Kconfig.debug config DEBUG · line 21

Quoted 5 lines
xen/Kconfig.debug +3 -0
+	  If you say Y here the resulting Xen will include debugging info
+	  resulting in a larger binary image.
+
  if DEBUG || EXPERT

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

Fine with me.

Juergen

#4 lore raw

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

Quoted 17 lines · Juergen Gross
Quoted 8 lines · Jan Beulich
Quoted 6 lines · Juergen Gross

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"). The old gcc version selection was based on the assumption, that newer gcc won't regress in this regard.

Quoted 7 lines

This is good to know, but I'm still curious about the mentioned differences in symbol addresses: If code generation didn't change, what caused addresses to differ? Is that merely because individual functions or objects are emitted in different order by the compiler? (If so I'd be inclined to infer that comparing generated code must have been quite a bit of effort, as first of all you would have had to undo that re-ordering.)

Quoted 3 lines

I did a simple diff of the two disassembly outputs and got only small differences for %rip relative addresses (the differences were in the range of +/- 32 bytes).

That's still odd and hence imo wants understanding. Do you still have both binaries around?

Jan

#5 lore raw

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

Quoted 18 lines · Jan Beulich
Quoted 17 lines · Juergen Gross
Quoted 15 lines · Jan Beulich
Quoted 6 lines · Juergen Gross

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"). The old gcc version selection was based on the assumption, that newer gcc won't regress in this regard.

This is good to know, but I'm still curious about the mentioned differences in symbol addresses: If code generation didn't change, what caused addresses to differ? Is that merely because individual functions or objects are emitted in different order by the compiler? (If so I'd be inclined to infer that comparing generated code must have been quite a bit of effort, as first of all you would have had to undo that re-ordering.)

Quoted 6 lines
Quoted 3 lines

I did a simple diff of the two disassembly outputs and got only small differences for %rip relative addresses (the differences were in the range of +/- 32 bytes).

That's still odd and hence imo wants understanding. Do you still have both binaries around?

I have just regenerated the one with debug-info. It is a 4.17 build.

I just found the at least one reason: xen_config_data has a different size (obviously!) and this finally leads to an offset of 32 bytes for symbols at higher addresses (with some items only differing by 8 bytes due to alignment).

Juergen

#6 lore raw

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

Quoted 26 lines · Juergen Gross
Quoted 18 lines · Jan Beulich
Quoted 17 lines · Juergen Gross
Quoted 15 lines · Jan Beulich
Quoted 6 lines · Juergen Gross

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"). The old gcc version selection was based on the assumption, that newer gcc won't regress in this regard.

This is good to know, but I'm still curious about the mentioned differences in symbol addresses: If code generation didn't change, what caused addresses to differ? Is that merely because individual functions or objects are emitted in different order by the compiler? (If so I'd be inclined to infer that comparing generated code must have been quite a bit of effort, as first of all you would have had to undo that re-ordering.)

Quoted 6 lines
Quoted 3 lines

I did a simple diff of the two disassembly outputs and got only small differences for %rip relative addresses (the differences were in the range of +/- 32 bytes).

That's still odd and hence imo wants understanding. Do you still have both binaries around?

Quoted 6 lines

I have just regenerated the one with debug-info. It is a 4.17 build.

I just found the at least one reason: xen_config_data has a different size (obviously!) and this finally leads to an offset of 32 bytes for symbols at higher addresses (with some items only differing by 8 bytes due to alignment).

Thanks for checking - this kind of a delta is of course to be expected.

Jan

#7 lore raw

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

---
 xen/Kconfig.debug | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
xen/Kconfig.debug +5 -2
index a2691f4239..20c73ee55a 100644
@@ -15,8 +15,11 @@ 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 xen-syms and the built EFI
+	  binary.
 
 if DEBUG || EXPERT
 
Signature · 1 line
2.35.3
#8 lore raw

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

xen/Kconfig.debug config DEBUG_INFO · line 22

Quoted 13 lines · Juergen Gross
xen/Kconfig.debug +5 -2
@@ -15,8 +15,11 @@ 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 xen-syms and the built EFI
+	  binary.

Largely fine with me, just one question: Why do you mention xen-syms by name, but then verbally describe xen.efi? And since, unlike for xen-syms, this affects the installed binary actually used for booting (which may be placed on a space constrained partition), it may be prudent to mention INSTALL_EFI_STRIP here (as a way to reduce the binary size of what ends up on the EFI partition, even if that wouldn't affect the "normal" way of putting the binary on the EFI partition - people would still need to take care of that in their distros).

I guess this size aspect wrt the EFI partition is actually something that should also be mentioned in patch 1, because this can be an argument against exposure of the option (precisely because it requires extra activity to prevent the EFI partition running out of space).

Jan

#9 lore raw

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

Quoted 17 lines · Jan Beulich

xen/Kconfig.debug config DEBUG_INFO · line 22

Quoted 13 lines · Juergen Gross
xen/Kconfig.debug +5 -2
@@ -15,8 +15,11 @@ 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 xen-syms and the built EFI
+	  binary.

Largely fine with me, just one question: Why do you mention xen-syms by name, but then verbally describe xen.efi? And since, unlike for xen-syms,

For xen-syms I couldn't find an easily understandable wording. I'd be fine with just saying "xen.efi".

Quoted 6 lines

this affects the installed binary actually used for booting (which may be placed on a space constrained partition), it may be prudent to mention INSTALL_EFI_STRIP here (as a way to reduce the binary size of what ends up on the EFI partition, even if that wouldn't affect the "normal" way of putting the binary on the EFI partition - people would still need to take care of that in their distros).

What about adding a related Kconfig option instead?

I'd be fine with a textual mentioning of INSTALL_EFI_STRIP, too.

Quoted 4 lines

I guess this size aspect wrt the EFI partition is actually something that should also be mentioned in patch 1, because this can be an argument against exposure of the option (precisely because it requires extra activity to prevent the EFI partition running out of space).

This might be another reason to make it easily configurable.

Juergen

#10 lore raw

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

Quoted 22 lines · Juergen Gross
Quoted 17 lines · Jan Beulich

xen/Kconfig.debug config DEBUG_INFO · line 22

Quoted 13 lines · Juergen Gross
xen/Kconfig.debug +5 -2
@@ -15,8 +15,11 @@ 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 xen-syms and the built EFI
+	  binary.

Largely fine with me, just one question: Why do you mention xen-syms by name, but then verbally describe xen.efi? And since, unlike for xen-syms,

For xen-syms I couldn't find an easily understandable wording. I'd be fine with just saying "xen.efi".

Quoted 8 lines
Quoted 6 lines

this affects the installed binary actually used for booting (which may be placed on a space constrained partition), it may be prudent to mention INSTALL_EFI_STRIP here (as a way to reduce the binary size of what ends up on the EFI partition, even if that wouldn't affect the "normal" way of putting the binary on the EFI partition - people would still need to take care of that in their distros).

What about adding a related Kconfig option instead?

How would a Kconfig option possibly affect this? You want debug info in the xen.efi in its standard install location (outside of the EFI partition); or else if you don't want it there why would you want it in xen-syms? It is the step of populating the EFI partition from the standard install location where some equivalent of INSTALL_EFI_STRIP would come into play. That step is done outside of Xen's build system and hence outside of any Kconfig control.

Jan

Quoted 11 lines

I'd be fine with a textual mentioning of INSTALL_EFI_STRIP, too.

Quoted 4 lines

I guess this size aspect wrt the EFI partition is actually something that should also be mentioned in patch 1, because this can be an argument against exposure of the option (precisely because it requires extra activity to prevent the EFI partition running out of space).

This might be another reason to make it easily configurable.

Juergen

#11 lore raw

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

Quoted 32 lines · Jan Beulich
Quoted 22 lines · Juergen Gross
Quoted 17 lines · Jan Beulich

xen/Kconfig.debug config DEBUG_INFO · line 22

Quoted 13 lines · Juergen Gross
xen/Kconfig.debug +5 -2
@@ -15,8 +15,11 @@ 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 xen-syms and the built EFI
+	  binary.

Largely fine with me, just one question: Why do you mention xen-syms by name, but then verbally describe xen.efi? And since, unlike for xen-syms,

For xen-syms I couldn't find an easily understandable wording. I'd be fine with just saying "xen.efi".

Quoted 8 lines
Quoted 6 lines

this affects the installed binary actually used for booting (which may be placed on a space constrained partition), it may be prudent to mention INSTALL_EFI_STRIP here (as a way to reduce the binary size of what ends up on the EFI partition, even if that wouldn't affect the "normal" way of putting the binary on the EFI partition - people would still need to take care of that in their distros).

What about adding a related Kconfig option instead?

Quoted 7 lines

How would a Kconfig option possibly affect this? You want debug info in the xen.efi in its standard install location (outside of the EFI partition); or else if you don't want it there why would you want it in xen-syms? It is the step of populating the EFI partition from the standard install location where some equivalent of INSTALL_EFI_STRIP would come into play. That step is done outside of Xen's build system and hence outside of any Kconfig control.

We have 2 binaries for the non-EFI hypervisor (xen-syms and xen[.gz]). Why can't we have the same for EFI? E.g. xen-syms.efi and xen.efi. The former would have the debug-info, the latter could be installed into the EFI partition.

Juergen

#12 lore raw

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

Quoted 41 lines · Juergen Gross
Quoted 32 lines · Jan Beulich
Quoted 22 lines · Juergen Gross
Quoted 17 lines · Jan Beulich

xen/Kconfig.debug config DEBUG_INFO · line 22

Quoted 13 lines · Juergen Gross
xen/Kconfig.debug +5 -2
@@ -15,8 +15,11 @@ 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 xen-syms and the built EFI
+	  binary.

Largely fine with me, just one question: Why do you mention xen-syms by name, but then verbally describe xen.efi? And since, unlike for xen-syms,

For xen-syms I couldn't find an easily understandable wording. I'd be fine with just saying "xen.efi".

Quoted 8 lines
Quoted 6 lines

this affects the installed binary actually used for booting (which may be placed on a space constrained partition), it may be prudent to mention INSTALL_EFI_STRIP here (as a way to reduce the binary size of what ends up on the EFI partition, even if that wouldn't affect the "normal" way of putting the binary on the EFI partition - people would still need to take care of that in their distros).

What about adding a related Kconfig option instead?

Quoted 7 lines

How would a Kconfig option possibly affect this? You want debug info in the xen.efi in its standard install location (outside of the EFI partition); or else if you don't want it there why would you want it in xen-syms? It is the step of populating the EFI partition from the standard install location where some equivalent of INSTALL_EFI_STRIP would come into play. That step is done outside of Xen's build system and hence outside of any Kconfig control.

Quoted 4 lines

We have 2 binaries for the non-EFI hypervisor (xen-syms and xen[.gz]). Why can't we have the same for EFI? E.g. xen-syms.efi and xen.efi. The former would have the debug-info, the latter could be installed into the EFI partition.

I view the two-binaries model of the non-EFI case as merely an implementation detail; it just so happens that there's little point in mkelf32 retaining debug info. I therefore don't view it as very reasonable to artificially introduce yet another binary. Another thing would be if there was a way to produce a binary without debug info accompanied by a separate file holding just the debug info. Yet I'm unaware of such being possible with PE/COFF binaries.

But yes - technically this might be an option (although, just to mention it, I'm having a vague recollection of there being an issue with this, but I can't say what this might be, plus it is easily possible that I'm misremembering or mixing up things).

Jan

#13 lore raw

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

Quoted 42 lines · Jan Beulich
Quoted 41 lines · Juergen Gross
Quoted 39 lines · Jan Beulich
Quoted 22 lines · Juergen Gross
Quoted 17 lines · Jan Beulich

xen/Kconfig.debug config DEBUG_INFO · line 22

Quoted 13 lines · Juergen Gross
xen/Kconfig.debug +5 -2
@@ -15,8 +15,11 @@ 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 xen-syms and the built EFI
+	  binary.

Largely fine with me, just one question: Why do you mention xen-syms by name, but then verbally describe xen.efi? And since, unlike for xen-syms,

For xen-syms I couldn't find an easily understandable wording. I'd be fine with just saying "xen.efi".

Quoted 8 lines
Quoted 6 lines

this affects the installed binary actually used for booting (which may be placed on a space constrained partition), it may be prudent to mention INSTALL_EFI_STRIP here (as a way to reduce the binary size of what ends up on the EFI partition, even if that wouldn't affect the "normal" way of putting the binary on the EFI partition - people would still need to take care of that in their distros).

What about adding a related Kconfig option instead?

How would a Kconfig option possibly affect this? You want debug info in the xen.efi in its standard install location (outside of the EFI partition); or else if you don't want it there why would you want it in xen-syms? It is the step of populating the EFI partition from the standard install location where some equivalent of INSTALL_EFI_STRIP would come into play. That step is done outside of Xen's build system and hence outside of any Kconfig control.

Quoted 7 lines
Quoted 4 lines

We have 2 binaries for the non-EFI hypervisor (xen-syms and xen[.gz]). Why can't we have the same for EFI? E.g. xen-syms.efi and xen.efi. The former would have the debug-info, the latter could be installed into the EFI partition.

I view the two-binaries model of the non-EFI case as merely an implementation detail;

The ability to do crash dump analysis is more than an implementation detail IMHO. It is a feature and as such the availability of xen-syms should be seen as an interface which functionality should be kept.

Quoted 3 lines

it just so happens that there's little point
in mkelf32 retaining debug info. I therefore don't view it as very reasonable to artificially introduce yet another binary.

In case there is no other way to enable hypervisor crash dump analysis I don't see this as an unreasonable approach.

It should be verified that this approach is really enabling the crash dump analysis of a crash dump from a xen.efi booted system, of course.

Juergen

#14 lore raw

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

Quoted 48 lines · Juergen Gross
Quoted 47 lines · Jan Beulich
Quoted 45 lines · Juergen Gross
Quoted 32 lines · Jan Beulich
Quoted 22 lines · Juergen Gross
Quoted 17 lines · Jan Beulich

xen/Kconfig.debug config DEBUG_INFO · line 22

Quoted 13 lines · Juergen Gross
xen/Kconfig.debug +5 -2
@@ -15,8 +15,11 @@ 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 xen-syms and the built EFI
+	  binary.

Largely fine with me, just one question: Why do you mention xen-syms by name, but then verbally describe xen.efi? And since, unlike for xen-syms,

For xen-syms I couldn't find an easily understandable wording. I'd be fine with just saying "xen.efi".

Quoted 8 lines
Quoted 6 lines

this affects the installed binary actually used for booting (which may be placed on a space constrained partition), it may be prudent to mention INSTALL_EFI_STRIP here (as a way to reduce the binary size of what ends up on the EFI partition, even if that wouldn't affect the "normal" way of putting the binary on the EFI partition - people would still need to take care of that in their distros).

What about adding a related Kconfig option instead?

Quoted 7 lines

How would a Kconfig option possibly affect this? You want debug info in the xen.efi in its standard install location (outside of the EFI partition); or else if you don't want it there why would you want it in xen-syms? It is the step of populating the EFI partition from the standard install location where some equivalent of INSTALL_EFI_STRIP would come into play. That step is done outside of Xen's build system and hence outside of any Kconfig control.

We have 2 binaries for the non-EFI hypervisor (xen-syms and xen[.gz]). Why can't we have the same for EFI? E.g. xen-syms.efi and xen.efi. The former would have the debug-info, the latter could be installed into the EFI partition.

Quoted 6 lines
Quoted 2 lines

I view the two-binaries model of the non-EFI case as merely an implementation detail;

The ability to do crash dump analysis is more than an implementation detail IMHO. It is a feature and as such the availability of xen-syms should be seen as an interface which functionality should be kept.

That you're looking the opposite way at things: The oddity is that we can't use xen-syms directly for booting (which is also why it has this specific name; otherwise "xen" would be what the linker produces).

Quoted 9 lines
Quoted 3 lines

it just so happens that there's little point
in mkelf32 retaining debug info. I therefore don't view it as very reasonable to artificially introduce yet another binary.

In case there is no other way to enable hypervisor crash dump analysis I don't see this as an unreasonable approach.

It should be verified that this approach is really enabling the crash dump analysis of a crash dump from a xen.efi booted system, of course.

Right. First question would be whether they manage to consume Dwarf debug info from a PE/COFF executable. Possibly the way to go is to separate Dwarf data out of xen.efi into an ELF "container"; I have no idea whether objcopy could be used for something like that.

Jan

#15 lore raw

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

Quoted 67 lines · Jan Beulich
Quoted 48 lines · Juergen Gross
Quoted 47 lines · Jan Beulich
Quoted 45 lines · Juergen Gross
Quoted 32 lines · Jan Beulich
Quoted 22 lines · Juergen Gross
Quoted 17 lines · Jan Beulich

xen/Kconfig.debug config DEBUG_INFO · line 22

Quoted 13 lines · Juergen Gross
xen/Kconfig.debug +5 -2
@@ -15,8 +15,11 @@ 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 xen-syms and the built EFI
+	  binary.

Largely fine with me, just one question: Why do you mention xen-syms by name, but then verbally describe xen.efi? And since, unlike for xen-syms,

For xen-syms I couldn't find an easily understandable wording. I'd be fine with just saying "xen.efi".

Quoted 8 lines
Quoted 6 lines

this affects the installed binary actually used for booting (which may be placed on a space constrained partition), it may be prudent to mention INSTALL_EFI_STRIP here (as a way to reduce the binary size of what ends up on the EFI partition, even if that wouldn't affect the "normal" way of putting the binary on the EFI partition - people would still need to take care of that in their distros).

What about adding a related Kconfig option instead?

Quoted 7 lines

How would a Kconfig option possibly affect this? You want debug info in the xen.efi in its standard install location (outside of the EFI partition); or else if you don't want it there why would you want it in xen-syms? It is the step of populating the EFI partition from the standard install location where some equivalent of INSTALL_EFI_STRIP would come into play. That step is done outside of Xen's build system and hence outside of any Kconfig control.

We have 2 binaries for the non-EFI hypervisor (xen-syms and xen[.gz]). Why can't we have the same for EFI? E.g. xen-syms.efi and xen.efi. The former would have the debug-info, the latter could be installed into the EFI partition.

Quoted 6 lines
Quoted 2 lines

I view the two-binaries model of the non-EFI case as merely an implementation detail;

The ability to do crash dump analysis is more than an implementation detail IMHO. It is a feature and as such the availability of xen-syms should be seen as an interface which functionality should be kept.

That you're looking the opposite way at things: The oddity is that we can't use xen-syms directly for booting (which is also why it has this specific name; otherwise "xen" would be what the linker produces).

Quoted 7 lines
Quoted 3 lines

it just so happens that there's little point
in mkelf32 retaining debug info. I therefore don't view it as very reasonable to artificially introduce yet another binary.

In case there is no other way to enable hypervisor crash dump analysis I don't see this as an unreasonable approach.

Quoted 7 lines
Quoted 2 lines

It should be verified that this approach is really enabling the crash dump analysis of a crash dump from a xen.efi booted system, of course.

Right. First question would be whether they manage to consume Dwarf debug info from a PE/COFF executable. Possibly the way to go is to separate Dwarf data out of xen.efi into an ELF "container"; I have no idea whether objcopy could be used for something like that.

I tried:

Quoted 1 line

objcopy --remove-section=.text --remove-section=.rodata --remove-section=.init.* --remove-section=.data --remove-section=.data.* --remove-section=.bss --output-target=elf64-x86-64 xen.efi xen-debug

and the result was:

Quoted 1 line

objdump -h xen-debug

xen-debug: file format elf64-x86-64

Sections:

Idx Name          Size      VMA               LMA               File off  Algn
  0 .buildid      00000035  ffff82d040486fb8  ffff82d040486fb8  00000fb8  2**2

CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .init 000a2340 ffff82d040600000 ffff82d040600000 00001000 2**2
CONTENTS, ALLOC, LOAD, CODE
2 .reloc 00001658 ffff82d04094d5a0 ffff82d04094d5a0 000a35a0 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .debug_abbrev 00091f6b ffff82d04094ebf8 ffff82d04094ebf8 000a4bf8 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
4 .debug_info 00fd7af4 ffff82d0409e0b63 ffff82d0409e0b63 00136b63 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
5 .debug_str 00843395 ffff82d0419b8657 ffff82d0419b8657 0110e657 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
6 .debug_line 0011dba5 ffff82d0421fb9ec ffff82d0421fb9ec 019519ec 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
7 .debug_frame 0003fd7c ffff82d042319594 ffff82d042319594 01a6f591 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
8 .debug_loc 0047fcfd ffff82d042359310 ffff82d042359310 01aaf30d 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
9 .debug_ranges 000d2650 ffff82d0427d9010 ffff82d0427d9010 01f2f00a 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
10 .debug_aranges 00015bd0 ffff82d0428ab660 ffff82d0428ab660 0200165a 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS

This seems to be a reasonable output. Whether crash is happy with that file is another question, of course.

Juergen