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