|
|
ce426f |
commit 2702856bf45c82cf8e69f2064f5aa15c0ceb6359
|
|
|
ce426f |
Author: Andrew Senkevich <andrew.senkevich@intel.com>
|
|
|
ce426f |
Date: Mon Dec 19 13:20:31 2016 +0300
|
|
|
ce426f |
|
|
|
ce426f |
Disable TSX on some Haswell processors.
|
|
|
ce426f |
|
|
|
ce426f |
Patch disables Intel TSX on some Haswell processors to avoid TSX
|
|
|
ce426f |
on kernels that weren't updated with the latest microcode package
|
|
|
ce426f |
(which disables broken feature by default).
|
|
|
ce426f |
|
|
|
ce426f |
* sysdeps/x86/cpu-features.c (get_common_indeces): Add
|
|
|
ce426f |
stepping identification.
|
|
|
ce426f |
(init_cpu_features): Add handle of Haswell.
|
|
|
ce426f |
|
|
|
ce426f |
Index: glibc-2.17-c758a686/sysdeps/x86/cpu-features.c
|
|
|
ce426f |
===================================================================
|
|
|
ce426f |
--- glibc-2.17-c758a686.orig/sysdeps/x86/cpu-features.c
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/x86/cpu-features.c
|
|
|
ce426f |
@@ -21,7 +21,8 @@
|
|
|
ce426f |
|
|
|
ce426f |
static inline void
|
|
|
ce426f |
get_common_indeces (struct cpu_features *cpu_features,
|
|
|
ce426f |
- unsigned int *family, unsigned int *model)
|
|
|
ce426f |
+ unsigned int *family, unsigned int *model,
|
|
|
ce426f |
+ unsigned int *stepping)
|
|
|
ce426f |
{
|
|
|
ce426f |
unsigned int eax;
|
|
|
ce426f |
__cpuid (1, eax, cpu_features->cpuid[COMMON_CPUID_INDEX_1].ebx,
|
|
|
ce426f |
@@ -30,6 +31,7 @@ get_common_indeces (struct cpu_features
|
|
|
ce426f |
GLRO(dl_x86_cpu_features).cpuid[COMMON_CPUID_INDEX_1].eax = eax;
|
|
|
ce426f |
*family = (eax >> 8) & 0x0f;
|
|
|
ce426f |
*model = (eax >> 4) & 0x0f;
|
|
|
ce426f |
+ *stepping = eax & 0x0f;
|
|
|
ce426f |
}
|
|
|
ce426f |
|
|
|
ce426f |
static inline void
|
|
|
ce426f |
@@ -45,9 +47,11 @@ init_cpu_features (struct cpu_features *
|
|
|
ce426f |
/* This spells out "GenuineIntel". */
|
|
|
ce426f |
if (ebx == 0x756e6547 && ecx == 0x6c65746e && edx == 0x49656e69)
|
|
|
ce426f |
{
|
|
|
ce426f |
+ unsigned int stepping;
|
|
|
ce426f |
+
|
|
|
ce426f |
kind = arch_kind_intel;
|
|
|
ce426f |
|
|
|
ce426f |
- get_common_indeces (cpu_features, &family, &model);
|
|
|
ce426f |
+ get_common_indeces (cpu_features, &family, &model, &stepping);
|
|
|
ce426f |
|
|
|
ce426f |
/* Intel processors prefer SSE instruction for memory/string
|
|
|
ce426f |
routines if they are available. */
|
|
|
ce426f |
@@ -128,6 +132,20 @@ init_cpu_features (struct cpu_features *
|
|
|
ce426f |
| bit_Fast_Unaligned_Load
|
|
|
ce426f |
| bit_Prefer_PMINUB_for_stringop);
|
|
|
ce426f |
break;
|
|
|
ce426f |
+
|
|
|
ce426f |
+ case 0x3f:
|
|
|
ce426f |
+ /* Xeon E7 v3 with stepping >= 4 has working TSX. */
|
|
|
ce426f |
+ if (stepping >= 4)
|
|
|
ce426f |
+ break;
|
|
|
ce426f |
+ case 0x3c:
|
|
|
ce426f |
+ case 0x45:
|
|
|
ce426f |
+ case 0x46:
|
|
|
ce426f |
+ /* Disable Intel TSX on Haswell processors (except Xeon E7 v3
|
|
|
ce426f |
+ with stepping >= 4) to avoid TSX on kernels that weren't
|
|
|
ce426f |
+ updated with the latest microcode package (which disables
|
|
|
ce426f |
+ broken feature by default). */
|
|
|
ce426f |
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7].ebx &= ~(bit_RTM);
|
|
|
ce426f |
+ break;
|
|
|
ce426f |
}
|
|
|
ce426f |
}
|
|
|
ce426f |
|
|
|
ce426f |
@@ -148,9 +166,11 @@ init_cpu_features (struct cpu_features *
|
|
|
ce426f |
/* This spells out "AuthenticAMD". */
|
|
|
ce426f |
else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65)
|
|
|
ce426f |
{
|
|
|
ce426f |
+ unsigned int stepping;
|
|
|
ce426f |
+
|
|
|
ce426f |
kind = arch_kind_amd;
|
|
|
ce426f |
|
|
|
ce426f |
- get_common_indeces (cpu_features, &family, &model);
|
|
|
ce426f |
+ get_common_indeces (cpu_features, &family, &model, &stepping);
|
|
|
ce426f |
|
|
|
ce426f |
ecx = cpu_features->cpuid[COMMON_CPUID_INDEX_1].ecx;
|
|
|
ce426f |
|