Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20201118204006.869487226@linutronix.de

+11 -3
+1 -1
include/asm-generic/kmap_size.h
··· 3 3 #define _ASM_GENERIC_KMAP_SIZE_H 4 4 5 5 /* For debug this provides guard pages between the maps */ 6 - #ifdef CONFIG_DEBUG_HIGHMEM 6 + #ifdef CONFIG_DEBUG_KMAP_LOCAL 7 7 # define KM_MAX_IDX 33 8 8 #else 9 9 # define KM_MAX_IDX 16
+8
lib/Kconfig.debug
··· 849 849 850 850 Say N if unsure. 851 851 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 + 852 859 config DEBUG_HIGHMEM 853 860 bool "Highmem debugging" 854 861 depends on DEBUG_KERNEL && HIGHMEM 862 + select DEBUG_KMAP_LOCAL 855 863 help 856 864 This option enables additional error checking for high memory 857 865 systems. Disable for production systems.
+2 -2
mm/highmem.c
··· 368 368 static DEFINE_PER_CPU(int, __kmap_local_idx); 369 369 370 370 /* 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 372 372 * slot is unused which acts as a guard page 373 373 */ 374 - #ifdef CONFIG_DEBUG_HIGHMEM 374 + #ifdef CONFIG_DEBUG_KMAP_LOCAL 375 375 # define KM_INCR 2 376 376 #else 377 377 # define KM_INCR 1