Re: [PATCH v2 6/6] efi: respect the poisoned pages coming from previous kernel

From: Breno Leitao

Date: Mon Aug 24 2026 - 09:04:01 EST


On Mon, Aug 24, 2026 at 11:32:35AM +0100, Kiryl Shutsemau wrote:
> I wounder if the fix would be to make page allocator consume the table
> and not do memblock_reserve() here? So we would allocate struct pages
> for the memory and poison them on init. And your fix by the link below
> would do the rest.

Makes sense. Probably dropping memblock_reserve() altogether, for the
units and the table, and poisoning the recorded frames at
mm_core_init(), right after memblock_free_all().

Roughly what I have in mind:

memblock_free_all();
hwpoison_init_boot();
mem_init();

and hwpoison_init_boot() drives it from the table, walking the bitmap on
the EFI side where the geometry lives:

for_each_set_bit(bit, map, nbits) {
u64 unit = off * BITS_PER_BYTE + bit;
unsigned long pfn, i;

pfn = PHYS_PFN(phys_base + unit * unit_size);
for (i = 0; i < unit_size >> PAGE_SHIFT; i++)
hwpoison_boot_pfn(pfn + i);
}

mm/memory-failure.c gets the per page primitive:

bool __init hwpoison_boot_pfn(unsigned long pfn)
{
struct page *page = pfn_to_online_page(pfn);

if (!page || PageHWPoison(page))
return false;

if (!is_free_buddy_page(page) || !take_page_off_buddy(page))
return false;

SetPageHWPoison(page);
page_ref_inc(page);
atomic_long_inc(&num_poisoned_pages);

return true;
}

Yea, this seems better in fact. Let me know if that matches what you
had in mind.

Thanks!
--breno