Skip to content

Commit 6e799cb

Browse files
committed
mm/highmem: Provide and use CONFIG_DEBUG_KMAP_LOCAL
CONFIG_KMAP_LOCAL can be enabled by x86/32bit even if CONFIG_HIGHMEM is not enabled for temporary MMIO space mappings. Provide it as a seperate config option which depends on CONFIG_KMAP_LOCAL and let CONFIG_DEBUG_HIGHMEM select it. This won't increase the debug coverage of this significantly but it paves the way to do so. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 13c8da5 commit 6e799cb

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

include/asm-generic/kmap_size.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define _ASM_GENERIC_KMAP_SIZE_H
44

55
/* For debug this provides guard pages between the maps */
6-
#ifdef CONFIG_DEBUG_HIGHMEM
6+
#ifdef CONFIG_DEBUG_KMAP_LOCAL
77
# define KM_MAX_IDX 33
88
#else
99
# define KM_MAX_IDX 16

lib/Kconfig.debug

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,17 @@ config DEBUG_PER_CPU_MAPS
849849

850850
Say N if unsure.
851851

852+
config DEBUG_KMAP_LOCAL
853+
bool "Debug kmap_local temporary mappings"
854+
depends on DEBUG_KERNEL && KMAP_LOCAL
855+
help
856+
This option enables additional error checking for the kmap_local
857+
infrastructure. Disable for production use.
858+
852859
config DEBUG_HIGHMEM
853860
bool "Highmem debugging"
854861
depends on DEBUG_KERNEL && HIGHMEM
862+
select DEBUG_KMAP_LOCAL
855863
help
856864
This option enables additional error checking for high memory
857865
systems. Disable for production systems.

mm/highmem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,10 @@ EXPORT_SYMBOL(kunmap_high);
368368
static DEFINE_PER_CPU(int, __kmap_local_idx);
369369

370370
/*
371-
* With DEBUG_HIGHMEM the stack depth is doubled and every second
371+
* With DEBUG_KMAP_LOCAL the stack depth is doubled and every second
372372
* slot is unused which acts as a guard page
373373
*/
374-
#ifdef CONFIG_DEBUG_HIGHMEM
374+
#ifdef CONFIG_DEBUG_KMAP_LOCAL
375375
# define KM_INCR 2
376376
#else
377377
# define KM_INCR 1

0 commit comments

Comments
 (0)