x86: sanity check APIC timer frequency
authorThomas Gleixner <tglx@linutronix.de>
Wed, 30 Jan 2008 12:33:04 +0000 (13:33 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:33:04 +0000 (13:33 +0100)
Check the APIC timer calibration result for sanity. When the frequency
is out of range, issue a warning and disable the local APIC timer.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/apic_32.c
arch/x86/kernel/apic_64.c

index cbcf72cde956f4d9494ebaab30d5a0ee6b3948ba..20d4dbc42e6ef2ce54fbdf8d668bf3f0bc9f4460 100644 (file)
@@ -470,6 +470,19 @@ void __init setup_boot_APIC_clock(void)
 
        local_apic_timer_verify_ok = 1;
 
+       /*
+        * Do a sanity check on the APIC calibration result
+        */
+       if (calibration_result < (1000000 / HZ)) {
+               local_irq_enable();
+               printk(KERN_WARNING
+                      "APIC frequency too slow, disabling apic timer\n");
+               /* No broadcast on UP ! */
+               if (num_possible_cpus() > 1)
+                       setup_APIC_timer();
+               return;
+       }
+
        /* We trust the pm timer based calibration */
        if (!pm_referenced) {
                apic_printk(APIC_VERBOSE, "... verify APIC timer\n");
index d1a696673d9d7132f5bf0729bae111b5c73a4c1d..731b48660fc4385249fb305afbbe023947331785 100644 (file)
@@ -383,6 +383,18 @@ void __init setup_boot_APIC_clock(void)
        printk(KERN_INFO "Using local APIC timer interrupts.\n");
        calibrate_APIC_clock();
 
+       /*
+        * Do a sanity check on the APIC calibration result
+        */
+       if (calibration_result < (1000000 / HZ)) {
+               printk(KERN_WARNING
+                      "APIC frequency too slow, disabling apic timer\n");
+               /* No broadcast on UP ! */
+               if (num_possible_cpus() > 1)
+                       setup_APIC_timer();
+               return;
+       }
+
        /*
         * If nmi_watchdog is set to IO_APIC, we need the
         * PIT/HPET going.  Otherwise register lapic as a dummy