mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mikhail Zaslonko <zaslonko@linux.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Baoquan He <baoquan.he@linux.dev>
Cc: Mike Rapoport <rppt@kernel.org>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	Dave Young <ruirui.yang@linux.dev>, Jiri Bohac <jbohac@suse.cz>,
	David Hildenbrand <david@kernel.org>,
	Usama Arif <usama.arif@linux.dev>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	kexec@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] kdump: Give crashkernel CMA areas unique names
Date: Fri,  6 Nov 2026 11:43:09 +0100	[thread overview]
Message-ID: <20261106104309.3669583-1-zaslonko@linux.ibm.com> (raw)

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@linux.ibm.com>
---
Found while adding crashkernel CMA support for s390.

 kernel/crash_reserve.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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


             reply	other threads:[~2026-11-06 10:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 10:43 Mikhail Zaslonko [this message]
2026-11-06 12:38 ` David Hildenbrand (Arm)
2026-11-06 13:50 ` Usama Arif
2026-11-06 14:13 ` Jiri Bohac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261106104309.3669583-1-zaslonko@linux.ibm.com \
    --to=zaslonko@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=baoquan.he@linux.dev \
    --cc=david@kernel.org \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=jbohac@suse.cz \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=ruirui.yang@linux.dev \
    --cc=usama.arif@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®