Mailing List Archive

[xen-unstable] x86: Ensure TSC calibration stats are same across all CPUs when
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1216141020 -3600
# Node ID 64b55f15a0554a6cb08c60dc8da240449b2da973
# Parent 64d8a24d28f68eb0067d982b401b1b478e590194
x86: Ensure TSC calibration stats are same across all CPUs when
running with clocksource=tsc.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
---
xen/arch/x86/time.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)

diff -r 64d8a24d28f6 -r 64b55f15a055 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c Tue Jul 15 17:56:25 2008 +0100
+++ b/xen/arch/x86/time.c Tue Jul 15 17:57:00 2008 +0100
@@ -496,11 +496,27 @@ static u64 read_tsc_count(void)

static int init_tsctimer(struct platform_timesource *pts)
{
- /* TODO: evaluate stability of TSC here, return 0 if not stable. */
+ unsigned int cpu;
+
+ /*
+ * TODO: evaluate stability of TSC here, return 0 if not stable.
+ * For now we assume all TSCs are synchronised and hence can all share
+ * CPU 0's calibration values.
+ */
+ for_each_cpu ( cpu )
+ {
+ if ( cpu == 0 )
+ continue;
+ memcpy(&per_cpu(cpu_time, cpu),
+ &per_cpu(cpu_time, 0),
+ sizeof(struct cpu_time));
+ }
+
pts->name = "TSC";
pts->frequency = tsc_freq;
pts->read_counter = read_tsc_count;
pts->counter_bits = 64;
+
return 1;
}

@@ -1130,11 +1146,12 @@ int time_suspend(void)

int time_resume(void)
{
- u64 tmp = init_pit_and_calibrate_tsc();
+ /*u64 tmp = */init_pit_and_calibrate_tsc();

disable_pit_irq();

- set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp);
+ /* Disable this while calibrate_tsc_ap() also is skipped. */
+ /*set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp);*/

resume_platform_timer();


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