[PATCH] RISC-V: enable CONFIG_ARCH_KEEP_MEMBLOCK

Yixun Lan dlan at gentoo.org
Sat Jun 11 21:34:33 PDT 2022


Preserve the memblock info while CONFIG_DEBUG_FS is enabled.
So later, the information can be showed at:
  /sys/kernel/debug/memblock/{memory,reserved}

Signed-off-by: Yixun Lan <dlan at gentoo.org>

---
Check mm/memblock.c:2120 for the code logic:
   #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_ARCH_KEEP_MEMBLOCK)

I've tested on unmatched board, with this patch applied
for example, we can see the memblock reserved info as:

 # cat /sys/kernel/debug/memblock/reserved
   0: 0x0000000080000000..0x000000008007ffff
   1: 0x0000000080200000..0x00000000823fffff
   2: 0x0000000088000000..0x000000008800307f
   3: 0x00000000ec000000..0x00000000ffffffff
   4: 0x000000046d600000..0x000000047edfffff
   5: 0x000000047ee2d000..0x000000047eeecfff
   6: 0x000000047eeed440..0x000000047eeed947
   7: 0x000000047eeed980..0x000000047eeede1f
   8: 0x000000047eeede40..0x000000047eeedfc7
   9: 0x000000047eeee000..0x000000047ef59fff
  10: 0x000000047ef5c000..0x000000047efdd05f
  11: 0x000000047efdd080..0x000000047efdd29f
  12: 0x000000047efdd2c0..0x000000047efdd3df
  13: 0x000000047efdd400..0x000000047efdd41f
  14: 0x000000047efdd440..0x000000047efdd44f
  15: 0x000000047efdd480..0x000000047efdd487
  16: 0x000000047efdd4c0..0x000000047efdd525
  17: 0x000000047efdd540..0x000000047efdd5a5
  18: 0x000000047efdd5c0..0x000000047ffdfa47
  19: 0x000000047ffdfa78..0x000000047ffdfaa8
  20: 0x000000047ffdfab0..0x000000047ffdfade
  21: 0x000000047ffdfae0..0x000000047ffdfb0e
  22: 0x000000047ffdfb10..0x000000047ffeeffb
---
 arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index c22f58155948..e457c5855222 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -32,6 +32,7 @@ config RISCV
 	select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAS_UBSAN_SANITIZE_ALL
+	select ARCH_KEEP_MEMBLOCK
 	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
 	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
 	select ARCH_STACKWALK
-- 
2.35.1




More information about the linux-riscv mailing list