Re: [PATCH v3 00/27] KVM: nSVM: Optimize nSVM TLB flushes

From: Jim Mattson

Date: Wed Oct 14 2026 - 09:45:47 EST


On Mon, Oct 12, 2026 at 4:36 PM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
>
> This series optimizes TLB flushes for nested SVM by using and maintaining
> a separate ASID for L2 for each vCPU (similar to VMX's handling of VPIDs),
> rather than sharing the same ASID and flushing everything on every nested
> transition.
>
> The series also drops the dynamic ASID allocation scheme and uses a
> static ASID per vCPU (or two if using nested), bringing it closer to how
> VMX handles VPIDs. Modern CPUs (Rome, Milan, Genoa, Turin) advertise 32K
> ASIDs, so there is no need for dynamic allocation.

I'm not convinced that this is the right direction. It's almost always
better to do things locally when possible. Why not keep the per-CPU
generational allocation, but allocate two ASIDs per vCPU—one for each
VMCB? This would eliminate the need for a fallback ASID and remove any
possible concerns about contention for a global bitmap. Moreover, it
would be much simpler to implement.