Skip to contentSkip to conversation

x86/Intel: work around Xeon 7400 series erratum AAI65

PATCH In review Jan Beulich 4 participants 6 messages Mar 5, 2014 – Mar 17, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/Intel: work around Xeon 7400 series erratum AAI65

Linux commit 40e2d7f9b5dae048789c64672bf3027fbb663ffa ("x86 idle:
Repair large-server 50-watt idle-power regression") tells us that this applie snot just to the named Xen 7400 series, but also NHM-EX and WSM-EX; sadly Intel's documentation is so badly searchable that I wasn't able to locate the respective errata (and hence can't quote their numbers here).

xen/arch/x86/acpi/cpu_idle.c +3 -0
@@ -335,6 +335,9 @@ void mwait_idle_with_hints(unsigned int 
     unsigned int cpu = smp_processor_id();
     s_time_t expires = per_cpu(timer_deadline, cpu);
 
+    if ( boot_cpu_has(X86_FEATURE_CLFLUSH_MONITOR) )
+        clflush((void *)&mwait_wakeup(cpu));
+
     __monitor((void *)&mwait_wakeup(cpu), 0, 0);
     smp_mb();
 
xen/arch/x86/cpu/intel.c +7 -0
@@ -147,6 +147,9 @@ void __devinit early_intel_workaround(st
 /*
  * P4 Xeon errata 037 workaround.
  * Hardware prefetcher may cause stale data to be loaded into the cache.
+ *
+ * Xeon 7400 erratum AAI65 (and further newer Xeons)
+ * MONITOR/MWAIT may have excessive false wakeups
  */
 static void __devinit Intel_errata_workarounds(struct cpuinfo_x86 *c)
 {
@@ -161,6 +164,10 @@ static void __devinit Intel_errata_worka
 			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
 		}
 	}
+
+	if (c->x86 == 6 && cpu_has_clflush &&
+	    (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
+		set_bit(X86_FEATURE_CLFLUSH_MONITOR, c->x86_capability);
 }
 
 
xen/include/asm-x86/cpufeature.h +1 -0
@@ -71,6 +71,7 @@
 #define X86_FEATURE_TSC_RELIABLE (3*32+12) /* TSC is known to be reliable */
 #define X86_FEATURE_XTOPOLOGY    (3*32+13) /* cpu topology enum extensions */
 #define X86_FEATURE_CPUID_FAULTING (3*32+14) /* cpuid faulting */
+#define X86_FEATURE_CLFLUSH_MONITOR (3*32+15) /* clflush reqd with monitor */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3	(4*32+ 0) /* Streaming SIMD Extensions-3 */

x86/Intel: work around Xeon 7400 series erratum AAI65

Linux commit 40e2d7f9b5dae048789c64672bf3027fbb663ffa ("x86 idle:
Repair large-server 50-watt idle-power regression") tells us that this applie snot just to the named Xen 7400 series, but also NHM-EX and WSM-EX; sadly Intel's documentation is so badly searchable that I wasn't able to locate the respective errata (and hence can't quote their numbers here).

xen/arch/x86/acpi/cpu_idle.c +3 -0
@@ -335,6 +335,9 @@ void mwait_idle_with_hints(unsigned int 
     unsigned int cpu = smp_processor_id();
     s_time_t expires = per_cpu(timer_deadline, cpu);
 
+    if ( boot_cpu_has(X86_FEATURE_CLFLUSH_MONITOR) )
+        clflush((void *)&mwait_wakeup(cpu));
+
     __monitor((void *)&mwait_wakeup(cpu), 0, 0);
     smp_mb();
 
xen/arch/x86/cpu/intel.c +7 -0
@@ -147,6 +147,9 @@ void __devinit early_intel_workaround(st
 /*
  * P4 Xeon errata 037 workaround.
  * Hardware prefetcher may cause stale data to be loaded into the cache.
+ *
+ * Xeon 7400 erratum AAI65 (and further newer Xeons)
+ * MONITOR/MWAIT may have excessive false wakeups
  */
 static void __devinit Intel_errata_workarounds(struct cpuinfo_x86 *c)
 {
@@ -161,6 +164,10 @@ static void __devinit Intel_errata_worka
 			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
 		}
 	}
+
+	if (c->x86 == 6 && cpu_has_clflush &&
+	    (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
+		set_bit(X86_FEATURE_CLFLUSH_MONITOR, c->x86_capability);
 }
 
 
xen/include/asm-x86/cpufeature.h +1 -0
@@ -71,6 +71,7 @@
 #define X86_FEATURE_TSC_RELIABLE (3*32+12) /* TSC is known to be reliable */
 #define X86_FEATURE_XTOPOLOGY    (3*32+13) /* cpu topology enum extensions */
 #define X86_FEATURE_CPUID_FAULTING (3*32+14) /* cpuid faulting */
+#define X86_FEATURE_CLFLUSH_MONITOR (3*32+15) /* clflush reqd with monitor */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3	(4*32+ 0) /* Streaming SIMD Extensions-3 */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 3 lines · Jan Beulich

Linux commit 40e2d7f9b5dae048789c64672bf3027fbb663ffa ("x86 idle:
Repair large-server 50-watt idle-power regression") tells us that this applie snot just to the named Xen 7400 series, but also NHM-EX and

                                ^^^

I guess that should say Xeon, not Xen..

-- Pasi

Quoted 6 lines

WSM-EX; sadly Intel's documentation is so badly searchable that I wasn't able to locate the respective errata (and hence can't quote their numbers here).

#2 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Pasi Kärkkäinen
Quoted 3 lines · Jan Beulich

Linux commit 40e2d7f9b5dae048789c64672bf3027fbb663ffa ("x86 idle:
Repair large-server 50-watt idle-power regression") tells us that this applie snot just to the named Xen 7400 series, but also NHM-EX and

                                ^^^

I guess that should say Xeon, not Xen..

Oops, of course. Fixed (also the other typo on that same line).

Thanks, Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
In reply to Jan Beulich
Quoted 3 lines · Jan Beulich

Linux commit 40e2d7f9b5dae048789c64672bf3027fbb663ffa ("x86 idle:
Repair large-server 50-watt idle-power regression") tells us that this applie snot just to the named Xen 7400 series, but also NHM-EX and

"applies not" "named Xeon 7400 series"

Quoted 5 lines

WSM-EX; sadly Intel's documentation is so badly searchable that I wasn't able to locate the respective errata (and hence can't quote their numbers here).

content Reviewed-by: Andrew Cooper <[email protected]>

Quoted 51 lines
xen/arch/x86/acpi/cpu_idle.c +3 -0
@@ -335,6 +335,9 @@ void mwait_idle_with_hints(unsigned int 
     unsigned int cpu = smp_processor_id();
     s_time_t expires = per_cpu(timer_deadline, cpu);
 
+    if ( boot_cpu_has(X86_FEATURE_CLFLUSH_MONITOR) )
+        clflush((void *)&mwait_wakeup(cpu));
+
     __monitor((void *)&mwait_wakeup(cpu), 0, 0);
     smp_mb();
 
xen/arch/x86/cpu/intel.c +7 -0
@@ -147,6 +147,9 @@ void __devinit early_intel_workaround(st
 /*
  * P4 Xeon errata 037 workaround.
  * Hardware prefetcher may cause stale data to be loaded into the cache.
+ *
+ * Xeon 7400 erratum AAI65 (and further newer Xeons)
+ * MONITOR/MWAIT may have excessive false wakeups
  */
 static void __devinit Intel_errata_workarounds(struct cpuinfo_x86 *c)
 {
@@ -161,6 +164,10 @@ static void __devinit Intel_errata_worka
 			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
 		}
 	}
+
+	if (c->x86 == 6 && cpu_has_clflush &&
+	    (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
+		set_bit(X86_FEATURE_CLFLUSH_MONITOR, c->x86_capability);
 }
 
 
xen/include/asm-x86/cpufeature.h +1 -0
@@ -71,6 +71,7 @@
 #define X86_FEATURE_TSC_RELIABLE (3*32+12) /* TSC is known to be reliable */
 #define X86_FEATURE_XTOPOLOGY    (3*32+13) /* cpu topology enum extensions */
 #define X86_FEATURE_CPUID_FAULTING (3*32+14) /* cpuid faulting */
+#define X86_FEATURE_CLFLUSH_MONITOR (3*32+15) /* clflush reqd with monitor */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3	(4*32+ 0) /* Streaming SIMD Extensions-3 */
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw

Ping: [PATCH] x86/Intel: work around Xeon 7400 series erratum AAI65

In reply to Jan Beulich
Quoted 55 lines
Quoted 1 line
Quoted 1 line · Jan Beulich

Linux commit 40e2d7f9b5dae048789c64672bf3027fbb663ffa ("x86 idle:
Repair large-server 50-watt idle-power regression") tells us that this applie snot just to the named Xen 7400 series, but also NHM-EX and WSM-EX; sadly Intel's documentation is so badly searchable that I wasn't able to locate the respective errata (and hence can't quote their numbers here).

xen/arch/x86/acpi/cpu_idle.c +3 -0
@@ -335,6 +335,9 @@ void mwait_idle_with_hints(unsigned int 
     unsigned int cpu = smp_processor_id();
     s_time_t expires = per_cpu(timer_deadline, cpu);
 
+    if ( boot_cpu_has(X86_FEATURE_CLFLUSH_MONITOR) )
+        clflush((void *)&mwait_wakeup(cpu));
+
     __monitor((void *)&mwait_wakeup(cpu), 0, 0);
     smp_mb();
 
xen/arch/x86/cpu/intel.c +7 -0
@@ -147,6 +147,9 @@ void __devinit early_intel_workaround(st
 /*
  * P4 Xeon errata 037 workaround.
  * Hardware prefetcher may cause stale data to be loaded into the cache.
+ *
+ * Xeon 7400 erratum AAI65 (and further newer Xeons)
+ * MONITOR/MWAIT may have excessive false wakeups
  */
 static void __devinit Intel_errata_workarounds(struct cpuinfo_x86 *c)
 {
@@ -161,6 +164,10 @@ static void __devinit Intel_errata_worka
 			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
 		}
 	}
+
+	if (c->x86 == 6 && cpu_has_clflush &&
+	    (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
+		set_bit(X86_FEATURE_CLFLUSH_MONITOR, c->x86_capability);
 }
 
 
xen/include/asm-x86/cpufeature.h +1 -0
@@ -71,6 +71,7 @@
 #define X86_FEATURE_TSC_RELIABLE (3*32+12) /* TSC is known to be reliable */
 #define X86_FEATURE_XTOPOLOGY    (3*32+13) /* cpu topology enum extensions */
 #define X86_FEATURE_CPUID_FAULTING (3*32+14) /* cpuid faulting */
+#define X86_FEATURE_CLFLUSH_MONITOR (3*32+15) /* clflush reqd with monitor */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3	(4*32+ 0) /* Streaming SIMD Extensions-3 */
Acked-by
#5 lore raw

Re: Ping: [PATCH] x86/Intel: work around Xeon 7400 series erratum AAI65

Quoted 12 lines

From: Jan Beulich
Sent: Wednesday, March 12, 2014 5:40 PM

Quoted 9 lines
Quoted 1 line
Quoted 1 line · Jan Beulich

Linux commit 40e2d7f9b5dae048789c64672bf3027fbb663ffa ("x86 idle:
Repair large-server 50-watt idle-power regression") tells us that this applie snot just to the named Xen 7400 series, but also NHM-EX and WSM-EX; sadly Intel's documentation is so badly searchable that I wasn't able to locate the respective errata (and hence can't quote their numbers here).

Quoted 59 lines
Quoted 26 lines
xen/arch/x86/acpi/cpu_idle.c +3 -0
@@ -335,6 +335,9 @@ void mwait_idle_with_hints(unsigned int
     unsigned int cpu = smp_processor_id();
     s_time_t expires = per_cpu(timer_deadline, cpu);
 
+    if ( boot_cpu_has(X86_FEATURE_CLFLUSH_MONITOR) )
+        clflush((void *)&mwait_wakeup(cpu));
+
     __monitor((void *)&mwait_wakeup(cpu), 0, 0);
     smp_mb();
 
xen/arch/x86/cpu/intel.c +3 -0
@@ -147,6 +147,9 @@ void __devinit early_intel_workaround(st
 /*
  * P4 Xeon errata 037 workaround.
  * Hardware prefetcher may cause stale data to be loaded into the cache.
+ *
+ * Xeon 7400 erratum AAI65 (and further newer Xeons)
+ * MONITOR/MWAIT may have excessive false wakeups
  */
 static void __devinit Intel_errata_workarounds(struct cpuinfo_x86 *c)
 {

xen/arch/x86/cpu/intel.c static void __devinit Intel_errata_worka · line 169

Quoted 6 lines
xen/arch/x86/cpu/intel.c +3 -0
@@ -161,6 +164,10 @@ static void __devinit Intel_errata_worka
 			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
 		}
 	}
+
+	if (c->x86 == 6 && cpu_has_clflush &&
+	    (c->x86_model == 29 || c->x86_model == 46 || c->x86_model ==

47))

xen/include/asm-x86/cpufeature.h line 71

Quoted 8 lines
xen/arch/x86/cpu/intel.c +1 -0
+		set_bit(X86_FEATURE_CLFLUSH_MONITOR, c->x86_capability);
 }
 
 
xen/include/asm-x86/cpufeature.h +0 -0
@@ -71,6 +71,7 @@
 #define X86_FEATURE_TSC_RELIABLE (3*32+12) /* TSC is known to be

reliable */

xen/include/asm-x86/cpufeature.h line 72

Quoted 1 line
xen/include/asm-x86/cpufeature.h +0 -0
 #define X86_FEATURE_XTOPOLOGY    (3*32+13) /* cpu topology enum

extensions */

xen/include/asm-x86/cpufeature.h line 74

Quoted 2 lines
xen/include/asm-x86/cpufeature.h +1 -0
 #define X86_FEATURE_CPUID_FAULTING (3*32+14) /* cpuid faulting */
+#define X86_FEATURE_CLFLUSH_MONITOR (3*32+15) /* clflush reqd with

monitor */

xen/include/asm-x86/cpufeature.h line 76

Quoted 3 lines
xen/include/asm-x86/cpufeature.h +0 -0
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3	(4*32+ 0) /* Streaming SIMD Extensions-3

*/

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel