Re: [PATCH v3 2/2] mm/memblock: Add reserve_mem debugfs info
From: Mike Rapoport
Date: Thu Mar 19 2026 - 12:49:20 EST
On Wed, Mar 18, 2026 at 03:56:33PM -0300, Guilherme G. Piccoli wrote:
> When using the "reserve_mem" parameter, users aim at having an
> area that (hopefully) persists across boots, so pstore infrastructure
> (like ramoops module) can make use of that to save oops/ftrace logs,
> for example.
>
> There is no easy way to determine if this kernel parameter is properly
> set though; the kernel doesn't show information about this memory in
> memblock debugfs, neither in /proc/iomem nor dmesg. This is a relevant
> information for tools like kdumpst[0], to determine if it's reliable
> to use the reserved area as ramoops persistent storage; checking only
> /proc/cmdline is not sufficient as it doesn't tell if the reservation
> effectively succeeded or not.
>
> Add here a new file under memblock debugfs showing properly set memory
> reservations, with name and size as passed to "reserve_mem". Notice that
> if no "reserve_mem=" is passed on command-line or if the reservation
> attempts fail, the file is not created.
...
> -static int __init memblock_init_debugfs(void)
> +static inline void memblock_debugfs_make_dirs(struct dentry *root)
This does not make dirs but rather exposes files representing memblock
arrays.
How about calling this function
memblock_debugfs_expose_arrays()?
> {
> - struct dentry *root = debugfs_create_dir("memblock", NULL);
> -
> - debugfs_create_file("memory", 0444, root,
> - &memblock.memory, &memblock_debug_fops);
> - debugfs_create_file("reserved", 0444, root,
> - &memblock.reserved, &memblock_debug_fops);
> #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
> debugfs_create_file("physmem", 0444, root, &physmem,
> &memblock_debug_fops);
> #endif
> + debugfs_create_file("memory", 0444, root,
> + &memblock.memory, &memblock_debug_fops);
> + debugfs_create_file("reserved", 0444, root,
> + &memblock.reserved, &memblock_debug_fops);
No need to move these after PHYS_MAP attribute
> +}
--
Sincerely yours,
Mike.