diff options
author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2014-11-25 11:04:08 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-12-04 09:29:12 -0500 |
commit | eed6e79d7362335967def243cc891179a9c59892 (patch) | |
tree | b1c803f19ad0c2a987c260977e8e670ff84205a2 /virt | |
parent | 9c1a5d38780e652275aa55362dbee0d7e827e069 (diff) |
KVM: don't check for PF_VCPU when yielding
kvm_enter_guest() has to be called with preemption disabled and will
set PF_VCPU. Current code takes PF_VCPU as a hint that the VCPU thread
is running and therefore needs no yield.
However, the check on PF_VCPU is wrong on s390, where preemption has
to stay enabled in order to correctly process page faults. Thus,
s390 reenables preemption and starts to execute the guest. The thread
might be scheduled out between kvm_enter_guest() and kvm_exit_guest(),
resulting in PF_VCPU being set but not being run. When this happens,
the opportunity for directed yield is missed.
However, this check is done already in kvm_vcpu_on_spin before calling
kvm_vcpu_yield_loop:
if (!ACCESS_ONCE(vcpu->preempted))
continue;
so the check on PF_VCPU is superfluous in general, and this patch
removes it.
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 759af6596a07..2ffee3018a3d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1788,10 +1788,6 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target) | |||
1788 | rcu_read_unlock(); | 1788 | rcu_read_unlock(); |
1789 | if (!task) | 1789 | if (!task) |
1790 | return ret; | 1790 | return ret; |
1791 | if (task->flags & PF_VCPU) { | ||
1792 | put_task_struct(task); | ||
1793 | return ret; | ||
1794 | } | ||
1795 | ret = yield_to(task, 1); | 1791 | ret = yield_to(task, 1); |
1796 | put_task_struct(task); | 1792 | put_task_struct(task); |
1797 | 1793 | ||