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

[Xen-changelog] [xen stable-4.2] x86: don't pass negative time to gtime_to_gtsc() (try 2)



commit 094c1cb9757a3456ea63491a1c0d6016bdfa2711
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Jul 11 14:21:48 2013 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jul 11 14:21:48 2013 +0200

    x86: don't pass negative time to gtime_to_gtsc() (try 2)
    
    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>
    master commit: 5ad914bc867c5a6a4957869c89918f4e1f9dd9c4
    master date: 2013-07-02 08:48:03 +0200
---
 xen/arch/x86/time.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 4c6c233..2e7b019 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -834,16 +834,13 @@ static void __update_vcpu_system_time(struct vcpu *v, int 
force)
             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
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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