Re: [PATCH] x86/efi: defer freeing of boot services memory

From: Ard Biesheuvel

Date: Tue Feb 24 2026 - 04:35:15 EST




On Tue, 24 Feb 2026, at 10:28, Mike Rapoport wrote:
> On Mon, Feb 23, 2026 at 01:18:41PM +0100, Ard Biesheuvel wrote:
>> On Mon, 23 Feb 2026, at 12:40, Mike Rapoport wrote:
>> > On Mon, Feb 23, 2026 at 12:17:22PM +0100, Ard Biesheuvel wrote:
>> >>
>> >> > I wasn't sure it's Ok to only unmap them, but leave in efi.memmap, that's
>> >> > why I didn't use the existing EFI memory map.
>> >> >
>> >> > Now thinking about it, if the unmapping can happen later, maybe we'll just
>> >> > move the entire efi_free_boot_services() to an initcall?
>> >>
>> >> As long as it is pre-SMP, as that code also contains a quirk to allocate
>> >> the real mode trampoline if all memory below 1 MB is used for boot
>> >> services.
>> >
>> > initcall is long after SMP. It the real mode trampoline allocation is the
>> > only thing that should happen pre-SMP?
>>
>> early_initcall() should be early enough, those run before SMP init.
>
> I don't think so. All initcalls run quite late in boot, early ones just run
> before the others.
>

It is documented as running before SMP. If that is no longer true, we should fix the documentation.