< prev index next >

src/hotspot/cpu/ppc/vm_version_ppc.cpp

Print this page
rev 50225 : PPC64: Fix jtreg RTM tests after "8203305: Improve TM detection for enabling RTM on Linux / POWER9"

@@ -129,11 +129,11 @@
 #endif
 
   // Create and print feature-string.
   char buf[(num_features+1) * 16]; // Max 16 chars per feature.
   jio_snprintf(buf, sizeof(buf),
-               "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+               "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                (has_fsqrt()   ? " fsqrt"   : ""),
                (has_isel()    ? " isel"    : ""),
                (has_lxarxeh() ? " lxarxeh" : ""),
                (has_cmpb()    ? " cmpb"    : ""),
                //(has_mftgpr()? " mftgpr"  : ""),

@@ -146,11 +146,12 @@
                (has_vpmsumb() ? " vpmsumb" : ""),
                (has_mfdscr()  ? " mfdscr"  : ""),
                (has_vsx()     ? " vsx"     : ""),
                (has_ldbrx()   ? " ldbrx"   : ""),
                (has_stdbrx()  ? " stdbrx"  : ""),
-               (has_vshasig() ? " sha"     : "")
+               (has_vshasig() ? " sha"     : ""),
+               (has_tm()      ? " rtm"     : "")
                // Make sure number of %s matches num_features!
               );
   _features_string = os::strdup(buf);
   if (Verbose) {
     print_features();

@@ -317,39 +318,12 @@
     // VM_Version_init() is executed after UseBiasedLocking is used
     // in Thread::allocate().
     if (PowerArchitecturePPC64 < 8) {
       vm_exit_during_initialization("RTM instructions are not available on this CPU.");
     }
-    bool os_support_tm = false;
-#ifdef AIX
-    // Actually, this is supported since AIX 7.1.. Unfortunately, this first
-    // contained bugs, so that it can only be enabled after AIX 7.1.3.30.
-    // The Java property os.version, which is used in RTM tests to decide
-    // whether the feature is available, only knows major and minor versions.
-    // We don't want to change this property, as user code might depend on it.
-    // So the tests can not check on subversion 3.30, and we only enable RTM
-    // with AIX 7.2.
-    if (os::Aix::os_version() >= 0x07020000) { // At least AIX 7.2.
-      os_support_tm = true;
-    }
-#endif
-#if defined(LINUX) && defined(VM_LITTLE_ENDIAN)
-    unsigned long auxv = getauxval(AT_HWCAP2);
 
-    if (auxv & PPC_FEATURE2_HTM_NOSC) {
-      if (auxv & PPC_FEATURE2_HAS_HTM) {
-        // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
-        // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
-        // POWER9 DD2.1 NV has a few issues that need a couple of firmware
-        // and kernel workarounds, so there is a new mode only supported
-        // on non-virtualized P9 machines called HTM with no Suspend Mode).
-        // TM on POWER9 D2.2+ NV is not supported at all by Linux.
-        os_support_tm = true;
-      }
-    }
-#endif
-    if (!os_support_tm) {
+    if (!has_tm()) {
       vm_exit_during_initialization("RTM is not supported on this OS version.");
     }
   }
 
   if (UseRTMLocking) {

@@ -752,10 +726,38 @@
     ttyLocker ttyl;
     tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " after execution:", p2i(code));
     Disassembler::decode((u_char*)code, (u_char*)code_end, tty);
   }
 
+#ifdef AIX
+  // Actually, this is supported since AIX 7.1.. Unfortunately, this first
+  // contained bugs, so that it can only be enabled after AIX 7.1.3.30.
+  // The Java property os.version, which is used in RTM tests to decide
+  // whether the feature is available, only knows major and minor versions.
+  // We don't want to change this property, as user code might depend on it.
+  // So the tests can not check on subversion 3.30, and we only enable RTM
+  // with AIX 7.2.
+  if (os::Aix::os_version() >= 0x07020000) { // At least AIX 7.2.
+    features |= rtm_m;
+  }
+#endif
+#if defined(LINUX) && defined(VM_LITTLE_ENDIAN)
+  unsigned long auxv = getauxval(AT_HWCAP2);
+
+  if (auxv & PPC_FEATURE2_HTM_NOSC) {
+    if (auxv & PPC_FEATURE2_HAS_HTM) {
+      // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+      // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+      // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+      // and kernel workarounds, so there is a new mode only supported
+      // on non-virtualized P9 machines called HTM with no Suspend Mode).
+      // TM on POWER9 D2.2+ NV is not supported at all by Linux.
+      features |= rtm_m;
+    }
+  }
+#endif
+
   _features = features;
 }
 
 // Power 8: Configure Data Stream Control Register.
 void VM_Version::config_dscr() {
< prev index next >