linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Kiryl Shutsemau <kas@kernel.org>
Cc: "Pratik R. Sampat" <prsampat@amd.com>,
	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,
	ardb@kernel.org, akpm@linux-foundation.org, osalvador@suse.de,
	thomas.lendacky@amd.com, michael.roth@amd.com
Subject: Re: [PATCH v4 1/2] mm/memory_hotplug: Add support to accept memory during hot-add
Date: Thu, 5 Feb 2026 18:29:08 +0100	[thread overview]
Message-ID: <fc60cc71-80eb-4058-8d0a-dbd19a5c10ef@kernel.org> (raw)
In-Reply-To: <aYS8O0phOE41IuEF@thinkstation>

On 2/5/26 17:08, Kiryl Shutsemau wrote:
> On Thu, Feb 05, 2026 at 04:48:13PM +0100, David Hildenbrand (Arm) wrote:
>> On 2/5/26 11:48, Kiryl Shutsemau wrote:
>>>
>>> You are calling arch_accept_memory() on every memory allocation if the
>>> memory is not represented in the bitmap. Hard NAK.
>>
>> In which scenarios would we not have memory represented in the bitmap?
>> Guests with <4 GiB? (how does kexec work?) Anything else?
> 
> We create the bitmap that covers all unaccepted memory.

Good! :)

> 
> What memory is unaccepted is up to BIOS. Current implementation of edk2
> accepts the memory in the first 4G range of physical address space. It
> means we won't have bitmap for this range (unaccepted->phys_base >= 4G).

Ah, okay, this comes from the BIOS.

> 
> If the whole VM is smaller than 4G we won't have the bitmap at all.
> 
> We can allocate bitmap for all possible memory. Maybe upto max_possible_pfn?
> But we might not know the value in EFI stub. It costs 4k per 64GiB of
> physical address space.

That's what I would do. 4k per 64GiB sounds reasonable.

> 
> Ideally, we want to know on boot:
> 
>   - what memory ranges are unaccepted - we have it;
>   - what memory range can be removed or added after boot - we don't have it

The SRAT describes memory ranges where we can see hotplug memory. Is 
that too late? We calculate max_possible_pfn based on that.

(don't ask me about special CXL windows and how they are advertised :) )

-- 
Cheers,

David


  reply	other threads:[~2026-02-05 17:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03 17:49 [PATCH v4 0/2] SEV-SNP Unaccepted Memory Hotplug Pratik R. Sampat
2026-02-03 17:49 ` [PATCH v4 1/2] mm/memory_hotplug: Add support to accept memory during hot-add Pratik R. Sampat
2026-02-04 11:22   ` Kiryl Shutsemau
2026-02-04 19:59     ` David Hildenbrand (arm)
2026-02-05  3:50       ` Pratik R. Sampat
2026-02-05 10:51         ` Kiryl Shutsemau
2026-02-04 20:00   ` David Hildenbrand (arm)
2026-02-05  3:50     ` Pratik R. Sampat
2026-02-05 10:48       ` Kiryl Shutsemau
2026-02-05 15:48         ` David Hildenbrand (Arm)
2026-02-05 16:08           ` Kiryl Shutsemau
2026-02-05 17:29             ` David Hildenbrand (Arm) [this message]
2026-02-06 12:03               ` Kiryl Shutsemau
2026-02-16 14:45                 ` Pratik R. Sampat
2026-02-03 17:49 ` [PATCH v4 2/2] x86/sev: 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=fc60cc71-80eb-4058-8d0a-dbd19a5c10ef@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --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