x86, mce: remove machine check handler idle notify on 64bit
[safe/jmp/linux-2.6] / arch / x86 / kernel / cpu / mcheck / mce.c
index 1dcd3be..7562c1f 100644 (file)
 
 #include "mce.h"
 
+/* Handle unconfigured int18 (should never happen) */
+static void unexpected_machine_check(struct pt_regs *regs, long error_code)
+{
+       printk(KERN_ERR "CPU#%d: Unexpected int18 (Machine Check).\n",
+              smp_processor_id());
+}
+
+/* Call the installed machine check handler for this CPU setup. */
+void (*machine_check_vector)(struct pt_regs *, long error_code) =
+                                               unexpected_machine_check;
+
+int                            mce_disabled;
+
 #ifdef CONFIG_X86_64
 
 #define MISC_MCELOG_MINOR      227
 
 atomic_t mce_entry;
 
-static int                     mce_dont_init;
-
 /*
  * Tolerant levels:
  *   0: always panic on uncorrected errors, log corrected errors
@@ -184,7 +195,7 @@ static void mce_panic(char *msg, struct mce *backup, u64 start)
 
 int mce_available(struct cpuinfo_x86 *c)
 {
-       if (mce_dont_init)
+       if (mce_disabled)
                return 0;
        return cpu_has(c, X86_FEATURE_MCE) && cpu_has(c, X86_FEATURE_MCA);
 }
@@ -544,29 +555,6 @@ int mce_notify_user(void)
        return 0;
 }
 
-/* see if the idle task needs to notify userspace: */
-static int
-mce_idle_callback(struct notifier_block *nfb, unsigned long action,
-                 void *unused)
-{
-       /* IDLE_END should be safe - interrupts are back on */
-       if (action == IDLE_END && test_thread_flag(TIF_MCE_NOTIFY))
-               mce_notify_user();
-
-       return NOTIFY_OK;
-}
-
-static struct notifier_block mce_idle_notifier = {
-       .notifier_call          = mce_idle_callback,
-};
-
-static __init int periodic_mcheck_init(void)
-{
-       idle_notifier_register(&mce_idle_notifier);
-       return 0;
-}
-__initcall(periodic_mcheck_init);
-
 /*
  * Initialize Machine Checks for a CPU.
  */
@@ -650,6 +638,12 @@ static void mce_cpu_quirks(struct cpuinfo_x86 *c)
                         */
                        mce_bootlog = 0;
                }
+               /*
+                * Various K7s with broken bank 0 around. Always disable
+                * by default.
+                */
+                if (c->x86 == 6)
+                       bank[0] = 0;
        }
 
        if (c->x86_vendor == X86_VENDOR_INTEL) {
@@ -704,11 +698,13 @@ void __cpuinit mcheck_init(struct cpuinfo_x86 *c)
                return;
 
        if (mce_cap_init() < 0) {
-               mce_dont_init = 1;
+               mce_disabled = 1;
                return;
        }
        mce_cpu_quirks(c);
 
+       machine_check_vector = do_machine_check;
+
        mce_init(NULL);
        mce_cpu_features(c);
        mce_init_timer();
@@ -889,16 +885,6 @@ static struct miscdevice mce_log_device = {
 };
 
 /*
- * Old style boot options parsing. Only for compatibility.
- */
-static int __init mcheck_disable(char *str)
-{
-       mce_dont_init = 1;
-       return 1;
-}
-__setup("nomce", mcheck_disable);
-
-/*
  * mce=off disables machine check
  * mce=TOLERANCELEVEL (number, see above)
  * mce=bootlog Log MCEs from before booting. Disabled by default on AMD.
@@ -907,7 +893,7 @@ __setup("nomce", mcheck_disable);
 static int __init mcheck_enable(char *str)
 {
        if (!strcmp(str, "off"))
-               mce_dont_init = 1;
+               mce_disabled = 1;
        else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog"))
                mce_bootlog = (str[0] == 'b');
        else if (isdigit(str[0]))
@@ -1274,22 +1260,9 @@ device_initcall(mce_init_device);
 
 #else /* CONFIG_X86_32: */
 
-int mce_disabled;
-
 int nr_mce_banks;
 EXPORT_SYMBOL_GPL(nr_mce_banks);       /* non-fatal.o */
 
-/* Handle unconfigured int18 (should never happen) */
-static void unexpected_machine_check(struct pt_regs *regs, long error_code)
-{
-       printk(KERN_ERR "CPU#%d: Unexpected int18 (Machine Check).\n",
-              smp_processor_id());
-}
-
-/* Call the installed machine check handler for this CPU setup. */
-void (*machine_check_vector)(struct pt_regs *, long error_code) =
-                                               unexpected_machine_check;
-
 /* This has to be run for each processor */
 void mcheck_init(struct cpuinfo_x86 *c)
 {
@@ -1321,19 +1294,22 @@ void mcheck_init(struct cpuinfo_x86 *c)
        printk(KERN_INFO "mce: CPU supports %d MCE banks\n", nr_mce_banks);
 }
 
-static int __init mcheck_disable(char *str)
-{
-       mce_disabled = 1;
-       return 1;
-}
-
 static int __init mcheck_enable(char *str)
 {
        mce_disabled = -1;
        return 1;
 }
 
-__setup("nomce", mcheck_disable);
 __setup("mce", mcheck_enable);
 
-#endif /* CONFIG_X86_32 */
+#endif /* CONFIG_X86_OLD_MCE */
+
+/*
+ * Old style boot options parsing. Only for compatibility.
+ */
+static int __init mcheck_disable(char *str)
+{
+       mce_disabled = 1;
+       return 1;
+}
+__setup("nomce", mcheck_disable);