• Oliver Upton's avatar
    KVM: arm64: Always invalidate TLB for stage-2 permission faults · be097997
    Oliver Upton authored
    It is possible for multiple vCPUs to fault on the same IPA and attempt
    to resolve the fault. One of the page table walks will actually update
    the PTE and the rest will return -EAGAIN per our race detection scheme.
    KVM elides the TLB invalidation on the racing threads as the return
    value is nonzero.
    
    Before commit a12ab137 ("KVM: arm64: Use local TLBI on permission
    relaxation") KVM always used broadcast TLB invalidations when handling
    permission faults, which had the convenient property of making the
    stage-2 updates visible to all CPUs in the system. However now we do a
    local invalidation, and TLBI elision leads to the vCPU thread faulting
    again on the stale entry. Remember that the architecture permits the TLB
    to cache translations that precipitate a permission fault.
    
    Invalidate the TLB entry responsible for the permission fault if the
    stage-2 descriptor has been relaxed, regardless of which thread actually
    did the job.
    Acked-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20230922223229.1608155-1-oliver.upton@linux.devSigned-off-by: default avatarOliver Upton <oliver.upton@linux.dev>
    be097997
pgtable.c 39.9 KB