提交 03660ba2 编写于 作者: A Alexander Graf 提交者: Avi Kivity

KVM: PPC: Booke: only prepare to enter when we enter

So far, we've always called prepare_to_enter even when all we did was return
to the host. This patch changes that semantic to only call prepare_to_enter
when we actually want to get back into the guest.
Signed-off-by: NAlexander Graf <agraf@suse.de>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 7cc1e8ee
...@@ -464,7 +464,7 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) ...@@ -464,7 +464,7 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
* *
* returns !0 if a signal is pending and check_signal is true * returns !0 if a signal is pending and check_signal is true
*/ */
static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu, bool check_signal) static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
{ {
int r = 0; int r = 0;
...@@ -477,7 +477,7 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu, bool check_signal) ...@@ -477,7 +477,7 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu, bool check_signal)
continue; continue;
} }
if (check_signal && signal_pending(current)) { if (signal_pending(current)) {
r = 1; r = 1;
break; break;
} }
...@@ -509,7 +509,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) ...@@ -509,7 +509,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
} }
local_irq_disable(); local_irq_disable();
if (kvmppc_prepare_to_enter(vcpu, true)) { if (kvmppc_prepare_to_enter(vcpu)) {
kvm_run->exit_reason = KVM_EXIT_INTR; kvm_run->exit_reason = KVM_EXIT_INTR;
ret = -EINTR; ret = -EINTR;
goto out; goto out;
...@@ -946,11 +946,13 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, ...@@ -946,11 +946,13 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
* To avoid clobbering exit_reason, only check for signals if we * To avoid clobbering exit_reason, only check for signals if we
* aren't already exiting to userspace for some other reason. * aren't already exiting to userspace for some other reason.
*/ */
local_irq_disable(); if (!(r & RESUME_HOST)) {
if (kvmppc_prepare_to_enter(vcpu, !(r & RESUME_HOST))) { local_irq_disable();
run->exit_reason = KVM_EXIT_INTR; if (kvmppc_prepare_to_enter(vcpu)) {
r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV); run->exit_reason = KVM_EXIT_INTR;
kvmppc_account_exit(vcpu, SIGNAL_EXITS); r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
kvmppc_account_exit(vcpu, SIGNAL_EXITS);
}
} }
return r; return r;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册