Bug 15252

Summary: Enables CONFIG_DEBUG_PREEMPT
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: kernelAssignee: Bruce Ashfield <bruce.ashfield>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: randy.macleod, tom.zanussi
Version: 4.3   
Target Milestone: 5.1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ross Burton 2023-10-23 11:35:01 UTC
Our kernel enables CONFIG_DEBUG_PREEMPT:

$ grep CONFIG_DEBUG_PREEMPT /yocto/ross/build/tmp/work/qemuarm64-poky-linux/linux-yocto/6.5.7+git/linux-qemuarm64-standard-build/.config
CONFIG_DEBUG_PREEMPT=y

(poky nanbield, qemuarm64)

As per https://lore.kernel.org/lkml/ZTKScoO9kz_LxNMG@ariel/ this is basically a 20% performance hit in some benchmarks.  I think we should disable it in default kernels.
Comment 1 Bruce Ashfield 2023-10-23 15:01:05 UTC
We don't have it on by default, only the selftests do:

lib/oeqa/selftest/cases/runtime_test.py:KERNEL_EXTRA_FEATURES:append = " features/debug/debug-kernel.scc"


So if we don't want it on for the tests, we need to change it there .. but that would get us less information about crashes and issues, so it isn't my call to make.
Comment 2 Ross Burton 2023-10-23 15:36:59 UTC
I hate to disagree with you, but in a brand new build tree:

$ bitbake virtual/kernel -c showconfig
Config file written to /yocto/ross/buildnew/tmp/work/qemux86_64-poky-linux/linux-yocto/6.5.7+git/linux-qemux86_64-standard-build/.config

$ grep DEBUG.*= /yocto/ross/buildnew/tmp/work/qemux86_64-poky-linux/linux-yocto/6.5.7+git/linux-qemux86_64-standard-build/.config
CONFIG_CGROUP_DEBUG=y
CONFIG_X86_DEBUGCTLMSR=y
CONFIG_PM_DEBUG=y
CONFIG_PM_ADVANCED_DEBUG=y
CONFIG_PM_SLEEP_DEBUG=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_BLK_DEBUG_FS=y
CONFIG_BT_DEBUGFS=y
CONFIG_PNP_DEBUG_MESSAGES=y
CONFIG_SCSI_DEBUG=m
CONFIG_CIFS_DEBUG=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_MISC=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_DEBUG_INFO_COMPRESSED_NONE=y
CONFIG_DEBUG_FS=y
CONFIG_DEBUG_FS_ALLOW_ALL=y
CONFIG_ARCH_HAS_EARLY_DEBUG=y
CONFIG_SLUB_DEBUG=y
CONFIG_ARCH_HAS_DEBUG_WX=y
CONFIG_HAVE_DEBUG_KMEMLEAK=y
CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y
CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_SCHED_DEBUG=y
CONFIG_DEBUG_PREEMPT=y
CONFIG_LOCK_DEBUGGING_SUPPORT=y
CONFIG_X86_DEBUG_FPU=y

After the configure task the top-level .config is the active config, correct?
Comment 3 Bruce Ashfield 2023-10-23 17:00:31 UTC
Right, it is also enabled by the poky distro:

meta-poky/conf/distro/poky.conf:KERNEL_EXTRA_FEATURES:append = " features/debug/debug-kernel.scc"

So that is your culprit for the enable.
Comment 4 Ross Burton 2023-10-23 17:01:55 UTC
That seems suboptimal.
Comment 5 Ross Burton 2023-10-23 17:02:48 UTC
If SPDX needs symbols, can we have separate "debug symbols" and "debug statements"?
Comment 6 Bruce Ashfield 2023-11-09 15:36:28 UTC
This is under unit test now.