[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86: don't pass negative time to gtime_to_gtsc() (try 2)


  • To: Jan Beulich <JBeulich@xxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxx>
  • From: Keir Fraser <keir.xen@xxxxxxxxx>
  • Date: Mon, 10 Jun 2013 13:23:46 +0100
  • Cc: Tim Deegan <tim@xxxxxxx>, Keir Fraser <keir@xxxxxxx>
  • Delivery-date: Mon, 10 Jun 2013 12:24:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: Ac5l1VpvNb9puef0B0OKtP8OQSq/VQ==
  • Thread-topic: [PATCH] x86: don't pass negative time to gtime_to_gtsc() (try 2)

On 10/06/2013 13:15, "Jan Beulich" <JBeulich@xxxxxxxx> 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@xxxxxxxx>

Acked-by: Keir Fraser <keir@xxxxxxx>

> 
> --- 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
>      {
> 
> 
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.