From: Paolo Bonzini Subject: Re: [RFC patch 15/15] x86/kvm: Use GENERIC_EXIT_WORKPENDING Date: Thu, 19 Sep 2019 17:40:51 +0200 Message-ID: References: <20190919150314.054351477@linutronix.de> <20190919150809.964620570@linutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20190919150809.964620570@linutronix.de> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Thomas Gleixner , LKML Cc: x86@kernel.org, Peter Zijlstra , Andy Lutomirski , Catalin Marinas , Will Deacon , Mark Rutland , Marc Zyngier , kvm@vger.kernel.org, linux-arch@vger.kernel.org List-Id: linux-arch.vger.kernel.org On 19/09/19 17:03, Thomas Gleixner wrote: > Use the generic infrastructure to check for and handle pending work befor= e > entering into guest mode. >=20 > Signed-off-by: Thomas Gleixner Subject should be "x86/kvm: use exit_to_guestmode". Paolo > --- > arch/x86/kvm/x86.c | 17 +++++------------ > 1 file changed, 5 insertions(+), 12 deletions(-) >=20 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -52,6 +52,7 @@ > #include > #include > #include > +#include > #include > =20 > #include > @@ -7984,8 +7985,8 @@ static int vcpu_enter_guest(struct kvm_v > =09if (kvm_lapic_enabled(vcpu) && vcpu->arch.apicv_active) > =09=09kvm_x86_ops->sync_pir_to_irr(vcpu); > =20 > -=09if (vcpu->mode =3D=3D EXITING_GUEST_MODE || kvm_request_pending(vcpu) > -=09 || need_resched() || signal_pending(current)) { > +=09if (vcpu->mode =3D=3D EXITING_GUEST_MODE || kvm_request_pending(vcpu)= || > +=09 exit_to_guestmode_work_pending()) { > =09=09vcpu->mode =3D OUTSIDE_GUEST_MODE; > =09=09smp_wmb(); > =09=09local_irq_enable(); > @@ -8178,17 +8179,9 @@ static int vcpu_run(struct kvm_vcpu *vcp > =20 > =09=09kvm_check_async_pf_completion(vcpu); > =20 > -=09=09if (signal_pending(current)) { > -=09=09=09r =3D -EINTR; > -=09=09=09vcpu->run->exit_reason =3D KVM_EXIT_INTR; > -=09=09=09++vcpu->stat.signal_exits; > +=09=09r =3D exit_to_guestmode(kvm, vcpu); > +=09=09if (r) > =09=09=09break; > -=09=09} > -=09=09if (need_resched()) { > -=09=09=09srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); > -=09=09=09cond_resched(); > -=09=09=09vcpu->srcu_idx =3D srcu_read_lock(&kvm->srcu); > -=09=09} > =09} > =20 > =09srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); >=20 >=20