From: "Jan Beulich" Subject: [PATCH] fix time reporting to guest Date: Mon, 26 Mar 2007 15:28:10 +0100 Message-ID: <4607F49A.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org The recent change to guest time handling dropped a call to update_vcpu_system_time(), leading to time-went-backwards messages and guest hangs (the latter were observed only in 2.6.21-rc4 and only when no serial console was in use). Re-adding that missing call, and at once also adding one before raising a single shot timer event. Debugging the issue also revealed that some commented out debug printk-s in x86's time handling code didn't compile under x86-64. Signed-off-by: Jan Beulich Index: 2007-03-19/xen/arch/x86/time.c =================================================================== --- 2007-03-19.orig/xen/arch/x86/time.c 2007-02-23 09:42:38.000000000 +0100 +++ 2007-03-19/xen/arch/x86/time.c 2007-03-26 13:45:53.000000000 +0200 @@ -771,9 +771,9 @@ static void local_time_calibration(void local_irq_enable(); #if 0 - printk("PRE%d: tsc=%lld stime=%lld master=%lld\n", + printk("PRE%d: tsc=%"PRIu64" stime=%"PRIu64" master=%"PRIu64"\n", smp_processor_id(), prev_tsc, prev_local_stime, prev_master_stime); - printk("CUR%d: tsc=%lld stime=%lld master=%lld -> %lld\n", + printk("CUR%d: tsc=%"PRIu64" stime=%"PRIu64" master=%"PRIu64" -> %"PRId64"\n", smp_processor_id(), curr_tsc, curr_local_stime, curr_master_stime, curr_master_stime - curr_local_stime); #endif Index: 2007-03-19/xen/common/schedule.c =================================================================== --- 2007-03-19.orig/xen/common/schedule.c 2007-03-12 10:23:32.000000000 +0100 +++ 2007-03-19/xen/common/schedule.c 2007-03-26 13:38:02.000000000 +0200 @@ -691,6 +691,7 @@ static void s_timer_fn(void *unused) static void vcpu_periodic_timer_fn(void *data) { struct vcpu *v = data; + update_vcpu_system_time(v); vcpu_periodic_timer_work(v); } @@ -698,6 +699,7 @@ static void vcpu_periodic_timer_fn(void static void vcpu_singleshot_timer_fn(void *data) { struct vcpu *v = data; + update_vcpu_system_time(v); send_timer_event(v); }