From: Mike Rapoport <rppt@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Kiryl Shutsemau <kas@kernel.org>,
Ard Biesheuvel <ardb@kernel.org>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
x86@kernel.org, linux-efi@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Moritz Sanft <ms@edgeless.systems>
Subject: Re: [PATCH 1/2] efi: Fix reservation of unaccepted memory table
Date: Mon, 16 Feb 2026 18:19:46 +0200 [thread overview]
Message-ID: <aZNDogxae67mAXDg@kernel.org> (raw)
In-Reply-To: <6a43f009-335f-44de-a48f-f48ee1e912d0@intel.com>
On Mon, Feb 16, 2026 at 07:53:24AM -0800, Dave Hansen wrote:
> On 2/14/26 07:51, Mike Rapoport wrote:
> > Heh, it's x86's choice of memblock iterator that's rounding the ranges 😉
>
> Ahh, good point. I was just assuming that the memblock iteration _had_
> to be over PFNs. Silly me.
>
> > Maybe I miss some context, but my understanding is that for crash kernels
> > the unaccepted table is E820_TYPE_RESERVED and those are never added to
> > memblock.memory by e820 code, hence the call to memblock_add() in
> > reserve_unaccepted().
> >
> > When x86 creates page tables, init_range_memory_mapping() walks
> > memblock.memory with for_each_mem_pfn_range() that rounds ranges that are
> > not page-aligned, which is normally fine, because it would mean that we
> > miss some partial pages that are divided between E820_RAM and
> > E820_SOMETHING_ELSE.
> >
> > And Kiryl's intention to round up unaccepted to page boundary seems correct
> > to me.
>
> It fixes the bug for sure.
>
> I'm more worried about the next feature, or the existing features that
> also only working because memory is page-aligned somewhere (even though
> it isn't guaranteed to remain that way).
>
> There are two choices for fixing this: One, we do Kiryl's fix plus
> checks to ensure that all the memblocks that generate direct mappings
> (is it _just_ the "memory" type?) are padded out to page-aligned boundaries.
>
> The other alternative is to do for_each_mem_range() and do the padding
> universally when creating the mappings. Maybe _also_ with warnings or
> maybe a pr_debug().
>
> I do still think it's a little wonky for memblock_add()'s management of
> the "memory" type to allow unaligned arguments when that type is also
> used to create page-aligned mapping structures. Memblocks themselves
> obviously need to be byte-level, but I'm not sure it's the right thing
> for the "memory" type API.
Well, we could make memblock_add() implicitly cut down the edges when it's
adding to memblock.memory and make everything there page aligned, but I
truly have no idea what will break and I'm sure something will :)
Another thing that's more on x86 side, is that translation from e820 to
memblock only adds E820_TYPE_RAM to memblock. And since in e820 these are
mutually exclusive with other e820 types, this could create non-aligned
chunks when firmware reservations are not page aligned. It also creates
unnecessary holes in memblock.memory that slow down memblock interation a
bit and more interestingly, everything that's not in E820_TYPE_RAM is
treated as IO and requires ioremap/memremap for access, even it is in DRAM.
If these reserved regions were added to memblock.memory along with being
memblock_reserve()ed we wouldn't hit the bug with unaccepted I believe some
others as well.
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-02-16 16:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 15:48 [PATCH 0/2] efi: Fix alignenment issues in unaccepted memory code Kiryl Shutsemau (Meta)
2026-02-13 15:48 ` [PATCH 1/2] efi: Fix reservation of unaccepted memory table Kiryl Shutsemau (Meta)
2026-02-13 16:01 ` Dave Hansen
2026-02-13 16:14 ` Kiryl Shutsemau
2026-02-13 16:46 ` Dave Hansen
2026-02-13 17:20 ` Kiryl Shutsemau
2026-02-14 15:51 ` Mike Rapoport
2026-02-16 14:22 ` Kiryl Shutsemau
2026-02-16 14:51 ` Mike Rapoport
2026-02-16 15:53 ` Dave Hansen
2026-02-16 16:19 ` Mike Rapoport [this message]
2026-02-13 15:48 ` [PATCH 2/2] efi: Align unaccepted memory range to page boundary Kiryl Shutsemau (Meta)
2026-02-16 14:51 ` Tom Lendacky
2026-02-16 15:33 ` Kiryl Shutsemau
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=aZNDogxae67mAXDg@kernel.org \
--to=rppt@kernel.org \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=kas@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=ms@edgeless.systems \
--cc=tglx@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.