Re: Difference between vcpu_load and kvm_sched_in ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/21/15 2:46 PM, Paolo Bonzini wrote:

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

Got it, thanks. :-)

Regards,
Wanpeng Li
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux