[PATCH] kdump: Give crashkernel CMA areas unique names

Usama Arif usama.arif at linux.dev
Fri Nov 6 05:50:55 PST 2026


On Fri,  6 Nov 2026 11:43:09 +0100 Mikhail Zaslonko <zaslonko at linux.ibm.com> wrote:

> reserve_crashkernel_cma() names every CMA area it reserves
> "crashkernel". If the requested size can't be reserved in one piece,
> it falls back to several smaller areas, all with the same name.
> With CONFIG_CMA_SYSFS, cma_sysfs_init() then fails to create the second
> directory:
> 
>   sysfs: cannot create duplicate filename '/kernel/mm/cma/crashkernel'
> 
> and the error path removes the sysfs entries of all CMA areas.
> 
> With CONFIG_CMA_DEBUGFS, debugfs refuses the duplicate directories as
> well:
> 
>   debugfs: 'crashkernel' already exists in 'cma'
> 
> so only the first area shows up in debugfs.
> 
> Keep the name of the first area and add the index to the others:
> crashkernel, crashkernel1, crashkernel2, ...
> 
> Fixes: ab475510e042 ("kdump: implement reserve_crashkernel_cma")
> Signed-off-by: Mikhail Zaslonko <zaslonko at linux.ibm.com>
> ---
> Found while adding crashkernel CMA support for s390.
> 
>  kernel/crash_reserve.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Thanks for the fix and pointing me to it in [1]!

Acked-by: Usama Arif <usama.arif at linux.dev>

[1] https://lore.kernel.org/all/20261106104309.3669583-1-zaslonko@linux.ibm.com/

> 
> diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c
> index eee37a11380c..e58318b1e092 100644
> --- a/kernel/crash_reserve.c
> +++ b/kernel/crash_reserve.c
> @@ -483,10 +483,16 @@ void __init reserve_crashkernel_cma(unsigned long long cma_size)
>  	while (cma_size > reserved_size &&
>  	       crashk_cma_cnt < CRASHKERNEL_CMA_RANGES_MAX) {
>  
> +		char name[CMA_MAX_NAME];
>  		struct cma *res;
>  
> +		/* CMA area names show up in sysfs and debugfs, keep them unique */
> +		if (crashk_cma_cnt)
> +			snprintf(name, sizeof(name), "crashkernel%d", crashk_cma_cnt);
> +		else
> +			strscpy(name, "crashkernel");
>  		if (cma_declare_contiguous(0, request_size, 0, 0, 0, false,
> -				       "crashkernel", &res)) {
> +				       name, &res)) {
>  			/* reservation failed, try half-sized blocks */
>  			if (request_size <= PAGE_SIZE)
>  				break;
> 
> base-commit: f66469d9905b39d2c260a15d7d6db450f4db67c1
> -- 
> 2.55.0
> 
> 



More information about the kexec mailing list