Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
To: Sasha Levin <sashal@kernel.org>
Cc: stable@vger.kernel.org,
	"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Pankaj Gupta <pankaj.gupta@amd.com>,
	 David Hildenbrand <david@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	 Lorenzo Stoakes <ljs@kernel.org>, Michal Hocko <mhocko@suse.com>,
	 Suren Baghdasaryan <surenb@google.com>,
	Vlastimil Babka <vbabka@kernel.org>
Subject: Re: [PATCH 6.6.y] mm/cma: accept memory of CMA areas reserved at a fixed address
Date: Mon, 16 Nov 2026 16:48:52 +0000	[thread overview]
Message-ID: <avszpOC2q4p8dVVK@shutemov.name> (raw)
In-Reply-To: <20261114161849.4002504-1-sashal@kernel.org>

On Sat, Nov 14, 2026 at 11:22:26AM -0500, Sasha Levin wrote:
> diff --git a/mm/cma.c b/mm/cma.c
> index ac363f16d3923..27e27e5d70cd3 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -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)" <rppt@kernel.org>
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.

Link: https://lore.kernel.org/20261029-cma-multi-v1-2-2cbced8b5cb7@kernel.org
Fixes: 75d090fd167a ("x86/tdx: Add unaccepted memory support")
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
Tested-by: Pankaj Gupta <pankaj.gupta@amd.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: <stable@vger.kernel.org>

(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 ]
Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
---
 mm/cma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/cma.c b/mm/cma.c
index ac363f16d392..906bad0393dd 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -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;
 

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

  reply	other threads:[~2026-11-16 16:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  1:12 FAILED: patch "[PATCH] mm/cma: accept memory of CMA areas reserved at a fixed address" failed to apply to 6.6-stable tree Sasha Levin
2026-11-14 16:22 ` [PATCH 6.6.y] mm/cma: accept memory of CMA areas reserved at a fixed address Sasha Levin
2026-11-16 16:48   ` Kiryl Shutsemau (Meta) [this message]
2026-11-18 12:40     ` Sasha Levin

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=avszpOC2q4p8dVVK@shutemov.name \
    --to=kas@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=liam@infradead.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=pankaj.gupta@amd.com \
    --cc=rppt@kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /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