From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: x86: Simplify kvm timer handler Date: Tue, 18 Oct 2011 18:23:25 +0200 Message-ID: <4E9DA7FD.2050803@siemens.com> References: <4E705EA8.8030609@siemens.com> <4E896B1E.8080202@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: kvm To: Avi Kivity , Marcelo Tosatti Return-path: Received: from goliath.siemens.de ([192.35.17.28]:32817 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932353Ab1JRQX3 (ORCPT ); Tue, 18 Oct 2011 12:23:29 -0400 In-Reply-To: <4E896B1E.8080202@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On 2011-10-03 09:58, Jan Kiszka wrote: > 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. >> >> Signed-off-by: Jan Kiszka --- >> arch/x86/kvm/timer.c | 26 ++++---------------------- 1 files >> changed, 4 insertions(+), 22 deletions(-) >> >> 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" >> >> -static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct >> kvm_timer *ktimer) +enum hrtimer_restart kvm_timer_fn(struct >> hrtimer *data) { - int restart_timer = 0; + struct kvm_timer >> *ktimer = container_of(data, struct kvm_timer, timer); + struct >> kvm_vcpu *vcpu = ktimer->vcpu; wait_queue_head_t *q = &vcpu->wq; >> >> /* @@ -40,26 +41,7 @@ static int __kvm_timer_fn(struct kvm_vcpu >> *vcpu, struct kvm_timer *ktimer) >> >> if (ktimer->t_ops->is_periodic(ktimer)) { >> hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); - >> restart_timer = 1; - } - - return restart_timer; -} - -enum >> hrtimer_restart kvm_timer_fn(struct hrtimer *data) -{ - int >> restart_timer; - struct kvm_vcpu *vcpu; - struct kvm_timer >> *ktimer = container_of(data, struct kvm_timer, timer); - - vcpu = >> ktimer->vcpu; - if (!vcpu) - return HRTIMER_NORESTART; - - >> restart_timer = __kvm_timer_fn(vcpu, ktimer); - if >> (restart_timer) return HRTIMER_RESTART; - else + } else return >> HRTIMER_NORESTART; } - > > Ping. > Ping II. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux