From 845d4284d6499c55f9ce2633ce9ae76890f19458 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Tue, 19 Oct 2004 18:11:26 -0700 Subject: [PATCH] [PATCH] x86_64: use TSC on SMP EM64T machines x86-64 MP kernels always used HPET timing when available. This was done because AMD systems don't have synchronized TSCs in all cases. On Intel this is not true (except Summit), so use faster TSC timing for those. Also only enable HPET gettimeofday when there is more than one CPU online. Signed-off-by: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/x86_64/kernel/time.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index d7b6d48cfb78a..fcb5919b4c52c 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c @@ -909,15 +909,28 @@ void __init time_init_smp(void) { char *timetype; - if (vxtime.hpet_address) { + /* + * AMD systems with more than one CPU don't have fully synchronized + * TSCs. Always use HPET gettimeofday for these, although it is slower. + * Intel SMP systems usually have synchronized TSCs, so use always + * the TSC. + * + * Exceptions: + * IBM Summit. Will need to be special cased later. + * AMD dual core may also not need HPET. Check me. + */ + if (vxtime.hpet_address && + num_online_cpus() > 1 && + boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { timetype = "HPET"; vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; vxtime.mode = VXTIME_HPET; do_gettimeoffset = do_gettimeoffset_hpet; } else { - timetype = "PIT/TSC"; + timetype = vxtime.hpet_address ? "HPET/TSC" : "PIT/TSC"; vxtime.mode = VXTIME_TSC; } + printk(KERN_INFO "time.c: Using %s based timekeeping.\n", timetype); } -- 2.53.0