Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC

From: Paolo Bonzini
Date: Thu Mar 03 2016 - 05:50:34 EST




On 03/03/2016 11:42, Suravee Suthikulpanit wrote:
> In facts, instead of setting up the vAPIC backing page address when
> calling kvm_arch_vcpu_load(), we should be able to do it when calling
> kvm_arch_vcpu_sched_in(). This seems more appropriate since the
> kvm_arch_vcpu_load() is also called in many unnecessary occasions via
> vcpu_load() (in the arch/x86/kvm/x86.c). The same goes for the
> kvm_arch_vcpu_put().
>
> However, there is no kvm_arch_vcpu_sched_out(). But that can be added
> easily.
>
> What do you think?

How much code is involved? It seems an unnecessary complication...
Unless you can profile a difference, I would leave it in
kvm_arch_vcpu_load()/kvm_arch_vcpu_put().

Note that sched_in and sched_out are not called once per invocation of
KVM_RUN---only through the preempt notifiers. So I'm not sure it is
enough to use sched_in and sched_out.

Paolo