All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: x86: Simplify kvm timer handler
Date: Mon, 03 Oct 2011 09:58:22 +0200	[thread overview]
Message-ID: <4E896B1E.8080202@web.de> (raw)
In-Reply-To: <4E705EA8.8030609@siemens.com>

[-- Attachment #1: Type: text/plain, Size: 1758 bytes --]

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 <jan.kiszka@siemens.com>
> ---
>  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 <linux/atomic.h>
>  #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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2011-10-03  7:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-14  7:58 [PATCH] KVM: x86: Simplify kvm timer handler Jan Kiszka
2011-10-03  7:58 ` Jan Kiszka [this message]
2011-10-18 16:23   ` Jan Kiszka
2011-10-19 14:30 ` Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E896B1E.8080202@web.de \
    --to=jan.kiszka@web.de \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.