Skip to contentSkip to conversation

powerpc/configs: Add debug configs for debugging

PATCH Superseded Gautam Menghani 3 participants 5 messages Aug 27 – Oct 12 PowerPC

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/configs: Add debug configs for debugging

Kernel has multiple config options to run extra validation checks that can help catch bugs. Define new configs for major subsystems to make it easy to enable the debug config options for a given area.

---
v1 -> v2:
1. Split the enablement of configs into pseries and powernv configs.

 arch/powerpc/Makefile                    | 32 ++++++++++++++++++++++++
 arch/powerpc/configs/common_debug.config | 11 ++++++++
 arch/powerpc/configs/locks_debug.config  | 13 ++++++++++
 arch/powerpc/configs/lockup_debug.config |  4 +++
 arch/powerpc/configs/mm_debug.config     | 24 ++++++++++++++++++
 5 files changed, 84 insertions(+)
 create mode 100644 arch/powerpc/configs/common_debug.config
 create mode 100644 arch/powerpc/configs/locks_debug.config
 create mode 100644 arch/powerpc/configs/lockup_debug.config
 create mode 100644 arch/powerpc/configs/mm_debug.config
arch/powerpc/Makefile +32 -0
index 9385db478c59..818aacace875 100644
@@ -352,6 +352,38 @@ ppc64_randconfig:
 	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/64-bit.config \
 		-f $(srctree)/Makefile randconfig
 
+generated_configs += pseries_debug_defconfig
+pseries_debug_defconfig:
+	$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest common_debug)
+
+generated_configs += pseries_locks_debug_defconfig
+pseries_locks_debug_defconfig:
+	$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest locks_debug)
+
+generated_configs += pseries_mm_debug_defconfig
+pseries_mm_debug_defconfig:
+	$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest mm_debug)
+
+generated_configs += pseries_lockup_debug_defconfig
+pseries_lockup_debug_defconfig:
+	$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest lockup_debug)
+
+generated_configs += powernv_debug_defconfig
+powernv_debug_defconfig:
+	$(call merge_into_defconfig,powernv_defconfig,le guest kvm_guest common_debug)
+
+generated_configs += powernv_locks_debug_defconfig
+powernv_locks_debug_defconfig:
+	$(call merge_into_defconfig,powernv_defconfig,le guest kvm_guest locks_debug)
+
+generated_configs += powernv_mm_debug_defconfig
+powernv_mm_debug_defconfig:
+	$(call merge_into_defconfig,powernv_defconfig,le guest kvm_guest mm_debug)
+
+generated_configs += powernv_lockup_debug_defconfig
+powernv_lockup_debug_defconfig:
+	$(call merge_into_defconfig,powernv_defconfig,le guest kvm_guest lockup_debug)
+
 PHONY += $(generated_configs)
 
 define archhelp
arch/powerpc/configs/common_debug.config new file +11 -0
new file mode 100644
index 000000000000..a341c8b41468
@@ -0,0 +1,11 @@
+# For use in CI testing
+CONFIG_EXPERT=y
+CONFIG_PROVE_LOCKING=y
+CONFIG_PROVE_RCU=y
+CONFIG_KASAN=y
+CONFIG_UBSAN=y
+CONFIG_DEBUG_PAGEALLOC=y
+CONFIG_DEBUG_VM=y
+CONFIG_DEBUG_OBJECTS=y
+CONFIG_DEBUG_KMEMLEAK=y
+CONFIG_DEBUG_STACKOVERFLOW=y
arch/powerpc/configs/locks_debug.config new file +13 -0
new file mode 100644
index 000000000000..b2cb23de75db
@@ -0,0 +1,13 @@
+CONFIG_EXPERT=y
+CONFIG_PROVE_LOCKING=y
+CONFIG_DEBUG_LOCK_ALLOC=y
+CONFIG_DEBUG_ATOMIC_SLEEP=y
+CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
+CONFIG_DEBUG_MUTEXES=y
+CONFIG_DEBUG_SPINLOCK=y
+CONFIG_DEBUG_RT_MUTEXES=y
+CONFIG_DEBUG_RWSEMS=y
+CONFIG_PROVE_RAW_LOCK_NESTING=y
+CONFIG_RCU_EXPERT=y
+CONFIG_PROVE_RCU=y
+CONFIG_RCU_TRACE=y
arch/powerpc/configs/lockup_debug.config new file +4 -0
new file mode 100644
index 000000000000..ad0a79abf60f
@@ -0,0 +1,4 @@
+CONFIG_EXPERT=y
+CONFIG_WQ_WATCHDOG=y
+CONFIG_DETECT_HUNG_TASK=y
+CONFIG_PANIC_ON_OOPS=y
arch/powerpc/configs/mm_debug.config new file +24 -0
new file mode 100644
index 000000000000..0e88eb983536
@@ -0,0 +1,24 @@
+CONFIG_EXPERT=y
+CONFIG_DEBUG_PAGEALLOC=y
+CONFIG_DEBUG_SLAB=y
+CONFIG_KASAN=y
+CONFIG_KFENCE=y
+CONFIG_KMSAN=y
+CONFIG_DEBUG_KMEMLEAK=y
+CONFIG_DEBUG_VM=y
+CONFIG_DEBUG_VIRTUAL=y
+CONFIG_DEBUG_OBJECTS=y
+CONFIG_DEBUG_OBJECTS_FREE=y
+CONFIG_DEBUG_OBJECTS_TIMERS=y
+CONFIG_DEBUG_OBJECTS_WORK=y
+CONFIG_DEBUG_OBJECTS_RCU_HEAD=y
+CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
+CONFIG_SCHED_STACK_END_CHECK=y
+CONFIG_DEBUG_VM_MAPLE_TREE=y
+CONFIG_DEBUG_VM_RB=y
+CONFIG_DEBUG_VM_PGFLAGS=y
+CONFIG_DEBUG_MEMORY_INIT=y
+CONFIG_DEBUG_PER_CPU_MAPS=y
+CONFIG_DEBUG_KMAP_LOCAL=y
+CONFIG_DEBUG_HIGHMEM=y
+CONFIG_DEBUG_STACKOVERFLOW=y

