[PATCH] x86: Log reason why TSC was marked unstable
authorjohn stultz <johnstul@us.ibm.com>
Wed, 2 May 2007 17:27:08 +0000 (19:27 +0200)
committerAndi Kleen <andi@basil.nowhere.org>
Wed, 2 May 2007 17:27:08 +0000 (19:27 +0200)
Change mark_tsc_unstable() so it takes a string argument, which holds the
reason the TSC was marked unstable.

This is then displayed the first time mark_tsc_unstable is called.

This should help us better debug why the TSC was marked unstable on certain
systems and allow us to make sure we're not being overly paranoid when
throwing out this troublesome clocksource.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
arch/i386/kernel/cpu/cyrix.c
arch/i386/kernel/tsc.c
arch/x86_64/kernel/time.c
arch/x86_64/kernel/tsc.c
arch/x86_64/kernel/tsc_sync.c
drivers/acpi/processor_idle.c
include/asm-i386/mach-summit/mach_mpparse.h
include/asm-i386/tsc.h
include/asm-x86_64/timex.h

index f0badfdd4e45485373a3b165c940b6600fe31f55..e77f8e1cf7aae4755ef767e2b6aa277f1da0ed0a 100644 (file)
@@ -279,7 +279,7 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
                 */  
                if (vendor == PCI_VENDOR_ID_CYRIX &&
         (device == PCI_DEVICE_ID_CYRIX_5510 || device == PCI_DEVICE_ID_CYRIX_5520))
-                       mark_tsc_unstable();
+                       mark_tsc_unstable("cyrix 5510/5520 detected");
        }
 #endif
                c->x86_cache_size=16;   /* Yep 16K integrated cache thats it */
index 6cb8f53367324c46fc5efcdc070afb5f02c01add..755209dc93e1beba498e176c0483eb04d4cc4628 100644 (file)
@@ -233,7 +233,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data)
                                 * TSC based sched_clock turns
                                 * to junk w/ cpufreq
                                 */
-                               mark_tsc_unstable();
+                               mark_tsc_unstable("cpufreq changes");
                        }
                }
        }
@@ -281,11 +281,12 @@ static struct clocksource clocksource_tsc = {
                                  CLOCK_SOURCE_MUST_VERIFY,
 };
 
-void mark_tsc_unstable(void)
+void mark_tsc_unstable(char *reason)
 {
        if (!tsc_unstable) {
                tsc_unstable = 1;
                tsc_enabled = 0;
+               printk("Marking TSC unstable due to: %s.\n", reason);
                /* Can be called before registration */
                if (clocksource_tsc.mult)
                        clocksource_change_rating(&clocksource_tsc, 0);
index 5f862e216a4228ee021259ff1daeaa06265edc21..91c9066a380dac832bc8d9bcf0f045a180ae338a 100644 (file)
@@ -397,7 +397,7 @@ void __init time_init(void)
                cpu_khz = tsc_calibrate_cpu_khz();
 
        if (unsynchronized_tsc())
-               mark_tsc_unstable();
+               mark_tsc_unstable("TSCs unsynchronized");
 
        if (cpu_has(&boot_cpu_data, X86_FEATURE_RDTSCP))
                vgetcpu_mode = VGETCPU_RDTSCP;
index 5c84992c676d9844ae10652b8dbc7744421da764..48f9a8e6aa91ff3b22f08f514f487ffc0305558d 100644 (file)
@@ -111,7 +111,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
 
                tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new);
                if (!(freq->flags & CPUFREQ_CONST_LOOPS))
-                       mark_tsc_unstable();
+                       mark_tsc_unstable("cpufreq changes");
        }
 
        set_cyc2ns_scale(tsc_khz_ref);
@@ -199,10 +199,11 @@ static struct clocksource clocksource_tsc = {
        .vread                  = vread_tsc,
 };
 
-void mark_tsc_unstable(void)
+void mark_tsc_unstable(char *reason)
 {
        if (!tsc_unstable) {
                tsc_unstable = 1;
+               printk("Marking TSC unstable due to %s\n", reason);
                /* Change only the rating, when not registered */
                if (clocksource_tsc.mult)
                        clocksource_change_rating(&clocksource_tsc, 0);
index 72d444dede9b1c269a93b1c0a05609a596fbd592..355f5f506c8133d2a97108ae211f52839199510b 100644 (file)
@@ -138,7 +138,7 @@ void __cpuinit check_tsc_sync_source(int cpu)
                printk("\n");
                printk(KERN_WARNING "Measured %Ld cycles TSC warp between CPUs,"
                                    " turning off TSC clock.\n", max_warp);
-               mark_tsc_unstable();
+               mark_tsc_unstable("check_tsc_sync_source failed");
                nr_warps = 0;
                max_warp = 0;
                last_tsc = 0;
index ae0654cd11eaa58bcf3fff763e2cd3d341004a44..ee5759bef9454df682d7520032e8c33f5bfbc0b8 100644 (file)
@@ -475,7 +475,7 @@ static void acpi_processor_idle(void)
 
 #ifdef CONFIG_GENERIC_TIME
                /* TSC halts in C2, so notify users */
-               mark_tsc_unstable();
+               mark_tsc_unstable("possible TSC halt in C2");
 #endif
                /* Re-enable interrupts */
                local_irq_enable();
@@ -517,7 +517,7 @@ static void acpi_processor_idle(void)
 
 #ifdef CONFIG_GENERIC_TIME
                /* TSC halts in C3, so notify users */
-               mark_tsc_unstable();
+               mark_tsc_unstable("TSC halts in C3");
 #endif
                /* Re-enable interrupts */
                local_irq_enable();
index 94268399170de77aadeb11714a0c922d2d3f9e78..c2520539d934b68db8ab624be44311231bb23697 100644 (file)
@@ -30,7 +30,7 @@ static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
                        (!strncmp(productid, "VIGIL SMP", 9) 
                         || !strncmp(productid, "EXA", 3)
                         || !strncmp(productid, "RUTHLESS SMP", 12))){
-               mark_tsc_unstable();
+               mark_tsc_unstable("Summit based system");
                use_cyclone = 1; /*enable cyclone-timer*/
                setup_summit();
                return 1;
@@ -44,7 +44,7 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
        if (!strncmp(oem_id, "IBM", 3) &&
            (!strncmp(oem_table_id, "SERVIGIL", 8)
             || !strncmp(oem_table_id, "EXA", 3))){
-               mark_tsc_unstable();
+               mark_tsc_unstable("Summit based system");
                use_cyclone = 1; /*enable cyclone-timer*/
                setup_summit();
                return 1;
index 84016ff481b9d2e5df72a2e8bb7411088d971d53..346976632e15f586e1615a545460c23079fdc7bc 100644 (file)
@@ -53,7 +53,7 @@ static __always_inline cycles_t get_cycles_sync(void)
 }
 
 extern void tsc_init(void);
-extern void mark_tsc_unstable(void);
+extern void mark_tsc_unstable(char *reason);
 extern int unsynchronized_tsc(void);
 extern void init_tsc_clocksource(void);
 
index 8c6808a3fba443ab74770b526997fd8a6ea0b447..f6527e1b6c1c68eff886a54bc9ff860b48e85b7e 100644 (file)
@@ -27,6 +27,6 @@ extern int read_current_timer(unsigned long *timer_value);
 #define NS_SCALE        10 /* 2^10, carefully chosen */
 #define US_SCALE        32 /* 2^32, arbitralrily chosen */
 
-extern void mark_tsc_unstable(void);
+extern void mark_tsc_unstable(char *msg);
 extern void set_cyc2ns_scale(unsigned long khz);
 #endif