]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: Implement support to synchronize RDTSC with LFENCE on Intel CPUs
authorAndi Kleen <ak@suse.de>
Wed, 30 Jan 2008 12:32:37 +0000 (13:32 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:32:37 +0000 (13:32 +0100)
According to Intel RDTSC can be always synchronized with LFENCE
on all current CPUs. Implement the necessary CPUID bit for that.

It is unclear yet if that is true for all future CPUs too,
but if there's another way the kernel can be always updated.

Cc: asit.k.mallick@intel.com
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/setup_64.c
include/asm-x86/cpufeature.h

index e4b7e73e9024a08f06fb0330e5bb693514bf4ef0..0a4abdb61ae4e3a89fd8ed5dbda1f0dd37279e24 100644 (file)
@@ -203,9 +203,10 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
        }
 #endif
 
+       if (cpu_has_xmm)
+               set_bit(X86_FEATURE_LFENCE_RDTSC, c->x86_capability);
        if (c->x86 == 15) {
                set_bit(X86_FEATURE_P4, c->x86_capability);
-               set_bit(X86_FEATURE_SYNC_RDTSC, c->x86_capability);
        }
        if (c->x86 == 6) 
                set_bit(X86_FEATURE_P3, c->x86_capability);
index 2139aa6ac4693bdf92176b1311288d4e2dc22002..bc7758ea06af54644773fd2f03857ca724dcd38b 100644 (file)
@@ -888,10 +888,7 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
                set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
        if (c->x86 == 6)
                set_cpu_cap(c, X86_FEATURE_REP_GOOD);
-       if (c->x86 == 15)
-               set_cpu_cap(c, X86_FEATURE_SYNC_RDTSC);
-       else
-               clear_cpu_cap(c, X86_FEATURE_SYNC_RDTSC);
+       set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
        c->x86_max_cores = intel_num_cpu_cores(c);
 
        srat_detect_node();
index 7d53eea8b9462e6c7b44fc0a15240ca00dddf01a..c1a7e07859c83f4ede0bc0e1af8daac14db5eb08 100644 (file)
@@ -80,6 +80,7 @@
 #define X86_FEATURE_SYNC_RDTSC (3*32+15)  /* RDTSC synchronizes the CPU */
 #define X86_FEATURE_REP_GOOD   (3*32+16) /* rep microcode works well on this CPU */
 #define X86_FEATURE_MFENCE_RDTSC (3*32+17) /* Mfence synchronizes RDTSC */
+#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* Lfence synchronizes RDTSC */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3       (4*32+ 0) /* Streaming SIMD Extensions-3 */