• James Hogan's avatar
    KVM: MIPS/Emulate: Drop redundant TLB flushes on exceptions · 7071a885
    James Hogan authored
    When exceptions are injected into the MIPS KVM guest, the whole host TLB
    is flushed (except any entries in the guest KSeg0 range). This is
    certainly not mandated by the architecture when exceptions are taken
    (userland can't directly change TLB mappings anyway), and is a pretty
    heavyweight operation:
    
     - There may be hundreds of TLB entries especially when a 512 entry FTLB
       is present. These are walked and read and conditionally invalidated,
       so the TLBINV feature can't be used either.
    
     - It'll indiscriminately wipe out entries belonging to other memory
       spaces. A simple ASID regeneration would be much faster to perform,
       although it'd wipe out the guest KSeg0 mappings too.
    
    My suspicion is that this was simply to plaster over the fact that
    kvm_mips_host_tlb_inv() incorrectly only invalidated TLB entries in the
    ASID for guest usermode, and not the ASID for guest kernelmode.
    
    Now that the recent commit "KVM: MIPS/TLB: Flush host TLB entry in
    kernel ASID" fixes kvm_mips_host_tlb_inv() to flush TLB entries in the
    kernelmode ASID when the guest TLB changes, lets drop these calls and
    the otherwise unused kvm_mips_flush_host_tlb().
    Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: "Radim Krčmář" <rkrcmar@redhat.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    7071a885
tlb.c 6.09 KB