Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Usama Arif <usama.arif@linux.dev>,
	Sang-Heon Jeon <ekffu200098@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "Liam R. Howlett" <liam@infradead.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Michal Hocko <mhocko@suse.com>, Mike Rapoport <rppt@kernel.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Qi Zheng <zhengqi.arch@bytedance.com>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	Frank van der Linden <fvdl@google.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	Baoquan He <baoquan.he@linux.dev>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Pratyush Yadav <pratyush@kernel.org>, Jiri Bohac <jbohac@suse.cz>,
	kexec@lists.infradead.org
Subject: Re: [PATCH] mm/cma: reject long-term pins of HugeTLB folios overlapping crashkernel CMA
Date: Thu, 26 Nov 2026 14:07:16 +0100	[thread overview]
Message-ID: <931acd3e-0689-4517-bbd2-d06109ac4a6e@kernel.org> (raw)
In-Reply-To: <1b0242ef-49ad-4d7d-820e-d1e6569eacf8@linux.dev>

On 11/25/26 22:49, Usama Arif wrote:
> 
> 
> On 25/11/2026 07:51, Sang-Heon Jeon wrote:
>> crashkernel=size,cma uses existing hugetlb_cma memory, so
>> crashk_cma_ranges[] may contain HugeTLB folios. HugeTLB folios allocated
>> from hugetlb_cma can be long-term pinned without being migrated.
>>
>> After a crash, the crash kernel uses the memory in crashk_cma_ranges[],
>> but a device can still write to a long-term pinned folio.
>>
>> So reject long-term pins of HugeTLB folios overlapping
>> crashk_cma_ranges[].
>>
> 
> Is spending the workload to protect the dump the right way round for this
> option?  kdump.rst describes it as
> 
> 	This reservation method is intended for systems that can't afford to
> 	sacrifice enough memory for standard crashkernel reservation and where
> 	less reliable and possibly incomplete kdump is preferable to no kdump at
> 	all.
> 
> so the dump is the part the admin has already agreed to give up.

We have in there:

"This option increases the risk of a kdump failure: DMA transfers configured by
the first kernel may end up corrupting the second kernel's memory."

... but I recall some discussions about short-term vs. long-term vs. cma
discussions.

Ah: https://lore.kernel.org/all/ZWJllXCN0SDIELrX@dwarf.suse.cz/

"User pages for RDMA, should be pinned with FOLL_LONGTERM and that
would migrate them away from the CMA area.

But you're right that DMA to user pages pinned without
FOLL_LONGTERM would still be possible. Would this be a problem in
practice? Do you see any way around it?
"

And later (me):

https://lore.kernel.org/all/04904e86-5b5f-4aa1-a120-428dac119189@redhat.com/

"What does "short" mean? At least in theory, long-term pinning is
forbidden for MIGRATE_CMA, so we should not have such pages mapped into
an iommu where DMA can happily keep going on for quite a while.

But that assumes that our old kernel is not buggy, and doesn't end up
mapping these pages into an IOMMU where DMA will just continue. I recall
that DRM might currently be a problem, described here [1]."


And in the end, we settled for the 10s wait, crossing our fingers that it will
be alright :)

-- 
Cheers,

David


  reply	other threads:[~2026-11-26 13:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 15:51 [PATCH] mm/cma: reject long-term pins of HugeTLB folios overlapping crashkernel CMA Sang-Heon Jeon
2026-11-25 21:49 ` Usama Arif
2026-11-26 13:07   ` David Hildenbrand (Arm) [this message]
2026-11-26 15:16     ` Sang-Heon Jeon
2026-11-25 22:43 ` David Hildenbrand (Arm)
2026-11-26  8:21   ` Michal Hocko

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=931acd3e-0689-4517-bbd2-d06109ac4a6e@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baoquan.he@linux.dev \
    --cc=ekffu200098@gmail.com \
    --cc=fvdl@google.com \
    --cc=jbohac@suse.cz \
    --cc=kas@kernel.org \
    --cc=kexec@lists.infradead.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=zhengqi.arch@bytedance.com \
    /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