Skip to contentSkip to conversation

kmemcheck: Disable SLUB and SLAB debugging when kmemcheck is enabled

PATCH Applied Pekka Enberg 4 participants 8 messages Feb 23, 2009 – Feb 26, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kmemcheck: Disable SLUB and SLAB debugging when kmemcheck is enabled

From: Pekka Enberg <[email protected]>

Enabling kmemcheck in Kconfig is a painful experience. Lets make it a tad bit easier by inverting the dependencies to SLUB and SLAB debugging. As kmemcheck is more powerful than slab debugging, disable the latter functionality if an user enables kmemcheck.

Cc Vegard Nossum <[email protected]>
Cc Christoph Lameter <[email protected]>
---
 arch/x86/Kconfig.debug |    2 +-
 init/Kconfig           |    2 +-
 lib/Kconfig.debug      |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/Kconfig.debug +1 -1
index de186c5..3d1d593 100644
@@ -276,7 +276,7 @@ menuconfig KMEMCHECK
 	bool "kmemcheck: trap use of uninitialized memory"
 	depends on X86
 	depends on !X86_USE_3DNOW
-	depends on (SLUB && !SLUB_DEBUG_ON) || (SLAB && !DEBUG_SLAB)
+	depends on SLUB || SLAB
 	depends on !CC_OPTIMIZE_FOR_SIZE
 	depends on !DEBUG_PAGEALLOC
 	depends on !FUNCTION_TRACER
init/Kconfig +1 -1
index f068071..36617a4 100644
@@ -890,7 +890,7 @@ config PCI_QUIRKS
 config SLUB_DEBUG
 	default y
 	bool "Enable SLUB debugging support" if EMBEDDED
-	depends on SLUB && SYSFS
+	depends on SLUB && SYSFS && !KMEMCHECK
 	help
 	  SLUB has extensive debug support features. Disabling these can
 	  result in significant savings in code size. This also disables
lib/Kconfig.debug +1 -1
index 29044f5..768e426 100644
@@ -262,7 +262,7 @@ config DEBUG_OBJECTS_ENABLE_DEFAULT
 
 config DEBUG_SLAB
 	bool "Debug slab memory allocations"
-	depends on DEBUG_KERNEL && SLAB
+	depends on DEBUG_KERNEL && SLAB && !KMEMCHECK
 	help
 	  Say Y here to have the kernel do limited verification on memory
 	  allocation as well as poisoning memory on free to catch use of freed
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 6 lines · Pekka Enberg

From: Pekka Enberg <[email protected]>

Enabling kmemcheck in Kconfig is a painful experience. Lets make it a tad bit easier by inverting the dependencies to SLUB and SLAB debugging. As kmemcheck is more powerful than slab debugging, disable the latter functionality if an user enables kmemcheck.

You may also want to add something in the Documentation/kmemcheck.txt saying that it conflicts with CONFIG_DEBUG_PAGEALLOC and CONFIG_SLUB_DEBUG so that people realise why it is not presented as an option...

Signature · 1 line
Sitsofe | http://sucs.org/~sits/
#2 lore raw
In reply to Pekka Enberg
Quoted 4 lines · Pekka Enberg

Enabling kmemcheck in Kconfig is a painful experience. Lets make it a tad bit easier by inverting the dependencies to SLUB and SLAB debugging. As kmemcheck is more powerful than slab debugging, disable the latter functionality if an user enables kmemcheck.

SLUB_DEBUG is fundamentally different from SLAB_DEBUG. It only includes the code to be able to enable debugging at runtime. It does not enable debugging.

#3 lore raw
Quoted 10 lines · Christoph Lameter
Quoted 4 lines · Pekka Enberg

Enabling kmemcheck in Kconfig is a painful experience. Lets make it a tad bit easier by inverting the dependencies to SLUB and SLAB debugging. As kmemcheck is more powerful than slab debugging, disable the latter functionality if an user enables kmemcheck.

SLUB_DEBUG is fundamentally different from SLAB_DEBUG. It only includes the code to be able to enable debugging at runtime. It does not enable debugging.

Yes, I know that but we can't really let the user enable both, slub debugging and kmemcheck debugging, at run-time. That's why I used SLUB_DEBUG here.

#4 lore raw

2009/2/23 Pekka Enberg <[email protected]>:

Quoted 8 lines · Christoph Lameter
Quoted 7 lines · Pekka Enberg
Quoted 5 lines

Enabling kmemcheck in Kconfig is a painful experience. Lets make it a tad bit easier by inverting the dependencies to SLUB and SLAB debugging. As kmemcheck is more powerful than slab debugging, disable the latter functionality if an user enables kmemcheck.

Quoted 7 lines
Quoted 3 lines

