Re: [PATCH v2 1/2] KVM: arm64: nv: Discard undersized TTL hints in compute_tlb_inval_range()
From: Marc Zyngier
Date: Tue Nov 24 2026 - 08:10:12 EST
On Mon, 23 Nov 2026 23:26:46 +0000,
Colton Lewis <coltonlewis@xxxxxxxxxx> wrote:
>
> When an L1 guest issues TLBI IPAS2E1 with a non-zero TTL hint,
> compute_tlb_inval_range() takes it at face value. If the hinted size is
> smaller than the actual mapping (for example, a 4kB L3 hint on a 2MB
> block), kvm_pgtable_stage2_unmap() clears the entire block while
> kvm_remove_guest_s2_mappings() leaves its stale tracking entry behind in
> guest_s2_mappings. On 16kB or 64kB hosts, a 4kB hint also triggers
> WARN_ON(size & ~PAGE_MASK) in kvm_stage2_unmap_range().
>
> A TTL hint smaller than PAGE_SIZE or the mapped entry is wrong. Check
> it against PAGE_SIZE, the shadow stage-2 leaf size, and the guest block
> size encoded in KVM_NV_GUEST_MAP_SZ. If it is too small, ignore the hint
> and fall through to the unhinted invalidation path.
>
> When falling back to the maximum mapping extent with stage-2 disabled,
> size it from PAGE_SIZE rather than VTCR_EL2.TG0 so 1:1 shadow blocks are
> still covered.
>
> Fixes: d1de1576dc21 ("KVM: arm64: nv: Handle FEAT_TTL hinted TLB operations")
> Signed-off-by: Colton Lewis <coltonlewis@xxxxxxxxxx>
What's the advantage doing all this dance over the patch proposed at
[1]?
M.
[1] https://lore.kernel.org/all/20261123182312.4842-1-maz@xxxxxxxxxx/
--
Without deviation from the norm, progress is not possible.