diff options
author | Scott Wood <scottwood@freescale.com> | 2013-06-06 20:16:31 -0400 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2013-06-11 04:10:59 -0400 |
commit | f1e89028f020ca982bf51be6eaba0d462ba0f7fa (patch) | |
tree | b6d06ea63e61d1f93037f1f9ff76fe19358dfd52 /arch/powerpc/kvm/booke.c | |
parent | 2b6398fcf2831f52a8ad9f01c123b3ce2ea31277 (diff) |
kvm/ppc/booke: Hold srcu lock when calling gfn functions
KVM core expects arch code to acquire the srcu lock when calling
gfn_to_memslot and similar functions.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r-- | arch/powerpc/kvm/booke.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 1020119226db..ecbe9081c9c2 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c | |||
@@ -832,6 +832,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
832 | { | 832 | { |
833 | int r = RESUME_HOST; | 833 | int r = RESUME_HOST; |
834 | int s; | 834 | int s; |
835 | int idx; | ||
835 | 836 | ||
836 | /* update before a new last_exit_type is rewritten */ | 837 | /* update before a new last_exit_type is rewritten */ |
837 | kvmppc_update_timing_stats(vcpu); | 838 | kvmppc_update_timing_stats(vcpu); |
@@ -1053,6 +1054,8 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
1053 | break; | 1054 | break; |
1054 | } | 1055 | } |
1055 | 1056 | ||
1057 | idx = srcu_read_lock(&vcpu->kvm->srcu); | ||
1058 | |||
1056 | gpaddr = kvmppc_mmu_xlate(vcpu, gtlb_index, eaddr); | 1059 | gpaddr = kvmppc_mmu_xlate(vcpu, gtlb_index, eaddr); |
1057 | gfn = gpaddr >> PAGE_SHIFT; | 1060 | gfn = gpaddr >> PAGE_SHIFT; |
1058 | 1061 | ||
@@ -1075,6 +1078,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
1075 | kvmppc_account_exit(vcpu, MMIO_EXITS); | 1078 | kvmppc_account_exit(vcpu, MMIO_EXITS); |
1076 | } | 1079 | } |
1077 | 1080 | ||
1081 | srcu_read_unlock(&vcpu->kvm->srcu, idx); | ||
1078 | break; | 1082 | break; |
1079 | } | 1083 | } |
1080 | 1084 | ||
@@ -1098,6 +1102,8 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
1098 | 1102 | ||
1099 | kvmppc_account_exit(vcpu, ITLB_VIRT_MISS_EXITS); | 1103 | kvmppc_account_exit(vcpu, ITLB_VIRT_MISS_EXITS); |
1100 | 1104 | ||
1105 | idx = srcu_read_lock(&vcpu->kvm->srcu); | ||
1106 | |||
1101 | gpaddr = kvmppc_mmu_xlate(vcpu, gtlb_index, eaddr); | 1107 | gpaddr = kvmppc_mmu_xlate(vcpu, gtlb_index, eaddr); |
1102 | gfn = gpaddr >> PAGE_SHIFT; | 1108 | gfn = gpaddr >> PAGE_SHIFT; |
1103 | 1109 | ||
@@ -1114,6 +1120,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
1114 | kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_MACHINE_CHECK); | 1120 | kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_MACHINE_CHECK); |
1115 | } | 1121 | } |
1116 | 1122 | ||
1123 | srcu_read_unlock(&vcpu->kvm->srcu, idx); | ||
1117 | break; | 1124 | break; |
1118 | } | 1125 | } |
1119 | 1126 | ||