Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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>

authored by

Andi Kleen and committed by
Linus Torvalds
e8b91777 e2c03888

+11 -14
-2
arch/x86_64/kernel/smpboot.c
··· 1152 1152 setup_ioapic_dest(); 1153 1153 #endif 1154 1154 1155 - time_init_gtod(); 1156 - 1157 1155 check_nmi_watchdog(); 1158 1156 } 1159 1157
+11 -11
arch/x86_64/kernel/time.c
··· 48 48 extern void i8254_timer_resume(void); 49 49 extern int using_apic_timer; 50 50 51 + static char *time_init_gtod(void); 52 + 51 53 DEFINE_SPINLOCK(rtc_lock); 52 54 DEFINE_SPINLOCK(i8253_lock); 53 55 ··· 903 901 void __init time_init(void) 904 902 { 905 903 char *timename; 904 + char *gtod; 906 905 907 906 #ifdef HPET_HACK_ENABLE_DANGEROUS 908 907 if (!vxtime.hpet_address) { ··· 948 945 timename = "PIT"; 949 946 } 950 947 951 - printk(KERN_INFO "time.c: Using %ld.%06ld MHz %s timer.\n", 952 - vxtime_hz / 1000000, vxtime_hz % 1000000, timename); 948 + vxtime.mode = VXTIME_TSC; 949 + gtod = time_init_gtod(); 950 + 951 + printk(KERN_INFO "time.c: Using %ld.%06ld MHz WALL %s GTOD %s timer.\n", 952 + vxtime_hz / 1000000, vxtime_hz % 1000000, timename, gtod); 953 953 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", 954 954 cpu_khz / 1000, cpu_khz % 1000); 955 - vxtime.mode = VXTIME_TSC; 956 955 vxtime.quot = (1000000L << 32) / vxtime_hz; 957 956 vxtime.tsc_quot = (1000L << 32) / cpu_khz; 958 957 vxtime.last_tsc = get_cycles_sync(); 959 958 setup_irq(0, &irq0); 960 959 961 960 set_cyc2ns_scale(cpu_khz); 962 - 963 - #ifndef CONFIG_SMP 964 - time_init_gtod(); 965 - #endif 966 961 } 967 962 968 963 /* ··· 982 981 } 983 982 984 983 /* 985 - * Decide after all CPUs are booted what mode gettimeofday should use. 984 + * Decide what mode gettimeofday should use. 986 985 */ 987 - void __init time_init_gtod(void) 986 + __init static char *time_init_gtod(void) 988 987 { 989 988 char *timetype; 990 989 ··· 1012 1011 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC"; 1013 1012 vxtime.mode = VXTIME_TSC; 1014 1013 } 1015 - 1016 - printk(KERN_INFO "time.c: Using %s based timekeeping.\n", timetype); 1014 + return timetype; 1017 1015 } 1018 1016 1019 1017 __setup("report_lost_ticks", time_setup);
-1
include/asm-x86_64/proto.h
··· 39 39 extern void ia32_syscall(void); 40 40 extern void iommu_hole_init(void); 41 41 42 - extern void time_init_gtod(void); 43 42 extern int pmtimer_mark_offset(void); 44 43 extern void pmtimer_resume(void); 45 44 extern void pmtimer_wait(unsigned);