Re: [PATCH v3 02/27] KVM: SVM: Document number of ASIDs CPUID setting
From: Jim Mattson
Date: Wed Oct 14 2026 - 11:59:10 EST
On Mon, Oct 12, 2026 at 4:36 PM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
>
> KVM arbitrarily advertises 8 ASIDs in KVM_GET_SUPPORTED_CPUID for
> historical reasons. Advertising a small number of ASIDs to L1 is
> currently harmless, as KVM (L0) uses the same ASID for both L1 and L2,
> and flushes that ASID on nested transitions.
>
> However, following changes will add proper ASID emulation and a separate
> ASID for L2, minimizing the TLB flushes on nested transitions. At that
> point, a full TLB flush from a KVM guest (L1) would flush both L1 and L2
> ASIDs, so should be avoided as much as possible by advertising more
> ASIDs to L1.
>
> Increasing the value advertised by KVM is tricky, because a VMM copying
> the number of ASIDs from KVM_GET_SUPPORTED_CPUID may perceive a new VM
> with a higher number of ASIDs as incompatible with older KVM (which is
> not true).
>
> Avoid changing the value advertised by KVM, but document that it is
> essentially meaningless and does not represent a limit or a hint. Also,
> more-or-less encourage userspace to advertise a higher value to avoid
> potential unnecessary TLB flushes from an L1 hypervisor.
>
> Suggested-by: Jim Mattson <jmattson@xxxxxxxxxx>
> Signed-off-by: Yosry Ahmed <yosry@xxxxxxxxxx>
Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>