Re: [PATCH] KVM: x86/mmu: Prevent hugepage recovery on non-guest_memfd private GFNs

From: Jiaming Fan

Date: Sat Nov 21 2026 - 23:52:30 EST


On Fri, Nov 20, 2026, Ackerley Tng wrote:
> + /*
> + * is_private (set in VM attributes) should never have been used
> + * with a non-guest_memfd memslot. Return PG_LEVEL_4K to prevent
> + * hugepage recovery.
> + */

Hi Ackerley,

This comment feels a bit odd to me. KVM does allow marking a GFN private
when its memslot has no guest_memfd, since PRIVATE attributes are per VM,
not per memslot.

I could reproduce the WARN with a KVM_X86_SW_PROTECTED_VM on AMD (nested,
not TDX), and it's gone with this patch.

Tested-by: Jiaming Fan <fan.jiaming@xxxxxxxxxxx>