olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone
077c9d
commit c3d8dc45c9df199b8334599a6cbd98c9950dba62
077c9d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
077c9d
Date:   Thu Oct 11 15:18:40 2018 -0300
077c9d
077c9d
    x86: Fix Haswell strong flags (BZ#23709)
077c9d
    
077c9d
    Th commit 'Disable TSX on some Haswell processors.' (2702856bf4) changed the
077c9d
    default flags for Haswell models.  Previously, new models were handled by the
077c9d
    default switch path, which assumed a Core i3/i5/i7 if AVX is available. After
077c9d
    the patch, Haswell models (0x3f, 0x3c, 0x45, 0x46) do not set the flags
077c9d
    Fast_Rep_String, Fast_Unaligned_Load, Fast_Unaligned_Copy, and
077c9d
    Prefer_PMINUB_for_stringop (only the TSX one).
077c9d
    
077c9d
    This patch fixes it by disentangle the TSX flag handling from the memory
077c9d
    optimization ones.  The strstr case cited on patch now selects the
077c9d
    __strstr_sse2_unaligned as expected for the Haswell cpu.
077c9d
    
077c9d
    Checked on x86_64-linux-gnu.
077c9d
    
077c9d
            [BZ #23709]
077c9d
            * sysdeps/x86/cpu-features.c (init_cpu_features): Set TSX bits
077c9d
            independently of other flags.
077c9d
077c9d
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
077c9d
index ea0b64fdb962a934..4695ac80d4148327 100644
077c9d
--- a/sysdeps/x86/cpu-features.c
077c9d
+++ b/sysdeps/x86/cpu-features.c
077c9d
@@ -316,7 +316,13 @@ init_cpu_features (struct cpu_features *cpu_features)
077c9d
 		    | bit_arch_Fast_Unaligned_Copy
077c9d
 		    | bit_arch_Prefer_PMINUB_for_stringop);
077c9d
 	      break;
077c9d
+	    }
077c9d
 
077c9d
+	 /* Disable TSX on some Haswell processors to avoid TSX on kernels that
077c9d
+	    weren't updated with the latest microcode package (which disables
077c9d
+	    broken feature by default).  */
077c9d
+	 switch (model)
077c9d
+	    {
077c9d
 	    case 0x3f:
077c9d
 	      /* Xeon E7 v3 with stepping >= 4 has working TSX.  */
077c9d
 	      if (stepping >= 4)