8165482: java in ldoms, with cpu-arch=generic has problems
authormwalsh
Mon, 17 Oct 2016 19:12:28 -0400
changeset 41706 eb0fab7b44af
parent 41705 332239c052cc
child 41707 7a8490836761
8165482: java in ldoms, with cpu-arch=generic has problems Reviewed-by: dholmes, alanbur
hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Mon Oct 17 18:54:12 2016 -0400
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Mon Oct 17 19:12:28 2016 -0400
@@ -179,7 +179,7 @@
   assert((OptoLoopAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
 
   char buf[512];
-  jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+  jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                (has_v9() ? ", v9" : (has_v8() ? ", v8" : "")),
                (has_hardware_popc() ? ", popc" : ""),
                (has_vis1() ? ", vis1" : ""),
@@ -193,6 +193,7 @@
                (has_sha512() ? ", sha512" : ""),
                (has_crc32c() ? ", crc32c" : ""),
                (is_ultra3() ? ", ultra3" : ""),
+               (has_sparc5_instr() ? ", sparc5" : ""),
                (is_sun4v() ? ", sun4v" : ""),
                (is_niagara_plus() ? ", niagara_plus" : (is_niagara() ? ", niagara" : "")),
                (is_sparc64() ? ", sparc64" : ""),
@@ -487,16 +488,11 @@
     if (strstr(impl, "SPARC-T1") != NULL) {
       features |= T1_model_m;
     }
+  } else if (strstr(impl, "SUN4V-CPU") != NULL) {
+    // Generic or migration class LDOM
+    features |= T_family_m;
   } else {
-    if (strstr(impl, "SPARC") == NULL) {
-#ifndef PRODUCT
-      // kstat on Solaris 8 virtual machines (branded zones)
-      // returns "(unsupported)" implementation. Solaris 8 is not
-      // supported anymore, but include this check to be on the
-      // safe side.
-      warning("Can't parse CPU implementation = '%s', assume generic SPARC", impl);
-#endif
-    }
+    log_info(os, cpu)("Failed to parse CPU implementation = '%s'", impl);
   }
   os::free((void*)impl);
   return features;
--- a/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Mon Oct 17 18:54:12 2016 -0400
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Mon Oct 17 19:12:28 2016 -0400
@@ -440,36 +440,39 @@
     features |= sun4v_m;
   }
 
-  bool use_solaris_12_api = false;
-  Sysinfo impl(SI_CPUBRAND);
-  if (impl.valid()) {
-    // If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
-    // is available to us as well
-    use_solaris_12_api = true;
-    features |= parse_features(impl.value());
+  // If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
+  // is available to us as well
+  Sysinfo cpu_info(SI_CPUBRAND);
+  bool use_solaris_12_api = cpu_info.valid();
+  const char* impl;
+  int impl_m = 0;
+  if (use_solaris_12_api) {
+    impl = cpu_info.value();
+    log_info(os, cpu)("Parsing CPU implementation from %s", impl);
+    impl_m = parse_features(impl);
   } else {
     // Otherwise use kstat to determine the machine type.
     kstat_ctl_t* kc = kstat_open();
-    kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
-    const char* implementation;
-    bool has_implementation = false;
-    if (ksp != NULL) {
-      if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
-        kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
-        for (int i = 0; i < ksp->ks_ndata; i++) {
-          if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
-            implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
-            has_implementation = true;
-            log_info(os, cpu)("cpu_info.implementation: %s", implementation);
-            features |= parse_features(implementation);
-            break;
+    if (kc != NULL) {
+      kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
+      if (ksp != NULL) {
+        if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
+          kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
+          for (int i = 0; i < ksp->ks_ndata; i++) {
+            if (strcmp((const char*)&(knm[i].name), "implementation") == 0) {
+              impl = KSTAT_NAMED_STR_PTR(&knm[i]);
+              log_info(os, cpu)("Parsing CPU implementation from %s", impl);
+              impl_m = parse_features(impl);
+              break;
+            }
           }
-        } // for(
+        }
       }
+      kstat_close(kc);
     }
-    assert(has_implementation, "unknown cpu info (changed kstat interface?)");
-    kstat_close(kc);
   }
+  assert(impl_m != 0, "Unknown CPU implementation %s", impl);
+  features |= impl_m;
 
   bool is_sun4v = (features & sun4v_m) != 0;
   if (use_solaris_12_api && is_sun4v) {