diff options
author | Andi Kleen <ak@suse.de> | 2006-02-25 22:18:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-26 12:53:31 -0500 |
commit | e8b917775b572bc27de105f1317c2de4335db5b3 (patch) | |
tree | 940351af2d1690331d82a65331acf34254621936 /arch/x86_64 | |
parent | e2c0388866dc12bef56b178b958f9b778fe6c687 (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>
Diffstat (limited to 'arch/x86_64')
-rw-r--r-- | arch/x86_64/kernel/smpboot.c | 2 | ||||
-rw-r--r-- | arch/x86_64/kernel/time.c | 22 |
2 files changed, 11 insertions, 13 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); | |||
48 | extern void i8254_timer_resume(void); | 48 | extern void i8254_timer_resume(void); |
49 | extern int using_apic_timer; | 49 | extern int using_apic_timer; |
50 | 50 | ||
51 | static char *time_init_gtod(void); | ||
52 | |||
51 | DEFINE_SPINLOCK(rtc_lock); | 53 | DEFINE_SPINLOCK(rtc_lock); |
52 | DEFINE_SPINLOCK(i8253_lock); | 54 | DEFINE_SPINLOCK(i8253_lock); |
53 | 55 | ||
@@ -901,6 +903,7 @@ static struct irqaction irq0 = { | |||
901 | void __init time_init(void) | 903 | void __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 | */ |
986 | void __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); |