From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v2 1/6] KVM: add kvm_arch_sched_in Date: Thu, 21 Aug 2014 10:29:42 +0200 Message-ID: <53F5ADF6.7060000@redhat.com> References: <1408567997-21222-1-git-send-email-rkrcmar@redhat.com> <1408567997-21222-2-git-send-email-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, Gleb Natapov , Raghavendra KT , Vinod Chegu , Hui-Zhi , Christian Borntraeger To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , kvm@vger.kernel.org Return-path: In-Reply-To: <1408567997-21222-2-git-send-email-rkrcmar@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Il 20/08/2014 22:53, Radim Kr=C4=8Dm=C3=A1=C5=99 ha scritto: > Introduce preempt notifiers for architecture specific code. > Advantage over creating a new notifier in every arch is slightly simp= ler > code and guaranteed call order with respect to kvm_sched_in. >=20 > Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 > --- > arch/arm/kvm/arm.c | 4 ++++ > arch/mips/kvm/mips.c | 4 ++++ > arch/powerpc/kvm/powerpc.c | 4 ++++ > arch/s390/kvm/kvm-s390.c | 4 ++++ > arch/x86/kvm/x86.c | 4 ++++ What about adding them as static inlines in arch/*/include/asm/kvm_host.h (except for arch/x86 of course)? Paolo > include/linux/kvm_host.h | 2 ++ > virt/kvm/kvm_main.c | 2 ++ > 7 files changed, 24 insertions(+) >=20 > diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c > index a99e0cd..9f788eb 100644 > --- a/arch/arm/kvm/arm.c > +++ b/arch/arm/kvm/arm.c > @@ -288,6 +288,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) > { > } > =20 > +void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) > +{ > +} > + > void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) > { > vcpu->cpu =3D cpu; > diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c > index cd71141..2362df2 100644 > --- a/arch/mips/kvm/mips.c > +++ b/arch/mips/kvm/mips.c > @@ -1002,6 +1002,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcp= u) > { > } > =20 > +void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) > +{ > +} > + > int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, > struct kvm_translation *tr) > { > diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > index 4c79284..cbc432f 100644 > --- a/arch/powerpc/kvm/powerpc.c > +++ b/arch/powerpc/kvm/powerpc.c > @@ -720,6 +720,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) > kvmppc_subarch_vcpu_uninit(vcpu); > } > =20 > +void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) > +{ > +} > + > void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) > { > #ifdef CONFIG_BOOKE > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index ce81eb2..a3c324e 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -555,6 +555,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) > /* Nothing todo */ > } > =20 > +void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) > +{ > +} > + > void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) > { > save_fp_ctl(&vcpu->arch.host_fpregs.fpc); > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 8f1e22d..d7c214f 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -7146,6 +7146,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcp= u) > static_key_slow_dec(&kvm_no_apic_vcpu); > } > =20 > +void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) > +{ > +} > + > int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) > { > if (type) > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index a4c33b3..ebd7236 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -624,6 +624,8 @@ void kvm_arch_exit(void); > int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu); > void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu); > =20 > +void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu); > + > void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu); > void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); > void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 33712fb..d3c3ed0 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -3123,6 +3123,8 @@ static void kvm_sched_in(struct preempt_notifie= r *pn, int cpu) > if (vcpu->preempted) > vcpu->preempted =3D false; > =20 > + kvm_arch_sched_in(vcpu, cpu); > + > kvm_arch_vcpu_load(vcpu, cpu); > } > =20 >=20 Reviewed-by: Paolo Bonzini