aboutsummaryrefslogtreecommitdiff
path: root/libitm/config/x86
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2017-01-18 20:22:02 +0000
committerTorvald Riegel <torvald@gcc.gnu.org>2017-01-18 20:22:02 +0000
commitf8a94453adfa8ccf1243c5a388e8bdb12e5decb4 (patch)
treea570e6248bee46a42e3612e3408cef9a3d26518a /libitm/config/x86
parentb7d3a6a6b26c6992900a4a6d87bb4d92b1590474 (diff)
downloadgcc-f8a94453adfa8ccf1243c5a388e8bdb12e5decb4.zip
gcc-f8a94453adfa8ccf1243c5a388e8bdb12e5decb4.tar.gz
gcc-f8a94453adfa8ccf1243c5a388e8bdb12e5decb4.tar.bz2
libitm: Disable TSX on processors on which it may be broken.
libitm/ChangeLog * config/x86/target.h (htm_available): Add check for some processors on which TSX is broken. From-SVN: r244594
Diffstat (limited to 'libitm/config/x86')
-rw-r--r--libitm/config/x86/target.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/libitm/config/x86/target.h b/libitm/config/x86/target.h
index 8d0a0da..665c7d6 100644
--- a/libitm/config/x86/target.h
+++ b/libitm/config/x86/target.h
@@ -78,6 +78,28 @@ htm_available ()
if (__get_cpuid_max (0, NULL) >= 7)
{
unsigned a, b, c, d;
+ /* TSX is broken on some processors. This can be fixed by microcode,
+ but we cannot reliably detect whether the microcode has been
+ updated. Therefore, do not report availability of TSX on these
+ processors. We use the same approach here as in glibc (see
+ https://sourceware.org/ml/libc-alpha/2016-12/msg00470.html). */
+ __cpuid (0, a, b, c, d);
+ if (b == 0x756e6547 && c == 0x6c65746e && d == 0x49656e69)
+ {
+ __cpuid (1, a, b, c, d);
+ if (((a >> 8) & 0x0f) == 0x06) // Family.
+ {
+ unsigned model = ((a >> 4) & 0x0f) // Model.
+ + ((a >> 12) & 0xf0); // Extended model.
+ unsigned stepping = a & 0x0f;
+ if ((model == 0x3c)
+ || (model == 0x45)
+ || (model == 0x46)
+ /* Xeon E7 v3 has correct TSX if stepping >= 4. */
+ || ((model == 0x3f) && (stepping < 4)))
+ return false;
+ }
+ }
__cpuid_count (7, 0, a, b, c, d);
if (b & cpuid_rtm)
return true;