SLUB_DEBUG is fundamentally different from SLAB_DEBUG. It only includes the code to be able to enable debugging at runtime. It does not enable debugging.

Yes, I know that but we can't really let the user enable both, slub debugging and kmemcheck debugging, at run-time. That's why I used SLUB_DEBUG here.

It is possible. Which is why it said SLUB_DEBUG_ON to begin with. This is how it works:

If slub_debug=,xyz is specified on the command line, the SLUB debugging will be used for the "xyz" cache, and kmemcheck will track the rest (all non-slub-debugged caches). So if we only disable SLUB_DEBUG_ON, then slub debugging and kmemcheck debugging can still be mixed at boot-time, but kmemcheck will take precedence unless slub_debug= is specified.

Can you rethink whether SLUB_DEBUG or SLUB_DEBUG_ON is the one we really want to depend on !KMEMCHECK, and either submit a new patch or convince me that this is sufficient?

Thanks!

Vegard

Signature · 4 lines
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036
#5 lore raw
Quoted 3 lines · Vegard Nossum

Can you rethink whether SLUB_DEBUG or SLUB_DEBUG_ON is the one we really want to depend on !KMEMCHECK, and either submit a new patch or convince me that this is sufficient?

!SLUB_DEBUG_ON is the right thing to depend on.

#6 lore raw
Quoted 3 lines · Vegard Nossum
Quoted 3 lines

Can you rethink whether SLUB_DEBUG or SLUB_DEBUG_ON is the one we really want to depend on !KMEMCHECK, and either submit a new patch or convince me that this is sufficient?

Quoted 1 line · Christoph Lameter

!SLUB_DEBUG_ON is the right thing to depend on.

Here's a patch to do that.

Pekka

Quoted 1 line

From bae2afd233c24d766e20e09bb92c67c0e5ea16e3 Mon Sep 17 00:00:00 2001

From: Pekka Enberg <[email protected]>
Date: Mon, 23 Feb 2009 11:35:13 +0200
Subject: [PATCH] kmemcheck: Disable SLUB and SLAB debugging when kmemcheck is enabled

Enabling kmemcheck in Kconfig is a painful experience. Lets make it a tad bit easier by inverting the dependencies to SLUB and SLAB debugging. As kmemcheck is more powerful than slab debugging, disable the latter functionality if an user enables kmemcheck.

Cc Vegard Nossum <[email protected]>
Cc Christoph Lameter <[email protected]>
---
 arch/x86/Kconfig.debug |    2 +-
 lib/Kconfig.debug      |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/Kconfig.debug +1 -1
index de186c5..3d1d593 100644
@@ -276,7 +276,7 @@ menuconfig KMEMCHECK
 	bool "kmemcheck: trap use of uninitialized memory"
 	depends on X86
 	depends on !X86_USE_3DNOW
-	depends on (SLUB && !SLUB_DEBUG_ON) || (SLAB && !DEBUG_SLAB)
+	depends on SLUB || SLAB
 	depends on !CC_OPTIMIZE_FOR_SIZE
 	depends on !DEBUG_PAGEALLOC
 	depends on !FUNCTION_TRACER
lib/Kconfig.debug +2 -2
index 29044f5..e9a930c 100644
@@ -262,7 +262,7 @@ config DEBUG_OBJECTS_ENABLE_DEFAULT
 
 config DEBUG_SLAB
 	bool "Debug slab memory allocations"
-	depends on DEBUG_KERNEL && SLAB
+	depends on DEBUG_KERNEL && SLAB && !KMEMCHECK
 	help
 	  Say Y here to have the kernel do limited verification on memory
 	  allocation as well as poisoning memory on free to catch use of freed
@@ -274,7 +274,7 @@ config DEBUG_SLAB_LEAK
 
 config SLUB_DEBUG_ON
 	bool "SLUB debugging on by default"
-	depends on SLUB && SLUB_DEBUG
+	depends on SLUB && SLUB_DEBUG && !KMEMCHECK
 	default n
 	help
 	  Boot with debugging on by default. SLUB boots by default with
Signature · 1 line
1.5.4.3
#7 lore raw

2009/2/26 Pekka Enberg <[email protected]>:

Quoted 4 lines

From: Pekka Enberg <[email protected]>
Date: Mon, 23 Feb 2009 11:35:13 +0200
Subject: [PATCH] kmemcheck: Disable SLUB and SLAB debugging when kmemcheck is enabled

Quoted 8 lines

Enabling kmemcheck in Kconfig is a painful experience. Lets make it a tad bit easier by inverting the dependencies to SLUB and SLAB debugging. As kmemcheck is more powerful than slab debugging, disable the latter functionality if an user enables kmemcheck.

Cc Vegard Nossum <[email protected]>
Cc Christoph Lameter <[email protected]>

Thanks, applied!

Vegard

Signature · 4 lines
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036