diff options
author | Hollis Blanchard <hollisb@us.ibm.com> | 2008-11-10 15:57:36 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-31 09:52:26 -0500 |
commit | fe4e771d5c37f0949047faf95d16a512b21406bf (patch) | |
tree | 518b4ff17a8e1e62b747ce1912c08b62883d2855 /arch/powerpc/kvm/44x_emulate.c | |
parent | df9b856c454e331bc394c80903fcdea19cae2a33 (diff) |
KVM: ppc: fix userspace mapping invalidation on context switch
We used to defer invalidating userspace TLB entries until jumping out of the
kernel. This was causing MMU weirdness most easily triggered by using a pipe in
the guest, e.g. "dmesg | tail". I believe the problem was that after the guest
kernel changed the PID (part of context switch), the old process's mappings
were still present, and so copy_to_user() on the "return to new process" path
ended up using stale mappings.
Testing with large pages (64K) exposed the problem, probably because with 4K
pages, pressure on the TLB faulted all process A's mappings out before the
guest kernel could insert any for process B.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/44x_emulate.c')
-rw-r--r-- | arch/powerpc/kvm/44x_emulate.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c index 9bc50cebf9ec..9ef79c78ede9 100644 --- a/arch/powerpc/kvm/44x_emulate.c +++ b/arch/powerpc/kvm/44x_emulate.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/dcr.h> | 21 | #include <asm/dcr.h> |
22 | #include <asm/dcr-regs.h> | 22 | #include <asm/dcr-regs.h> |
23 | #include <asm/disassemble.h> | 23 | #include <asm/disassemble.h> |
24 | #include <asm/kvm_44x.h> | ||
24 | 25 | ||
25 | #include "booke.h" | 26 | #include "booke.h" |
26 | #include "44x_tlb.h" | 27 | #include "44x_tlb.h" |
@@ -38,14 +39,6 @@ | |||
38 | #define XOP_ICCCI 966 | 39 | #define XOP_ICCCI 966 |
39 | #define XOP_TLBWE 978 | 40 | #define XOP_TLBWE 978 |
40 | 41 | ||
41 | static inline void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 new_pid) | ||
42 | { | ||
43 | if (vcpu->arch.pid != new_pid) { | ||
44 | vcpu->arch.pid = new_pid; | ||
45 | vcpu->arch.swap_pid = 1; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | static void kvmppc_emul_rfi(struct kvm_vcpu *vcpu) | 42 | static void kvmppc_emul_rfi(struct kvm_vcpu *vcpu) |
50 | { | 43 | { |
51 | vcpu->arch.pc = vcpu->arch.srr0; | 44 | vcpu->arch.pc = vcpu->arch.srr0; |