--
2.54.0

Reviewed-by on v2 1/1
#1 lore raw
Quoted 140 lines · Gautam Menghani

Kernel has multiple config options to run extra validation checks that can help catch bugs. Define new configs for major subsystems to make it easy to enable the debug config options for a given area.

---
v1 -> v2:
1. Split the enablement of configs into pseries and powernv configs.

 arch/powerpc/Makefile                    | 32 ++++++++++++++++++++++++
 arch/powerpc/configs/common_debug.config | 11 ++++++++
 arch/powerpc/configs/locks_debug.config  | 13 ++++++++++
 arch/powerpc/configs/lockup_debug.config |  4 +++
 arch/powerpc/configs/mm_debug.config     | 24 ++++++++++++++++++
 5 files changed, 84 insertions(+)
 create mode 100644 arch/powerpc/configs/common_debug.config
 create mode 100644 arch/powerpc/configs/locks_debug.config
 create mode 100644 arch/powerpc/configs/lockup_debug.config
 create mode 100644 arch/powerpc/configs/mm_debug.config
arch/powerpc/Makefile +32 -0
index 9385db478c59..818aacace875 100644
@@ -352,6 +352,38 @@ ppc64_randconfig:
 	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/64-bit.config \
 		-f $(srctree)/Makefile randconfig
 
+generated_configs += pseries_debug_defconfig
+pseries_debug_defconfig:
+	$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest common_debug)
+
+generated_configs += pseries_locks_debug_defconfig
+pseries_locks_debug_defconfig:
+	$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest locks_debug)
+
+generated_configs += pseries_mm_debug_defconfig
+pseries_mm_debug_defconfig:
+	$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest mm_debug)
+
+generated_configs += pseries_lockup_debug_defconfig
+pseries_lockup_debug_defconfig:
+	$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest lockup_debug)
+
+generated_configs += powernv_debug_defconfig
+powernv_debug_defconfig:
+	$(call merge_into_defconfig,powernv_defconfig,le guest kvm_guest common_debug)
+
+generated_configs += powernv_locks_debug_defconfig
+powernv_locks_debug_defconfig:
+	$(call merge_into_defconfig,powernv_defconfig,le guest kvm_guest locks_debug)
+
+generated_configs += powernv_mm_debug_defconfig
+powernv_mm_debug_defconfig:
+	$(call merge_into_defconfig,powernv_defconfig,le guest kvm_guest mm_debug)
+
+generated_configs += powernv_lockup_debug_defconfig
+powernv_lockup_debug_defconfig:
+	$(call merge_into_defconfig,powernv_defconfig,le guest kvm_guest lockup_debug)
+
 PHONY += $(generated_configs)
 
 define archhelp
