aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-02-25 22:18:49 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-26 12:53:31 -0500
commite8b917775b572bc27de105f1317c2de4335db5b3 (patch)
tree940351af2d1690331d82a65331acf34254621936
parente2c0388866dc12bef56b178b958f9b778fe6c687 (diff)
[PATCH] x86_64: Move the SMP time selection earlier
SMP time selection originally ran after all CPUs were brought up because it needed to know the number of CPUs to decide if it needs an MP safe timer or not. This is not needed anymore because we know present CPUs early. This fixes a couple of problems: - apicmaintimer didn't always work because it relied on state that was set up time_init_gtod too late. - The output for the used timer in early kernel log was misleading because time_init_gtod could actually change it later. Now always print the final timer choice Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/x86_64/kernel/smpboot.c2
-rw-r--r--arch/x86_64/kernel/time.c22
-rw-r--r--include/asm-x86_64/proto.h1
3 files changed, 11 insertions, 14 deletions
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index b82eb86e4f5d..66e98659d077 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -1152,8 +1152,6 @@ void __init smp_cpus_done(unsigned int max_cpus)
1152 setup_ioapic_dest(); 1152 setup_ioapic_dest();
1153#endif 1153#endif
1154 1154
1155 time_init_gtod();
1156
1157 check_nmi_watchdog(); 1155 check_nmi_watchdog();
1158} 1156}
1159 1157
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 67841d11ed1f..3080f84bf7b7 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -48,6 +48,8 @@ static void cpufreq_delayed_get(void);
48extern void i8254_timer_resume(void); 48extern void i8254_timer_resume(void);
49extern int using_apic_timer; 49extern int using_apic_timer;
50 50
51static char *time_init_gtod(void);
52
51DEFINE_SPINLOCK(rtc_lock); 53DEFINE_SPINLOCK(rtc_lock);
52DEFINE_SPINLOCK(i8253_lock); 54DEFINE_SPINLOCK(i8253_lock);
53 55
@@ -901,6 +903,7 @@ static struct irqaction irq0 = {
901void __init time_init(void) 903void __init time_init(void)
902{ 904{
903 char *timename; 905 char *timename;
906 char *gtod;
904 907
905#ifdef HPET_HACK_ENABLE_DANGEROUS 908#ifdef HPET_HACK_ENABLE_DANGEROUS
906 if (!vxtime.hpet_address) { 909 if (!vxtime.hpet_address) {
@@ -945,21 +948,19 @@ void __init time_init(void)
945 timename = "PIT"; 948 timename = "PIT";
946 } 949 }
947 950
948 printk(KERN_INFO "time.c: Using %ld.%06ld MHz %s timer.\n", 951 vxtime.mode = VXTIME_TSC;
949 vxtime_hz / 1000000, vxtime_hz % 1000000, timename); 952 gtod = time_init_gtod();
953
954 printk(KERN_INFO "time.c: Using %ld.%06ld MHz WALL %s GTOD %s timer.\n",
955 vxtime_hz / 1000000, vxtime_hz % 1000000, timename, gtod);
950 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", 956 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
951 cpu_khz / 1000, cpu_khz % 1000); 957 cpu_khz / 1000, cpu_khz % 1000);
952 vxtime.mode = VXTIME_TSC;
953 vxtime.quot = (1000000L << 32) / vxtime_hz; 958 vxtime.quot = (1000000L << 32) / vxtime_hz;
954 vxtime.tsc_quot = (1000L << 32) / cpu_khz; 959 vxtime.tsc_quot = (1000L << 32) / cpu_khz;
955 vxtime.last_tsc = get_cycles_sync(); 960 vxtime.last_tsc = get_cycles_sync();
956 setup_irq(0, &irq0); 961 setup_irq(0, &irq0);
957 962
958 set_cyc2ns_scale(cpu_khz); 963 set_cyc2ns_scale(cpu_khz);
959
960#ifndef CONFIG_SMP
961 time_init_gtod();
962#endif
963} 964}
964 965
965/* 966/*
@@ -981,9 +982,9 @@ __cpuinit int unsynchronized_tsc(void)
981} 982}
982 983
983/* 984/*
984 * Decide after all CPUs are booted what mode gettimeofday should use. 985 * Decide what mode gettimeofday should use.
985 */ 986 */
986void __init time_init_gtod(void) 987__init static char *time_init_gtod(void)
987{ 988{
988 char *timetype; 989 char *timetype;
989 990
@@ -1011,8 +1012,7 @@ void __init time_init_gtod(void)
1011 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC"; 1012 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC";
1012 vxtime.mode = VXTIME_TSC; 1013 vxtime.mode = VXTIME_TSC;
1013 } 1014 }
1014 1015 return timetype;
1015 printk(KERN_INFO "time.c: Using %s based timekeeping.\n", timetype);
1016} 1016}
1017 1017
1018__setup("report_lost_ticks", time_setup); 1018__setup("report_lost_ticks", time_setup);
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index 8bdcbd0aa03f..3ba8fd45fcb3 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -39,7 +39,6 @@ extern void config_acpi_tables(void);
39extern void ia32_syscall(void); 39extern void ia32_syscall(void);
40extern void iommu_hole_init(void); 40extern void iommu_hole_init(void);
41 41
42extern void time_init_gtod(void);
43extern int pmtimer_mark_offset(void); 42extern int pmtimer_mark_offset(void);
44extern void pmtimer_resume(void); 43extern void pmtimer_resume(void);
45extern void pmtimer_wait(unsigned); 44extern void pmtimer_wait(unsigned);