All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@suse.com>, xen-devel <xen-devel@lists.xen.org>
Cc: Tim Deegan <tim@xen.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH] x86: don't pass negative time to gtime_to_gtsc() (try 2)
Date: Mon, 10 Jun 2013 13:23:46 +0100	[thread overview]
Message-ID: <CDDB83E2.290BD%keir.xen@gmail.com> (raw)
In-Reply-To: <51B5DF9802000078000DCA20@nat28.tlf.novell.com>

On 10/06/2013 13:15, "Jan Beulich" <JBeulich@suse.com> wrote:

> This mostly reverts commit eb60be3d ("x86: don't pass negative time to
> gtime_to_gtsc()") and instead corrects __update_vcpu_system_time()'s
> handling of this_cpu(cpu_time).stime_local_stamp dating back before the
> start of a HVM guest (which would otherwise lead to a negative value
> getting passed to gtime_to_gtsc(), causing scale_delta() to produce
> meaningless output).
> 
> Flushing the value to zero was wrong, and printing a message for
> something that can validly happen wasn't very useful either.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

> 
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -823,16 +823,13 @@ static void __update_vcpu_system_time(st
>              struct pl_time *pl = &v->domain->arch.hvm_domain.pl_time;
>  
>              stime += pl->stime_offset + v->arch.hvm_vcpu.stime_offset;
> -            if ( (s64)stime < 0 )
> -            {
> -                printk(XENLOG_G_WARNING "d%dv%d: bogus time %" PRId64
> -                       " (offsets %" PRId64 "/%" PRId64 ")\n",
> -                       d->domain_id, v->vcpu_id, stime,
> -         pl->stime_offset, v->arch.hvm_vcpu.stime_offset);
> -                stime = 0;
> -            }
> +            if ( stime >= 0 )
> +                tsc_stamp = gtime_to_gtsc(d, stime);
> +            else
> +                tsc_stamp = -gtime_to_gtsc(d, -stime);
>          }
> -        tsc_stamp = gtime_to_gtsc(d, stime);
> +        else
> +            tsc_stamp = gtime_to_gtsc(d, stime);
>      }
>      else
>      {
> 
> 
> 

  reply	other threads:[~2013-06-10 12:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 12:15 [PATCH] x86: don't pass negative time to gtime_to_gtsc() (try 2) Jan Beulich
2013-06-10 12:23 ` Keir Fraser [this message]
2013-06-10 13:44 ` George Dunlap
2013-06-10 13:48   ` Jan Beulich
2013-06-10 13:53     ` George Dunlap
2013-06-10 13:57       ` Jan Beulich

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=CDDB83E2.290BD%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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.