diff options
author | Paul Mackerras <paulus@samba.org> | 2014-01-17 18:28:03 +1100 |
---|---|---|
committer | Eli Qiao <taget@linux.vnet.ibm.com> | 2014-01-22 10:26:26 +0800 |
commit | b4b9d6ec24825ed09a74a24ff7ea07c9c07cc7a8 (patch) | |
tree | 75c62cab16bf9da8e30afc1e4e04b9f643c8a1be | |
parent | 153acd9277519eec0281ab453f68ebd414ecdf8a (diff) | |
download | powerkvm-b4b9d6ec24825ed09a74a24ff7ea07c9c07cc7a8.tar.gz |
KVM: PPC: Book3S PR: Take SRCU read lock around RTAS kvm_read_guest() call
This does for PR KVM what c9438092cae4 ("KVM: PPC: Book3S HV: Take SRCU
read lock around kvm_read_guest() call") did for HV KVM, that is,
eliminate a "suspicious rcu_dereference_check() usage!" warning by
taking the SRCU lock around the call to kvmppc_rtas_hcall().
It also fixes a return of RESUME_HOST to return EMULATE_FAIL instead,
since kvmppc_h_pr() is supposed to return EMULATE_* values.
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kvm/book3s_pr_papr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_pr_papr.c b/arch/powerpc/kvm/book3s_pr_papr.c index 088f9024c1dcd..94050907cd2b6 100644 --- a/arch/powerpc/kvm/book3s_pr_papr.c +++ b/arch/powerpc/kvm/book3s_pr_papr.c @@ -289,6 +289,8 @@ static int kvmppc_h_pr_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd) int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd) { + int rc, idx; + switch (cmd) { case H_ENTER: return kvmppc_h_pr_enter(vcpu); @@ -321,8 +323,11 @@ int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd) break; case H_RTAS: if (list_empty(&vcpu->kvm->arch.rtas_tokens)) - return RESUME_HOST; - if (kvmppc_rtas_hcall(vcpu)) + break; + idx = srcu_read_lock(&vcpu->kvm->srcu); + rc = kvmppc_rtas_hcall(vcpu); + srcu_read_unlock(&vcpu->kvm->srcu, idx); + if (rc) break; kvmppc_set_gpr(vcpu, 3, 0); return EMULATE_DONE; |