All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] KVM guest: prevent tracing recursion with kvmclock
Date: Tue, 15 Nov 2011 15:12:16 +0200	[thread overview]
Message-ID: <20111115131216.GG3225@redhat.com> (raw)
In-Reply-To: <1321362075-27115-1-git-send-email-avi@redhat.com>

On Tue, Nov 15, 2011 at 03:01:15PM +0200, Avi Kivity wrote:
> Stop tracing when we read the clock, since tracing will also
> want to read the clock, and recurse indefinitely.
> 
> Based on a similar patch for Xen from Jeremy Fitzhardinge.
> 
> Signed-off-by: Avi Kivity <avi@redhat.com>
Tested-by: Gleb Natapov <gleb@redhat.com>

> ---
>  arch/x86/kernel/kvmclock.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> index c1a0188..44842d7 100644
> --- a/arch/x86/kernel/kvmclock.c
> +++ b/arch/x86/kernel/kvmclock.c
> @@ -74,9 +74,10 @@ static cycle_t kvm_clock_read(void)
>  	struct pvclock_vcpu_time_info *src;
>  	cycle_t ret;
>  
> -	src = &get_cpu_var(hv_clock);
> +	preempt_disable_notrace();
> +	src = &__get_cpu_var(hv_clock);
>  	ret = pvclock_clocksource_read(src);
> -	put_cpu_var(hv_clock);
> +	preempt_enable_notrace();
>  	return ret;
>  }
>  
> -- 
> 1.7.7.1

--
			Gleb.

  reply	other threads:[~2011-11-15 13:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15 13:01 [PATCH] KVM guest: prevent tracing recursion with kvmclock Avi Kivity
2011-11-15 13:12 ` Gleb Natapov [this message]
2011-11-15 13:38 ` Steven Rostedt
2011-11-15 13:45   ` Avi Kivity
2011-11-15 14:01     ` Steven Rostedt

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=20111115131216.GG3225@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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.