arch/powerpc/configs/common_debug.config new file +11 -0
new file mode 100644
index 000000000000..a341c8b41468
@@ -0,0 +1,11 @@
+# For use in CI testing
+CONFIG_EXPERT=y
+CONFIG_PROVE_LOCKING=y
+CONFIG_PROVE_RCU=y
+CONFIG_KASAN=y
+CONFIG_UBSAN=y
+CONFIG_DEBUG_PAGEALLOC=y
+CONFIG_DEBUG_VM=y
+CONFIG_DEBUG_OBJECTS=y
+CONFIG_DEBUG_KMEMLEAK=y
+CONFIG_DEBUG_STACKOVERFLOW=y
arch/powerpc/configs/locks_debug.config new file +13 -0
new file mode 100644
index 000000000000..b2cb23de75db
@@ -0,0 +1,13 @@
+CONFIG_EXPERT=y
+CONFIG_PROVE_LOCKING=y
+CONFIG_DEBUG_LOCK_ALLOC=y
+CONFIG_DEBUG_ATOMIC_SLEEP=y
+CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
+CONFIG_DEBUG_MUTEXES=y
+CONFIG_DEBUG_SPINLOCK=y
+CONFIG_DEBUG_RT_MUTEXES=y
+CONFIG_DEBUG_RWSEMS=y
+CONFIG_PROVE_RAW_LOCK_NESTING=y
+CONFIG_RCU_EXPERT=y
+CONFIG_PROVE_RCU=y
+CONFIG_RCU_TRACE=y
arch/powerpc/configs/lockup_debug.config new file +4 -0
new file mode 100644
index 000000000000..ad0a79abf60f
@@ -0,0 +1,4 @@
+CONFIG_EXPERT=y
+CONFIG_WQ_WATCHDOG=y
+CONFIG_DETECT_HUNG_TASK=y
+CONFIG_PANIC_ON_OOPS=y
arch/powerpc/configs/mm_debug.config new file +24 -1
new file mode 100644
index 000000000000..0e88eb983536
@@ -0,0 +1,24 @@
+CONFIG_EXPERT=y
+CONFIG_DEBUG_PAGEALLOC=y
+CONFIG_DEBUG_SLAB=y
+CONFIG_KASAN=y
+CONFIG_KFENCE=y
+CONFIG_KMSAN=y
+CONFIG_DEBUG_KMEMLEAK=y
+CONFIG_DEBUG_VM=y
+CONFIG_DEBUG_VIRTUAL=y
+CONFIG_DEBUG_OBJECTS=y
+CONFIG_DEBUG_OBJECTS_FREE=y
+CONFIG_DEBUG_OBJECTS_TIMERS=y
+CONFIG_DEBUG_OBJECTS_WORK=y
+CONFIG_DEBUG_OBJECTS_RCU_HEAD=y
+CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
+CONFIG_SCHED_STACK_END_CHECK=y
+CONFIG_DEBUG_VM_MAPLE_TREE=y
+CONFIG_DEBUG_VM_RB=y
+CONFIG_DEBUG_VM_PGFLAGS=y
+CONFIG_DEBUG_MEMORY_INIT=y
+CONFIG_DEBUG_PER_CPU_MAPS=y
+CONFIG_DEBUG_KMAP_LOCAL=y
+CONFIG_DEBUG_HIGHMEM=y
+CONFIG_DEBUG_STACKOVERFLOW=y
--
Quoted 2 lines

2.54.0

Thanks Gautam for this. we'll be able to catch a lot of issues earlier with this.

#3 lore raw

Hi Gautam.

Quoted 6 lines · Gautam Menghani

Hi,

Can this patch be pulled in? Or is something else needed here?

Thanks,
Gautam

Why it can't be part of existing debug.config? Why add component specific config and merge into def config?

Wouldn't that cause more confusion? If not, could you please add detail in changelog on how one can make use of these?

#4 lore raw
Quoted 7 lines · Shrikanth Hegde

Hi Gautam.

Quoted 4 lines · Gautam Menghani

Hi,

Can this patch be pulled in? Or is something else needed here?

Quoted 8 lines
Quoted 2 lines

Thanks,
Gautam

Why it can't be part of existing debug.config? Why add component specific config and merge into def config?

Wouldn't that cause more confusion? If not, could you please add detail in changelog on how one can make use of these?

The issue with adding all options to debug.config is that if all options are enabled at the same time, performance will take a huge hit. Grouping the options by area will enable devs to only enable a subset of configs. With this patch, you can just do "make pseries_mm_debug_defconfig" to enable mm specific options for example.

I'm open to suggestions if there is a cleaner way to accomplish this.

Thanks,
Gautam