From: Keir Fraser Subject: Re: [PATCH] x86: don't pass negative time to gtime_to_gtsc() Date: Thu, 11 Apr 2013 11:01:05 +0100 Message-ID: References: <51669CB602000078000CC622@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51669CB602000078000CC622@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , xen-devel Cc: Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On 11/04/2013 10:21, "Jan Beulich" wrote: > scale_delta(), which is being called by that function, doesn't cope > with that. > > Also print a warning message, so hopefully we can eventually figure why > occasionally a negative value results from the calculation in the first > place. > > Signed-off-by: Jan Beulich Acked-by: Keir Fraser > --- a/xen/arch/x86/time.c > +++ b/xen/arch/x86/time.c > @@ -854,7 +854,16 @@ static void __update_vcpu_system_time(st > if ( is_hvm_domain(d) ) > { > 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; > + } > } > tsc_stamp = gtime_to_gtsc(d, stime); > } > > >