Re: [PATCH v2 3/3] x86/boot: Implement early memory acceptance for SEV-SNP

From: Ard Biesheuvel
Date: Fri Apr 04 2025 - 04:50:38 EST


On Fri, 4 Apr 2025 at 11:43, Kirill A. Shutemov
<kirill.shutemov@xxxxxxxxxxxxxxx> wrote:
>
> On Fri, Apr 04, 2025 at 10:29:25AM +0200, Ard Biesheuvel wrote:
> > From: Ard Biesheuvel <ardb@xxxxxxxxxx>
> >
> > Switch to a different API for accepting memory in SEV-SNP guests, one
> > which is actually supported at the point during boot where the EFI stub
> > may need to accept memory, but the SEV-SNP init code has not executed
> > yet.
>
> I probably miss the point, but why cannot decompressor use the same _early
> version of accept too and avoid code duplication?
>
> Maybe spell it out in the commit message for someone like me :P
>

I assumed there was a reason that the shared GHCB page is used early
on. Maybe it is faster than accepting memory page by page?

It also depends on how important the memory acceptance is for the
legacy decompressor - AIUI the use case is primarily kexec, but
wouldn't the first kernel have accepted all memory already? I.e., if
it is slower, we might not care if it is a rare case.