Re: [PATCH v3 16/27] KVM: nSVM: Flush both L1 and L2 ASIDs on KVM_REQ_TLB_FLUSH

From: Jim Mattson

Date: Thu Oct 15 2026 - 18:05:36 EST


On Mon, Oct 12, 2026 at 4:36 PM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
>
> Flush both L1 and L2 ASIDs in svm_flush_tlb_all() to appropriately
> handle KVM_REQ_TLB_FLUSH by flushing all TLB entries in all contexts
> (e.g. for kvm_flush_remote_tlbs()). Since both L1 and L2 currently share
> an ASID, this is effectively a noop, but it won't be once L2 has a
> separate ASID.
>
> Purge all Hyper-V TLB FIFOs (for both L1 and L2), since both ASIDs are
> flushed, and an ASID flush is a superset of Hyper-V's fine-grained
> flushing (see comment in svm_flush_tlb_asid()).
>
> Note that if one TLB flush FIFO is purged (e.g. as a result of
> KVM_REQ_TLB_FLUSH_CURRENT), it will consume KVM_REQ_HV_TLB_FLUSH, and a
> subsequent KVM_REQ_TLB_FLUSH will not flush the other FIFO. This is
> alright as flushing both FIFOs is a (newly introduced) optimization
> anyway. The other FIFO will be checked after a nested transition, as
> KVM_REQ_HV_TLB_FLUSH is always set on nested transitions.
>
> Signed-off-by: Yosry Ahmed <yosry@xxxxxxxxxx>
Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>