[patch 1/2] F00F bug fixup for i386 - use immediate values

From: Mathieu Desnoyers
Date: Fri Jul 13 2007 - 21:32:53 EST


Use the faster immediate values for F00F bug handling in do_page_fault.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx>
---
arch/i386/kernel/traps.c | 4 ++++
arch/i386/mm/fault.c | 3 ++-
include/asm-i386/processor.h | 3 +++
3 files changed, 9 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/arch/i386/kernel/traps.c
===================================================================
--- linux-2.6-lttng.orig/arch/i386/kernel/traps.c 2007-07-13 19:30:53.000000000 -0400
+++ linux-2.6-lttng/arch/i386/kernel/traps.c 2007-07-13 19:31:21.000000000 -0400
@@ -31,6 +31,7 @@
#include <linux/uaccess.h>
#include <linux/nmi.h>
#include <linux/bug.h>
+#include <linux/immediate.h>

#ifdef CONFIG_EISA
#include <linux/ioport.h>
@@ -1158,6 +1159,8 @@
#endif /* CONFIG_MATH_EMULATION */

#ifdef CONFIG_X86_F00F_BUG
+immediate_char_t f00f_bug_fix __read_mostly;
+
void __init trap_init_f00f_bug(void)
{
__set_fixmap(FIX_F00F_IDT, __pa(&idt_table), PAGE_KERNEL_RO);
@@ -1168,6 +1171,7 @@
*/
idt_descr.address = fix_to_virt(FIX_F00F_IDT);
load_idt(&idt_descr);
+ immediate_set_early(&f00f_bug_fix, 1);
}
#endif

Index: linux-2.6-lttng/arch/i386/mm/fault.c
===================================================================
--- linux-2.6-lttng.orig/arch/i386/mm/fault.c 2007-07-13 19:25:38.000000000 -0400
+++ linux-2.6-lttng/arch/i386/mm/fault.c 2007-07-13 19:30:55.000000000 -0400
@@ -25,6 +25,7 @@
#include <linux/kprobes.h>
#include <linux/uaccess.h>
#include <linux/kdebug.h>
+#include <linux/immediate.h>

#include <asm/system.h>
#include <asm/desc.h>
@@ -492,7 +493,7 @@
/*
* Pentium F0 0F C7 C8 bug workaround.
*/
- if (boot_cpu_data.f00f_bug) {
+ immediate_if (&f00f_bug_fix) {
unsigned long nr;

nr = (address - idt_descr.address) >> 3;
Index: linux-2.6-lttng/include/asm-i386/processor.h
===================================================================
--- linux-2.6-lttng.orig/include/asm-i386/processor.h 2007-07-13 19:25:38.000000000 -0400
+++ linux-2.6-lttng/include/asm-i386/processor.h 2007-07-13 19:30:55.000000000 -0400
@@ -21,6 +21,7 @@
#include <asm/percpu.h>
#include <linux/cpumask.h>
#include <linux/init.h>
+#include <linux/immediate.h>
#include <asm/processor-flags.h>

/* flag for disabling the tsc */
@@ -102,6 +103,8 @@
extern struct tss_struct doublefault_tss;
DECLARE_PER_CPU(struct tss_struct, init_tss);

+extern immediate_char_t f00f_bug_fix;
+
#ifdef CONFIG_SMP
extern struct cpuinfo_x86 cpu_data[];
#define current_cpu_data cpu_data[smp_processor_id()]

--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-
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/