[PATCH makedumpfile] Add confidential VM unaccepted free pages support on Linux 6.16 and later
Zhiquan Li
zhiquan1.li at intel.com
Sun Jun 22 19:34:45 PDT 2025
On 2025/6/9 13:02, Zhiquan Li wrote:
> UEFI Specification version 2.9 introduces the concept of memory
> acceptance: some Virtual Machine platforms, such as Intel TDX or AMD
> SEV-SNP, requiring memory to be accepted before it can be used by the
> guest. Accepting happens via a protocol specific for the Virtual
> Machine platform[1].
>
> Before unaccepted memory is accepted by guest, any access from guest
> will result in the guest failed, as well as the kexec'ed kernel. So,
> the kexec'ed kernel will skip these pages and fill in zero data for the
> reader of vmcore.
>
> However, it introduces a problem. When exclude a page filled with zero,
> a pd_zero, which sizeof(page_desc_t) is 24 bytes, will be written into
> cd_header and this part is not compressed by design. As the unaccepted
> pages are exported as zero pages, which means ~1/170 of the capacity of
> unaccepted memory will be added into vmcore additionally. In fact, they
> should be considered as free pages and most of the time should be
> excluded.
>
> Unaccepted memory is unusable free memory, so they are not managed by
> buddy, instead, they are added to a new list zone.unaccepted_pages only
> when the order is MAX_PAGE_ORDER each time conventionally. The new
> page type, PGTY_unaccepted can be used to identify whether a page is
> unaccepted[2]. Therefore, add following changes to exclude them like
> free pages:
>
> 1. Add NUMBER(PAGE_UNACCEPTED_MAPCOUNT_VALUE) to identify a page is
> unaccepted, a kernel patch[3] to export the value of page type
> PAGE_UNACCEPTED_MAPCOUNT_VALUE since kernel 6.16.
>
> 2. Add a condition to exclude these unaccepted free pages.
>
> Dumping host kernel will not be impacted by the modification, because it
> cannot enable CONFIG_UNACCEPTED_MEMORY, so the page type
> PAGE_UNACCEPTED_MAPCOUNT_VALUE cannot be found in vmcoreinfo and skip
> the step.
>
> Here is a vmcore size statistic of a freshly booted TD VM with different
> memory sizes:
>
> VM.mem | Before After
> -------+----------------
> 512G | ~4.9G ~2.0G
> 256G | ~2.0G ~1.1G
Kindly ping.
More information about the kexec
mailing list