From: "Jan Beulich" Subject: [PATCH] x86: don't pass negative time to gtime_to_gtsc() Date: Thu, 11 Apr 2013 10:21:26 +0100 Message-ID: <51669CB602000078000CC622@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part59696386.1__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part59696386.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- 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 =3D &v->domain->arch.hvm_domain.pl_time; + stime +=3D 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 =3D 0; + } } tsc_stamp =3D gtime_to_gtsc(d, stime); } --=__Part59696386.1__= Content-Type: text/plain; name="x86-vTSC-cap-negative.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-vTSC-cap-negative.patch" x86: don't pass negative time to gtime_to_gtsc()=0A=0Ascale_delta(), which = is being called by that function, doesn't cope=0Awith that.=0A=0AAlso = print a warning message, so hopefully we can eventually figure why=0Aoccasi= onally a negative value results from the calculation in the first=0Aplace.= =0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x8= 6/time.c=0A+++ b/xen/arch/x86/time.c=0A@@ -854,7 +854,16 @@ static void = __update_vcpu_system_time(st=0A if ( is_hvm_domain(d) )=0A = {=0A struct pl_time *pl =3D &v->domain->arch.hvm_domain.pl_time= ;=0A+=0A stime +=3D pl->stime_offset + v->arch.hvm_vcpu.stime_o= ffset;=0A+ if ( (s64)stime < 0 )=0A+ {=0A+ = printk(XENLOG_G_WARNING "d%dv%d: bogus time %" PRId64=0A+ = " (offsets %" PRId64 "/%" PRId64 ")\n",=0A+ = d->domain_id, v->vcpu_id, stime,=0A+ pl->stime_offset, = v->arch.hvm_vcpu.stime_offset);=0A+ stime =3D 0;=0A+ = }=0A }=0A tsc_stamp =3D gtime_to_gtsc(d, stime);=0A = }=0A --=__Part59696386.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part59696386.1__=--