From: Christian Borntraeger <borntraeger@de.ibm.com>
To: David Hildenbrand <dahi@linux.vnet.ibm.com>, kvm@vger.kernel.org
Cc: pbonzini@redhat.com, gleb@kernel.org, jfrei@linux.vnet.ibm.com,
cornelia.huck@de.ibm.com
Subject: Re: [PATCH RFC 1/2] KVM: don't check for PF_VCPU when yielding
Date: Wed, 26 Nov 2014 08:51:46 +0100 [thread overview]
Message-ID: <54758692.5000906@de.ibm.com> (raw)
In-Reply-To: <1416931449-24585-2-git-send-email-dahi@linux.vnet.ibm.com>
Am 25.11.2014 um 17:04 schrieb David Hildenbrand:
> As some architectures (e.g. s390) can't disable preemption while
> entering/leaving the guest, they won't receive the yield in all situations.
>
> kvm_enter_guest() has to be called with preemption_disabled and will set
> PF_VCPU. After that point e.g. s390 reenables preemption and starts to execute the
> guest. The thread might therefore be scheduled out between kvm_enter_guest() and
> kvm_exit_guest(), resulting in PF_VCPU being set but not being run.
>
> Please note that preemption has to stay enabled in order to correctly process
> page faults on s390.
>
> Current code takes PF_VCPU as a hint that the VCPU thread is running and
> therefore needs no yield. yield_to() checks whether the target thread is running,
> so let's use the inbuilt functionality to make it independent of PF_VCPU and
> preemption.
This change is a trade-off.
PRO: This patch would improve the case of preemption on s390. This is probably a corner case as most distros have preemption off anyway.
CON: The downside is that kvm_vcpu_yield_to is called also from kvm_vcpu_on_spin. Here we want to avoid the scheduler overhead for a wrong decision.
So I think this patch is probably not what we want in most cases.
>
> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
> ---
> virt/kvm/kvm_main.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 5b45330..184f52e 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1782,10 +1782,6 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target)
> rcu_read_unlock();
> if (!task)
> return ret;
> - if (task->flags & PF_VCPU) {
> - put_task_struct(task);
> - return ret;
> - }
> ret = yield_to(task, 1);
> put_task_struct(task);
>
next prev parent reply other threads:[~2014-11-26 7:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-25 16:04 [PATCH RFC 0/2] assign each vcpu an owning thread and improve yielding David Hildenbrand
2014-11-25 16:04 ` [PATCH RFC 1/2] KVM: don't check for PF_VCPU when yielding David Hildenbrand
2014-11-26 7:51 ` Christian Borntraeger [this message]
2014-11-26 9:23 ` David Hildenbrand
2014-11-26 9:31 ` Christian Borntraeger
2014-11-28 10:08 ` Raghavendra KT
2014-11-28 10:58 ` Christian Borntraeger
2014-11-28 11:40 ` Raghavendra K T
2014-12-01 9:54 ` David Hildenbrand
2014-12-03 12:53 ` Paolo Bonzini
2014-12-03 13:02 ` Paolo Bonzini
2014-12-03 13:04 ` David Hildenbrand
2014-11-25 16:04 ` [PATCH RFC 2/2] KVM: thread creating a vcpu is the owner of that vcpu David Hildenbrand
2014-11-26 7:54 ` Christian Borntraeger
2014-12-03 12:53 ` Paolo Bonzini
2014-12-03 12:12 ` [PATCH RFC 0/2] assign each vcpu an owning thread and improve yielding David Hildenbrand
2014-12-03 12:54 ` Paolo Bonzini
2014-12-03 13:00 ` David Hildenbrand
2014-12-03 13:00 ` Christian Borntraeger
2014-12-03 13:06 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54758692.5000906@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=gleb@kernel.org \
--cc=jfrei@linux.vnet.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.