All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] configs/debug: set CONFIG_DEBUG_INFO=y properly
@ 2022-03-01 20:29 Qian Cai
  2022-03-08 10:42 ` Daniel Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: Qian Cai @ 2022-03-01 20:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Qian Cai

CONFIG_DEBUG_INFO can't be set by user directly, so set
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y instead. Otherwise, we end
up with no debuginfo in vmlinux which is a big no-no for kernel
debugging.

Signed-off-by: Qian Cai <quic_qiancai@quicinc.com>
---
 kernel/configs/debug.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/configs/debug.config b/kernel/configs/debug.config
index e9ffb0cc1eec..07df6d93c4df 100644
--- a/kernel/configs/debug.config
+++ b/kernel/configs/debug.config
@@ -16,7 +16,7 @@ CONFIG_SYMBOLIC_ERRNAME=y
 #
 # Compile-time checks and compiler options
 #
-CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
 CONFIG_DEBUG_SECTION_MISMATCH=y
 CONFIG_FRAME_WARN=2048
 CONFIG_SECTION_MISMATCH_WARN_ONLY=y
-- 
2.30.2


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

* Re: [PATCH] configs/debug: set CONFIG_DEBUG_INFO=y properly
  2022-03-01 20:29 [PATCH] configs/debug: set CONFIG_DEBUG_INFO=y properly Qian Cai
@ 2022-03-08 10:42 ` Daniel Thompson
  2022-03-08 13:56   ` Qian Cai
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Thompson @ 2022-03-08 10:42 UTC (permalink / raw)
  To: Qian Cai; +Cc: Andrew Morton, linux-kernel

On Tue, Mar 01, 2022 at 03:29:20PM -0500, Qian Cai wrote:
> CONFIG_DEBUG_INFO can't be set by user directly,

What do you mean by "can't be set by user directly"? DEBUG_INFO
is fully controlable via menuconfig.


> so set CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y instead.
> Otherwise, we end up with no debuginfo in vmlinux which is
> a big no-no for kernel debugging.
> 
> Signed-off-by: Qian Cai <quic_qiancai@quicinc.com>
> ---
>  kernel/configs/debug.config | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/configs/debug.config b/kernel/configs/debug.config
> index e9ffb0cc1eec..07df6d93c4df 100644
> --- a/kernel/configs/debug.config
> +++ b/kernel/configs/debug.config
> @@ -16,7 +16,7 @@ CONFIG_SYMBOLIC_ERRNAME=y
>  #
>  # Compile-time checks and compiler options
>  #
> -CONFIG_DEBUG_INFO=y
> +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y

Does this change actually work in the kernels it has merged into?

DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT existence is predicated on DEBUG_INFO
being set. It makes no sense at all to set the former without the later.

I tried this with ARCH=arm64 and it is clearly not working and should
probably be reverted from v5.17:
~~~
maple$ git describe
v5.17-rc7
maple$ make defconfig
*** Default configuration is based on 'defconfig'
#
# No change to .config
#
maple$ scripts/config --disable DEBUG_INFO && make oldconfig
#
# configuration written to .config
#
maple$ grep DEBUG_INFO .config
# CONFIG_DEBUG_INFO is not set
maple$ make debug.config
<removed-long-output-here>
maple$ grep DEBUG_INFO .config
# CONFIG_DEBUG_INFO is not set
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           ^^^^^^^^^
	       ^
maple$ echo CONFIG_DEBUG_INFO=y kernel/configs/debug_info.config
CONFIG_DEBUG_INFO=y kernel/configs/debug_info.config
maple$ make debug_info.config
Using .config as base
Merging ./kernel/configs/debug_info.config
Value of CONFIG_DEBUG_INFO is redefined by fragment ./kernel/configs/debug_info.config:
Previous value: # CONFIG_DEBUG_INFO is not set
New value: CONFIG_DEBUG_INFO=y

#
# merged configuration written to .config (needs make)
#
#
# configuration written to .config
#
maple$ grep DEBUG_INFO .config
CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_INFO_REDUCED is not set
# CONFIG_DEBUG_INFO_COMPRESSED is not set
# CONFIG_DEBUG_INFO_SPLIT is not set
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
# CONFIG_DEBUG_INFO_DWARF4 is not set
# CONFIG_DEBUG_INFO_DWARF5 is not set
~~~


Daniel.

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

* Re: [PATCH] configs/debug: set CONFIG_DEBUG_INFO=y properly
  2022-03-08 10:42 ` Daniel Thompson
@ 2022-03-08 13:56   ` Qian Cai
  2022-03-08 14:30     ` Daniel Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: Qian Cai @ 2022-03-08 13:56 UTC (permalink / raw)
  To: Daniel Thompson; +Cc: Andrew Morton, linux-kernel

