[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] xen: Move tsc reliability check until after CPUs have booted
AMD CPUs by default enable X86_FEATURE_TSC_RELIABLE, and depend upon a later check to disable this feature if TSC drift is detected. Unfortunately, this check is done in time.c:init_xen_time(), which is done before any secondary CPUs are brought up, and is thus guaranteed to succed. This patch moves the check into its own function, and calls it after cpus are brought up. Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx> diff -r 0312575dc35e -r 7aa29ccb231f xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Thu Sep 08 15:13:06 2011 +0100 +++ b/xen/arch/x86/setup.c Thu Sep 15 11:15:52 2011 +0100 @@ -1292,8 +1292,11 @@ printk("Brought up %ld CPUs\n", (long)num_online_cpus()); smp_cpus_done(); + verify_tsc_reliability(); + do_initcalls(); + if ( opt_watchdog ) watchdog_setup(); diff -r 0312575dc35e -r 7aa29ccb231f xen/arch/x86/time.c --- a/xen/arch/x86/time.c Thu Sep 08 15:13:06 2011 +0100 +++ b/xen/arch/x86/time.c Thu Sep 15 11:15:52 2011 +0100 @@ -1450,8 +1450,8 @@ disable_tsc_sync = 1; } -/* Late init function (after interrupts are enabled). */ -int __init init_xen_time(void) +/* Late init function, after all cpus have booted */ +void __init verify_tsc_reliability(void) { if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) ) { @@ -1463,9 +1463,17 @@ */ tsc_check_reliability(); if ( tsc_max_warp ) + { + printk("%s: TSC warp detected, disabling TSC_RELIABLE\n", + __func__); setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE); + } } +} +/* Late init function (after interrupts are enabled). */ +int __init init_xen_time(void) +{ tsc_check_writability(); /* If we have constant-rate TSCs then scale factor can be shared. */ diff -r 0312575dc35e -r 7aa29ccb231f xen/include/xen/time.h --- a/xen/include/xen/time.h Thu Sep 08 15:13:06 2011 +0100 +++ b/xen/include/xen/time.h Thu Sep 15 11:15:52 2011 +0100 @@ -11,6 +11,7 @@ #include <xen/types.h> #include <public/xen.h> +extern void verify_tsc_reliability(void); extern int init_xen_time(void); extern void cstate_restore_tsc(void); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |