Skip to contentSkip to conversation

FAILED: patch "[PATCH] mm/cma: accept memory of CMA areas reserved at a fixed address" failed to apply to 6.6-stable tree

PATCH NAK Sasha Levin 2 participants 4 messages Nov 10 – Nov 18

Subsystems (3)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x f8f9cbc34a309a388c052706f3329d1b52985aa3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From f8f9cbc34a309a388c052706f3329d1b52985aa3 Mon Sep 17 00:00:00 2001
From: "Mike Rapoport (Microsoft)" <[email protected]>
Date: Thu, 29 Oct 2026 12:18:38 +0200
Subject: [PATCH] mm/cma: accept memory of CMA areas reserved at a fixed
address

CMA areas allocated from memblock have their memory accepted by memblock_alloc_range_nid(), but areas reserved at a fixed address with memblock_reserve() are not.

If a fixed CMA area is requested by the cma=<size>@<base> command line parameter, it may be in regular RAM and on TDX and SEV-SNP guests it must be accepted.

Accept the memory of fixed CMA areas as well, so that all CMA areas are accepted regardless of how they were reserved.

Fixes 75d090fd167a ("x86/tdx: Add unaccepted memory support")
Cc David Hildenbrand <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>
---
 mm/cma.c | 2 ++
 1 file changed, 2 insertions(+)
mm/cma.c +2 -0
index 0035efb1130a5..f61d52796f4ef 100644
@@ -381,6 +381,8 @@ static int __init cma_fixed_reserve(phys_addr_t base, phys_addr_t size)
 		return -EBUSY;
 	}
 
+	accept_memory(base, size);
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH 1/1 mm/cma: accept memory of CMA areas reserved at a fixed address

From: "Mike Rapoport (Microsoft)" <[email protected]>

[ Upstream commit f8f9cbc34a309a388c052706f3329d1b52985aa3 ]

CMA areas allocated from memblock have their memory accepted by memblock_alloc_range_nid(), but areas reserved at a fixed address with memblock_reserve() are not.

If a fixed CMA area is requested by the cma=<size>@<base> command line parameter, it may be in regular RAM and on TDX and SEV-SNP guests it must be accepted.

Accept the memory of fixed CMA areas as well, so that all CMA areas are accepted regardless of how they were reserved.

Fixes 75d090fd167a ("x86/tdx: Add unaccepted memory support")
Cc David Hildenbrand <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>
[ sashal: moved accept_memory() from cma_fixed_reserve() to the fixed-address branch of cma_declare_contiguous_nid() ]
---
 mm/cma.c | 2 ++
 1 file changed, 2 insertions(+)
mm/cma.c +2 -0
index ac363f16d3923..27e27e5d70cd3 100644
@@ -318,6 +318,8 @@ int __init cma_declare_contiguous_nid(phys_addr_t base,
 			ret = -EBUSY;
 			goto err;
 		}
+
+		accept_memory(base, size);
 	} else {
 		phys_addr_t addr = 0;
 
Signature · 1 line
2.53.0
Reviewed-by Reviewed-by Pankaj Gupta Tested-by Pankaj Gupta on v1 1/1 NAK
#2 lore raw

Re: [PATCH 6.6.y] mm/cma: accept memory of CMA areas reserved at a fixed address

mm/cma.c int __init cma_declare_contiguous_nid(phys_addr_t base, · line 325

Quoted 13 lines · Sasha Levin
mm/cma.c +2 -0
index ac363f16d3923..27e27e5d70cd3 100644
@@ -318,6 +318,8 @@ int __init cma_declare_contiguous_nid(phys_addr_t base,
 			ret = -EBUSY;
 			goto err;
 		}
+
+		accept_memory(base, size);
 	} else {
 		phys_addr_t addr = 0;
 

NAK.

accept_memory() takes (start, end) in 6.6. It was converted to (start, size) in 6.12. See 5adfeaecc487 ("mm: rework accept memory helpers"). Here size is taken as the end address. For the usual cma=<size>@<base>, base is above size and nothing gets accepted, so the bug stays.

The 6.12.y backport is fine as is.

Correct backport for 6.6.y:

-- >8 --
From: "Mike Rapoport (Microsoft)" <[email protected]>
Subject: [PATCH 6.6.y] mm/cma: accept memory of CMA areas reserved at a fixed
address

CMA areas allocated from memblock have their memory accepted by memblock_alloc_range_nid(), but areas reserved at a fixed address with memblock_reserve() are not.

If a fixed CMA area is requested by the cma=<size>@<base> command line parameter, it may be in regular RAM and on TDX and SEV-SNP guests it must be accepted.

Accept the memory of fixed CMA areas as well, so that all CMA areas are accepted regardless of how they were reserved.

Fixes 75d090fd167a ("x86/tdx: Add unaccepted memory support")
Cc David Hildenbrand <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>

(cherry picked from commit f8f9cbc34a309a388c052706f3329d1b52985aa3) [ kas: 6.6 has no cma_fixed_reserve(); accept the area in the fixed-address
branch of cma_declare_contiguous_nid(). accept_memory() takes (start, end) in this tree, it was converted to (start, size) in 6.12 ]

---
 mm/cma.c | 2 ++
 1 file changed, 2 insertions(+)
mm/cma.c +2 -0
index ac363f16d392..906bad0393dd 100644
@@ -318,6 +318,8 @@ int __init cma_declare_contiguous_nid(phys_addr_t base,
 			ret = -EBUSY;
 			goto err;
 		}
+
+		accept_memory(base, base + size);
 	} else {
 		phys_addr_t addr = 0;
 
Signature · 1 line
  Kiryl Shutsemau / Kirill A. Shutemov
author maintainer
#3 lore raw

Re: [PATCH 6.6.y] mm/cma: accept memory of CMA areas reserved at a fixed address

Quoted 5 lines · Kiryl Shutsemau (Meta)

accept_memory() takes (start, end) in 6.6. It was converted to (start, size) in 6.12. See 5adfeaecc487 ("mm: rework accept memory helpers"). Here size is taken as the end address. For the usual cma=<size>@<base>, base is above size and nothing gets accepted, so the bug stays.

The copy in the 6.6 queue is not the one that was posted. It already calls accept_memory(base, base + size), see queue-6.6/mm-cma-accept-memory-of-cma-areas-reserved-at-a-fixe.patch and its "[
sashal: ... ]" note.

The 6.12 copy passes (base, size), matching the 6.12 signature, as you say.

Signature · 2 lines
Thanks,
Sasha