This patchset primarily fixes MIPS KVM guest TLB invalidation on SMP hosts (patch 1, for 4.8 and stable), and optimises this code a little (patches 2-4, for 4.9). The main fix effectively invalidates the guest's TLB on all other CPUs by clearing their host ASIDs for this vCPU's guest kernel (and guest user) mode. This happens whenever a change to the guest mappings takes place, and is in addition to the TLB invalidation on the local CPU. This ensures that upon their next execution of this vCPU that stale mappings aren't used. The rest of the patches convert the local invalidation to use clearing of ASIDs too, makes that lazy for guest user mode mappings when the guest ASID changes, and drops a dubious optimisation around guest ASID changes. The use of ASID clearing is faster and doesn't flush TLB entries from other address spaces, but does result in entries for guest KSeg0 (which don't actually change) being invalidated too. Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx> Cc: "Radim Krčmář" <rkrcmar@xxxxxxxxxx> Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx> Cc: linux-mips@xxxxxxxxxxxxxx Cc: kvm@xxxxxxxxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx James Hogan (4): KVM: MIPS: Drop other CPU ASIDs on guest MMU changes KVM: MIPS: Split kernel/user ASID regeneration KVM: MIPS: Invalidate TLB by regenerating ASIDs KVM: MIPS: Drop dubious EntryHi optimisation arch/mips/include/asm/kvm_host.h | 3 +- arch/mips/kvm/emulate.c | 78 +++++++++++++++++++++++++++------ arch/mips/kvm/mips.c | 30 +++++++++++++- arch/mips/kvm/mmu.c | 16 ++++++- 4 files changed, 111 insertions(+), 16 deletions(-) -- git-series 0.8.10