[PATCH] [8/20] x86: Make TIF_MCE_NOTIFY optional

From: Andi Kleen
Date: Wed Jan 02 2008 - 19:52:37 EST



So that we don't have to implement it on 32bit.

I would actually like to remove it on 64bit too.


Signed-off-by: Andi Kleen <ak@xxxxxxx>

---
arch/x86/Kconfig | 5 +++++
arch/x86/kernel/cpu/mcheck/mce_64.c | 16 ++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)

Index: linux/arch/x86/kernel/cpu/mcheck/mce_64.c
===================================================================
--- linux.orig/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ linux/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -148,6 +148,13 @@ static void mce_panic(char *msg, struct
panic(msg);
}

+static void mce_notify_userspace(void)
+{
+#ifdef CONFIG_MCE_NOTIFY
+ set_thread_flag(TIF_MCE_NOTIFY);
+#endif
+}
+
static int mce_available(struct cpuinfo_x86 *c)
{
return cpu_has(c, X86_FEATURE_MCE) && cpu_has(c, X86_FEATURE_MCA);
@@ -305,8 +312,7 @@ void do_machine_check(struct pt_regs * r
}
}

- /* notify userspace ASAP */
- set_thread_flag(TIF_MCE_NOTIFY);
+ mce_notify_userspace();

out:
/* the last thing we do is clear state */
@@ -390,7 +396,9 @@ static void mcheck_timer(struct work_str
*/
int mce_notify_user(void)
{
+#ifdef CONFIG_MCE_NOTIFY
clear_thread_flag(TIF_MCE_NOTIFY);
+#endif
if (test_and_clear_bit(0, &notify_user)) {
static unsigned long last_print;
unsigned long now = jiffies;
@@ -410,6 +418,7 @@ int mce_notify_user(void)
return 0;
}

+#ifdef CONFIG_MCE_NOTIFY
/* see if the idle task needs to notify userspace */
static int
mce_idle_callback(struct notifier_block *nfb, unsigned long action, void *junk)
@@ -424,6 +433,7 @@ mce_idle_callback(struct notifier_block
static struct notifier_block mce_idle_notifier = {
.notifier_call = mce_idle_callback,
};
+#endif

static __init int periodic_mcheck_init(void)
{
@@ -431,7 +441,9 @@ static __init int periodic_mcheck_init(v
if (next_interval)
schedule_delayed_work(&mcheck_work,
round_jiffies_relative(next_interval));
+#ifdef CONFIG_MCE_NOTIFY
idle_notifier_register(&mce_idle_notifier);
+#endif
return 0;
}
__initcall(periodic_mcheck_init);
Index: linux/arch/x86/Kconfig
===================================================================
--- linux.orig/arch/x86/Kconfig
+++ linux/arch/x86/Kconfig
@@ -551,6 +551,11 @@ config X86_MCE
to disable it. MCE support simply ignores non-MCE processors like
the 386 and 486, so nearly everyone can say Y here.

+config MCE_NOTIFY
+ bool
+ default y
+ depends on X86_64
+
config X86_MCE_INTEL
def_bool y
prompt "Intel MCE features"
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/