On Tue, Mar 08, 2022 at 10:42:15AM +0000, Daniel Thompson wrote:
> On Tue, Mar 01, 2022 at 03:29:20PM -0500, Qian Cai wrote:
> > CONFIG_DEBUG_INFO can't be set by user directly,
> 
> What do you mean by "can't be set by user directly"? DEBUG_INFO
> is fully controlable via menuconfig.

On linux-next, we no longer able to select DEBUG_INFO directly due to this
patch:

https://lore.kernel.org/all/20220125075126.891825-1-keescook@chromium.org/

Thus, this patch will work on both the mainline and linux-next.

> Does this change actually work in the kernels it has merged into?
> 
> DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT existence is predicated on DEBUG_INFO
> being set. It makes no sense at all to set the former without the later.

It works fine here.

$ git reset --hard v5.17-rc7
$ rm .config
$ make ARCH=arm64 defconfig debug.config
$ grep -i debug_info .config
CONFIG_DEBUG_INFO=y

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

* Re: [PATCH] configs/debug: set CONFIG_DEBUG_INFO=y properly
  2022-03-08 13:56   ` Qian Cai
@ 2022-03-08 14:30     ` Daniel Thompson
  2022-03-08 15:11       ` Qian Cai
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Thompson @ 2022-03-08 14:30 UTC (permalink / raw)
  To: Qian Cai; +Cc: Andrew Morton, linux-kernel

On Tue, Mar 08, 2022 at 08:56:00AM -0500, Qian Cai wrote:
> On Tue, Mar 08, 2022 at 10:42:15AM +0000, Daniel Thompson wrote:
> > On Tue, Mar 01, 2022 at 03:29:20PM -0500, Qian Cai wrote:
> > > CONFIG_DEBUG_INFO can't be set by user directly,
> > 
> > What do you mean by "can't be set by user directly"? DEBUG_INFO
> > is fully controlable via menuconfig.
> 
> On linux-next, we no longer able to select DEBUG_INFO directly due to this
> patch:
> 
> https://lore.kernel.org/all/20220125075126.891825-1-keescook@chromium.org/
> 
> Thus, this patch will work on both the mainline and linux-next.

So your patch sounds like it works for linux-next but, as shown in the
example I shared, it does not work on mainline and should not be
included in v5.17-rc7 .


> > Does this change actually work in the kernels it has merged into?
> > 
> > DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT existence is predicated on DEBUG_INFO
> > being set. It makes no sense at all to set the former without the later.
> 
> It works fine here.
> 
> $ git reset --hard v5.17-rc7
> $ rm .config
> $ make ARCH=arm64 defconfig debug.config
> $ grep -i debug_info .config
> CONFIG_DEBUG_INFO=y

That is *not* an example of debug.config working correctly. It is an
example that only works by accident because the arm64 defconfig already
included CONFIG_DEBUG_INFO=y (that's why I explicitly disabled it in my
example demonstrating the problem before I applied debug.config).

However debug.config is not specific to arm64 and, for v5.17-rc7 it is
also not working with the defconfigs for (at least) arm, powerpc, riscv and
x86 (both i386 and x86_64).

I'm still of the view that any change that removes CONFIG_DEBUG_INFO=y
cannot be sensibly applied to kernels that do not include Kees' patch.


Daniel.

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

* Re: [PATCH] configs/debug: set CONFIG_DEBUG_INFO=y properly
  2022-03-08 14:30     ` Daniel Thompson
@ 2022-03-08 15:11       ` Qian Cai
  0 siblings, 0 replies; 5+ messages in thread
From: Qian Cai @ 2022-03-08 15:11 UTC (permalink / raw)
  To: Daniel Thompson; +Cc: Andrew Morton, linux-kernel

On Tue, Mar 08, 2022 at 02:30:29PM +0000, Daniel Thompson wrote:
> That is *not* an example of debug.config working correctly. It is an
> example that only works by accident because the arm64 defconfig already
> included CONFIG_DEBUG_INFO=y (that's why I explicitly disabled it in my
> example demonstrating the problem before I applied debug.config).
> 
> However debug.config is not specific to arm64 and, for v5.17-rc7 it is
> also not working with the defconfigs for (at least) arm, powerpc, riscv and
> x86 (both i386 and x86_64).
> 
> I'm still of the view that any change that removes CONFIG_DEBUG_INFO=y
> cannot be sensibly applied to kernels that do not include Kees' patch.

Okay, good points. I'll make a patch for v5.17, so people don't need to
wait for a few weeks for flip DEBUG_INFO without Kees' patch then.

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

end of thread, other threads:[~2022-03-08 15:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 20:29 [PATCH] configs/debug: set CONFIG_DEBUG_INFO=y properly Qian Cai
2022-03-08 10:42 ` Daniel Thompson
2022-03-08 13:56   ` Qian Cai
2022-03-08 14:30     ` Daniel Thompson
2022-03-08 15:11       ` Qian Cai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.