]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: MIPS: Drop other CPU ASIDs on guest MMU changes
authorJames Hogan <james.hogan@imgtec.com>
Wed, 9 Nov 2016 14:46:24 +0000 (14:46 +0000)
committerJiri Slaby <jslaby@suse.cz>
Wed, 9 Nov 2016 21:29:49 +0000 (22:29 +0100)
commite01f1c70914befc091e692e27d82d099e92844c4
treebf0152204a1a4895aaf6c2ee9c1d8f6ec9da55a3
parentf668f2eee98250a2073a4beafdb7f6d1e21c528e
KVM: MIPS: Drop other CPU ASIDs on guest MMU changes

commit 91e4f1b6073dd680d86cdb7e42d7cccca9db39d8 upstream.

When a guest TLB entry is replaced by TLBWI or TLBWR, we only invalidate
TLB entries on the local CPU. This doesn't work correctly on an SMP host
when the guest is migrated to a different physical CPU, as it could pick
up stale TLB mappings from the last time the vCPU ran on that physical
CPU.

Therefore invalidate both user and kernel host ASIDs on other CPUs,
which will cause new ASIDs to be generated when it next runs on those
CPUs.

We're careful only to do this if the TLB entry was already valid, and
only for the kernel ASID where the virtual address it mapped is outside
of the guest user address range.

Signed-off-by: James 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
[james.hogan@imgtec.com: Backport to 3.10..3.16]
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/mips/kvm/kvm_mips_emul.c