From: Andrew Morton <akpm@linux-foundation.org>
To: "Pratik R. Sampat" <prsampat@amd.com>
Cc: linux-mm@kvack.org, linux-coco@lists.linux.dev, x86@kernel.org,
linux-kernel@vger.kernel.org, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
kas@kernel.org, ardb@kernel.org, david@kernel.org,
osalvador@suse.de, thomas.lendacky@amd.com, michael.roth@amd.com
Subject: Re: [PATCH v2 1/2] mm/memory_hotplug: Add support to accept memory during hot-add
Date: Mon, 12 Jan 2026 14:43:14 -0800 [thread overview]
Message-ID: <20260112144314.69b850afad9ee67143f30a85@linux-foundation.org> (raw)
In-Reply-To: <2f9b180b-c221-4631-93d0-c131332ef178@amd.com>
On Mon, 12 Jan 2026 16:23:37 -0600 "Pratik R. Sampat" <prsampat@amd.com> wrote:
>
>
> On 1/12/26 3:04 PM, Andrew Morton wrote:
> > On Mon, 12 Jan 2026 14:22:59 -0600 "Pratik R. Sampat" <prsampat@amd.com> wrote:
> >
> >> Confidential computing guests require memory to be accepted before use.
> >> The unaccepted memory bitmap maintained by firmware does not track
> >> hotplugged memory ranges.
> >>
> >> Call arch_accept_memory() during the hot-add path to explicitly validate
> >> and transition the newly added memory to a private state, making it
> >> usable by the guest.
> >>
> >> Signed-off-by: Pratik R. Sampat <prsampat@amd.com>
> >> ---
> >> mm/memory_hotplug.c | 4 ++++
> >> 1 file changed, 4 insertions(+)
> >>
> >> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> >> index a63ec679d861..8cfbf0541430 100644
> >> --- a/mm/memory_hotplug.c
> >> +++ b/mm/memory_hotplug.c
> >> @@ -38,6 +38,7 @@
> >> #include <linux/node.h>
> >>
> >> #include <asm/tlbflush.h>
> >> +#include <asm/unaccepted_memory.h>
> >
> > This only exists for x86!
>
> Ah, I missed that entirely. Thanks for catching that.
>
> Probably not the best option to have a generic unaccepted_memory.h as well.
> Maybe, I should have arch_[un]accept_memory() definitions within mm.h wrapped
> within CONFIG_UNACCEPTED_MEMORY instead so that its cleaner.
Something like that.
The idiomatic Linus way is to use
#ifndef arch_accept_memory
#define arch_accept_memory ...
#endif
Lots of prior art here:
grep -r include/linux "ifndef arch_"
Oh, arch_get_idle_state_flags() got it all wrong.
#ifdef CONFIG_ACPI_PROCESSOR_IDLE
#ifndef arch_get_idle_state_flags
static inline unsigned int arch_get_idle_state_flags(u32 arch_flags)
{
return 0;
}
#endif
#endif /* CONFIG_ACPI_PROCESSOR_IDLE */
- shouldn't have needed "ifdef CONFIG_ACPI_PROCESSOR_IDLE"
- should have appended
#define arch_get_idle_state_flags arch_get_idle_state_flags
in case cpp hit the same lines a second time.
next prev parent reply other threads:[~2026-01-12 22:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 20:22 [PATCH v2 0/2] SEV-SNP Unaccepted Memory Hotplug Pratik R. Sampat
2026-01-12 20:22 ` [PATCH v2 1/2] mm/memory_hotplug: Add support to accept memory during hot-add Pratik R. Sampat
2026-01-12 21:04 ` Andrew Morton
2026-01-12 22:23 ` Pratik R. Sampat
2026-01-12 22:43 ` Andrew Morton [this message]
2026-01-12 20:23 ` [PATCH v2 2/2] mm/memory_hotplug: Add support to unaccept memory after hot-remove Pratik R. Sampat
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=20260112144314.69b850afad9ee67143f30a85@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=kas@kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=osalvador@suse.de \
--cc=prsampat@amd.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@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