From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <wanpeng.li@hotmail.com>, Yacine <y_hebbal@esi.dz>,
kvm@vger.kernel.org
Subject: Re: Difference between vcpu_load and kvm_sched_in ?
Date: Wed, 21 Oct 2015 08:46:23 +0200 [thread overview]
Message-ID: <562734BF.2020806@redhat.com> (raw)
In-Reply-To: <BLU436-SMTP143159F9CE8F86142A5D3EA80390@phx.gbl>
On 21/10/2015 00:57, Wanpeng Li wrote:
>> kvm_sched_out and kvm_sched_in are part of KVM's preemption hooks. The
>> hooks are registered only between vcpu_load and vcpu_put, therefore they
>> know that the mutex is taken. The sequence will go like this:
>>
>> vcpu_load
>> kvm_sched_out
>> kvm_sched_in
>> kvm_sched_out
>> kvm_sched_in
>> ...
>> vcpu_put
>
> If this should be:
>
> vcpu_load
> kvm_sched_in
> kvm_sched_out
> kvm_sched_in
> kvm_sched_out
> ...
> vcpu_put
No, because vcpu_load is called while the thread is running. Therefore,
the first preempt notifier call will be a sched_out notification, which
calls kvm_arch_vcpu_put. Extending the picture above:
vcpu_load -> kvm_arch_vcpu_load
kvm_sched_out -> kvm_arch_vcpu_put
kvm_sched_in -> kvm_arch_vcpu_load
kvm_sched_out -> kvm_arch_vcpu_put
kvm_sched_in -> kvm_arch_vcpu_load
...
kvm_sched_out -> kvm_arch_vcpu_put
kvm_sched_in -> kvm_arch_vcpu_load
vcpu_put -> kvm_arch_vcpu_put
Thanks,
Paolo
next prev parent reply other threads:[~2015-10-21 6:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 9:57 Difference between vcpu_load and kvm_sched_in ? Yacine
2015-10-20 15:44 ` Paolo Bonzini
2015-10-20 22:57 ` Wanpeng Li
2015-10-21 6:46 ` Paolo Bonzini [this message]
2015-10-21 10:20 ` Yacine HEBBAL
2015-10-22 7:33 ` Wanpeng Li
[not found] ` <CACEoar52w8qU2bbSTGKJdq++jz3gppLQ0N-xqsS-pnYMNnaK3Q@mail.gmail.com>
2015-10-21 10:25 ` Paolo Bonzini
2015-10-21 17:21 ` Yacine HEBBAL
2015-10-22 9:37 ` 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=562734BF.2020806@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=wanpeng.li@hotmail.com \
--cc=y_hebbal@esi.dz \
/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.