All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Adjust time init sequence
@ 2008-12-10 13:10 Tian, Kevin
  2008-12-10 13:49 ` Keir Fraser
  0 siblings, 1 reply; 14+ messages in thread
From: Tian, Kevin @ 2008-12-10 13:10 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 1511 bytes --]

Adjust time init sequence

percpu timer init for BSP happens within init_xen_time,
while CMOS access at end may take up to 1s. This may 
make 1st trigger to calibration timer happens >1s interval
and elapsed local stime for BSP also exceed 1s. However
percpu timer init happens after that point for APs, which
will then have a <1s elapsed local stime at 1st calibration.
That leads to distinct mul_frac among cores, which can
cause up to 6ms system time skew in the start. This is
not big issue, since gradually xen calibration framework
closes that gap. But it's still better to avoid that big 
skew in early boot phase. 

Signed-off-by Kevin Tian <kevin.tian@intel.com>

diff -r 85b2f4aafea4 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Tue Dec 09 20:56:23 2008 -0500
+++ b/xen/arch/x86/time.c	Tue Dec 09 22:21:07 2008 -0500
@@ -1095,7 +1095,7 @@
 
     local_irq_save(flags);
     rdtscll(t->local_tsc_stamp);
-    now = !plt_src.read_counter ? 0 : read_platform_stime();
+    now = read_platform_stime();
     local_irq_restore(flags);
 
     t->stime_master_stamp = now;
@@ -1118,12 +1118,13 @@
 
     open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration);
 
-    init_percpu_time();
+    do_settime(get_cmos_time(), 0, 0);
 
     stime_platform_stamp = 0;
     init_platform_timer();
 
-    do_settime(get_cmos_time(), 0, NOW());
+    /* init bsp percpu time after platform timer initialized, similar as AP */
+    init_percpu_time();
 
     return 0;
 }

[-- Attachment #2: time_init_seq.patch --]
[-- Type: application/octet-stream, Size: 1469 bytes --]

Adjust time init sequence

percpu timer init for BSP happens within init_xen_time,
while CMOS access at end may take up to 1s. This may 
make 1st trigger to calibration timer happens >1s interval
and elapsed local stime for BSP also exceed 1s. However
percpu timer init happens after that point for APs, which
will then have a <1s elapsed local stime at 1st calibration.
That leads to distinct mul_frac among cores, which can
cause up to 6ms system time skew in the start. This is
not big issue, since gradually xen calibration framework
closes that gap. But it's still better to avoid that big 
skew in early boot phase. 

Signed-off-by Kevin Tian <kevin.tian@intel.com>

diff -r 85b2f4aafea4 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Tue Dec 09 20:56:23 2008 -0500
+++ b/xen/arch/x86/time.c	Tue Dec 09 22:21:07 2008 -0500
@@ -1095,7 +1095,7 @@
 
     local_irq_save(flags);
     rdtscll(t->local_tsc_stamp);
-    now = !plt_src.read_counter ? 0 : read_platform_stime();
+    now = read_platform_stime();
     local_irq_restore(flags);
 
     t->stime_master_stamp = now;
@@ -1118,12 +1118,13 @@
 
     open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration);
 
-    init_percpu_time();
+    do_settime(get_cmos_time(), 0, 0);
 
     stime_platform_stamp = 0;
     init_platform_timer();
 
-    do_settime(get_cmos_time(), 0, NOW());
+    /* init bsp percpu time after platform timer initialized, similar as AP */
+    init_percpu_time();
 
     return 0;
 }

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-12-12 16:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-10 13:10 [PATCH] Adjust time init sequence Tian, Kevin
2008-12-10 13:49 ` Keir Fraser
2008-12-11  0:23   ` Tian, Kevin
2008-12-11  0:44     ` Keir Fraser
2008-12-11  0:47       ` Tian, Kevin
2008-12-11  4:45         ` Tian, Kevin
2008-12-11  9:04         ` Keir Fraser
2008-12-11  9:06           ` Tian, Kevin
2008-12-11 13:12           ` Keir Fraser
2008-12-12  3:40             ` Tian, Kevin
2008-12-12  9:08               ` Keir Fraser
2008-12-12 10:10                 ` Jan Beulich
2008-12-12 10:38                   ` Keir Fraser
2008-12-12 16:40                     ` Tian, Kevin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.