diff options
author | Alexander Graf <agraf@suse.de> | 2010-01-07 20:58:03 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:35:48 -0500 |
commit | 7e57cba06074da84d7c24d8c3f44040d2d8c88ac (patch) | |
tree | e99519ca301b887de4d689421e7a954f1c7792e4 /arch/powerpc/kvm/book3s.c | |
parent | 992b5b29b5ae254c416c62faf98d59a6cf970027 (diff) |
KVM: PPC: Use PACA backed shadow vcpu
We're being horribly racy right now. All the entry and exit code hijacks
random fields from the PACA that could easily be used by different code in
case we get interrupted, for example by a #MC or even page fault.
After discussing this with Ben, we figured it's best to reserve some more
space in the PACA and just shove off some vcpu state to there.
That way we can drastically improve the readability of the code, make it
less racy and less complex.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r-- | arch/powerpc/kvm/book3s.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index 09ba8dbaabab..3e06eae3f2c8 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c | |||
@@ -66,12 +66,16 @@ void kvmppc_core_load_guest_debugstate(struct kvm_vcpu *vcpu) | |||
66 | void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | 66 | void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
67 | { | 67 | { |
68 | memcpy(get_paca()->kvm_slb, to_book3s(vcpu)->slb_shadow, sizeof(get_paca()->kvm_slb)); | 68 | memcpy(get_paca()->kvm_slb, to_book3s(vcpu)->slb_shadow, sizeof(get_paca()->kvm_slb)); |
69 | memcpy(&get_paca()->shadow_vcpu, &to_book3s(vcpu)->shadow_vcpu, | ||
70 | sizeof(get_paca()->shadow_vcpu)); | ||
69 | get_paca()->kvm_slb_max = to_book3s(vcpu)->slb_shadow_max; | 71 | get_paca()->kvm_slb_max = to_book3s(vcpu)->slb_shadow_max; |
70 | } | 72 | } |
71 | 73 | ||
72 | void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) | 74 | void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) |
73 | { | 75 | { |
74 | memcpy(to_book3s(vcpu)->slb_shadow, get_paca()->kvm_slb, sizeof(get_paca()->kvm_slb)); | 76 | memcpy(to_book3s(vcpu)->slb_shadow, get_paca()->kvm_slb, sizeof(get_paca()->kvm_slb)); |
77 | memcpy(&to_book3s(vcpu)->shadow_vcpu, &get_paca()->shadow_vcpu, | ||
78 | sizeof(get_paca()->shadow_vcpu)); | ||
75 | to_book3s(vcpu)->slb_shadow_max = get_paca()->kvm_slb_max; | 79 | to_book3s(vcpu)->slb_shadow_max = get_paca()->kvm_slb_max; |
76 | } | 80 | } |
77 | 81 | ||