[PATCH] [4/10] MCE: Call 64bit machine check through a call vector

From: Andi Kleen
Date: Mon Jul 07 2008 - 19:11:40 EST



The 32bit mce code still needs that to interface to the WinChip
and P5 machine check handlers. On 64bit it's not strictly needed, but
also doesn't really hurt.

This way avoids some special cases for 32bit.

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

---
arch/x86/kernel/cpu/mcheck/mce_64.c | 9 +++++++++
arch/x86/kernel/entry_64.S | 2 +-
include/asm-x86/mce.h | 2 ++
3 files changed, 12 insertions(+), 1 deletion(-)

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
@@ -317,6 +317,13 @@ void do_machine_check(struct pt_regs * r
atomic_dec(&mce_entry);
}

+static void ignore_machine_check(struct pt_regs *regs, long error_code)
+{
+}
+
+void (*machine_check_vector)(struct pt_regs *regs, long error_code) =
+ ignore_machine_check;
+
#ifdef CONFIG_X86_MCE_INTEL
/***
* mce_log_therm_throt_event - Logs the thermal throttling event to mcelog
@@ -533,6 +540,8 @@ void __cpuinit mcheck_init(struct cpuinf
!mce_available(c))
return;

+ machine_check_vector = do_machine_check;
+
mce_init(NULL);
mce_cpu_features(c);
}
Index: linux/arch/x86/kernel/entry_64.S
===================================================================
--- linux.orig/arch/x86/kernel/entry_64.S
+++ linux/arch/x86/kernel/entry_64.S
@@ -1170,7 +1170,7 @@ ENTRY(machine_check)
INTR_FRAME
pushq $0
CFI_ADJUST_CFA_OFFSET 8
- paranoidentry do_machine_check
+ paranoidentry *machine_check_vector(%rip)
jmp paranoid_exit1
CFI_ENDPROC
END(machine_check)
Index: linux/include/asm-x86/mce.h
===================================================================
--- linux.orig/include/asm-x86/mce.h
+++ linux/include/asm-x86/mce.h
@@ -107,6 +107,8 @@ static inline void mce_amd_feature_init(

void mce_log_therm_throt_event(unsigned int cpu, __u64 status);

+extern void (*machine_check_vector)(struct pt_regs *, long error_code);
+
extern atomic_t mce_entry;

extern void do_machine_check(struct pt_regs *, long);
--
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/