From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: x86: Simplify kvm timer handler Date: Mon, 03 Oct 2011 09:58:22 +0200 Message-ID: <4E896B1E.8080202@web.de> References: <4E705EA8.8030609@siemens.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig671BF065720B590A2AD22157" Cc: kvm To: Avi Kivity , Marcelo Tosatti Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:58109 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752499Ab1JCH6s (ORCPT ); Mon, 3 Oct 2011 03:58:48 -0400 In-Reply-To: <4E705EA8.8030609@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig671BF065720B590A2AD22157 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2011-09-14 09:58, Jan Kiszka wrote: > The vcpu reference of a kvm_timer can't become NULL while the timer is > valid, so drop this redundant test. This also makes it pointless to > carry a separate __kvm_timer_fn, fold it into kvm_timer_fn. >=20 > Signed-off-by: Jan Kiszka > --- > arch/x86/kvm/timer.c | 26 ++++---------------------- > 1 files changed, 4 insertions(+), 22 deletions(-) >=20 > diff --git a/arch/x86/kvm/timer.c b/arch/x86/kvm/timer.c > index ae432ea..6b85cc6 100644 > --- a/arch/x86/kvm/timer.c > +++ b/arch/x86/kvm/timer.c > @@ -18,9 +18,10 @@ > #include > #include "kvm_timer.h" > =20 > -static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct kvm_timer *kti= mer) > +enum hrtimer_restart kvm_timer_fn(struct hrtimer *data) > { > - int restart_timer =3D 0; > + struct kvm_timer *ktimer =3D container_of(data, struct kvm_timer, tim= er); > + struct kvm_vcpu *vcpu =3D ktimer->vcpu; > wait_queue_head_t *q =3D &vcpu->wq; > =20 > /* > @@ -40,26 +41,7 @@ static int __kvm_timer_fn(struct kvm_vcpu *vcpu, str= uct kvm_timer *ktimer) > =20 > if (ktimer->t_ops->is_periodic(ktimer)) { > hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); > - restart_timer =3D 1; > - } > - > - return restart_timer; > -} > - > -enum hrtimer_restart kvm_timer_fn(struct hrtimer *data) > -{ > - int restart_timer; > - struct kvm_vcpu *vcpu; > - struct kvm_timer *ktimer =3D container_of(data, struct kvm_timer, tim= er); > - > - vcpu =3D ktimer->vcpu; > - if (!vcpu) > - return HRTIMER_NORESTART; > - > - restart_timer =3D __kvm_timer_fn(vcpu, ktimer); > - if (restart_timer) > return HRTIMER_RESTART; > - else > + } else > return HRTIMER_NORESTART; > } > - Ping. --------------enig671BF065720B590A2AD22157 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6Jax8ACgkQitSsb3rl5xT8tACgzUFJvSuFRYHUapqDUDbDMP0B 1KEAoIdx5yuCL71/zOIVhZM2wYjZMsnh =ir6l -----END PGP SIGNATURE----- --------------enig671BF065720B590A2AD22157--