Fix the issue: Dom0-S3 will fail after sleep-wake for several times. -Time zone info just needs to be calculated in S3 suspend procedure. However, time_suspend() is also called on AP. That wasteful get_cmos_time() on AP may break __cpu_die() assumption since get_cmos_time() can take up to one second. This fix just limits it on BSP. Improve accuracy of the cmos_utc_offset calculation. -The get_cmos_time() function may take up to 1 second, while execution of the NOW() macro could be very fast. So when calculating cmos_utc_offset, get_cmos_time() should be firstly executed, and then (wc_sec + (wc_nsec + NOW()) / 1000000000ULL). This would make the calculation more accuracy than vice versa. Signed-off-by: Xu Dongxiao diff -r 56b42d68518e xen/arch/x86/time.c --- a/xen/arch/x86/time.c Thu Jan 10 22:53:43 2008 +0000 +++ b/xen/arch/x86/time.c Fri Jan 25 10:15:07 2008 +0800 @@ -976,8 +976,11 @@ static long cmos_utc_offset; /* in secon int time_suspend(void) { - cmos_utc_offset = (wc_sec + (wc_nsec + NOW()) / 1000000000ULL) - - get_cmos_time(); + if ( smp_processor_id() == 0 ) + { + cmos_utc_offset = -get_cmos_time(); + cmos_utc_offset += (wc_sec + (wc_nsec + NOW()) / 1000000000ULL); + } /* Better to cancel calibration timer for accuracy. */ kill_timer(&this_cpu(cpu_time).calibration_timer);