8165482: java in ldoms, with cpu-arch=generic has problems

Fri, 31 Mar 2017 07:46:19 -0700

author
kevinw
date
Fri, 31 Mar 2017 07:46:19 -0700
changeset 8732
ef91cb539697
parent 8731
3cb2feaca8cf
child 8733
92cb89e23f3e

8165482: java in ldoms, with cpu-arch=generic has problems
Reviewed-by: dholmes, alanbur

src/cpu/sparc/vm/vm_version_sparc.cpp file | annotate | diff | comparison | revisions
src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/sparc/vm/vm_version_sparc.cpp	Fri Mar 17 07:52:54 2017 -0700
     1.2 +++ b/src/cpu/sparc/vm/vm_version_sparc.cpp	Fri Mar 31 07:46:19 2017 -0700
     1.3 @@ -236,7 +236,7 @@
     1.4    assert((OptoLoopAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
     1.5  
     1.6    char buf[512];
     1.7 -  jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
     1.8 +  jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
     1.9                 (has_v9() ? ", v9" : (has_v8() ? ", v8" : "")),
    1.10                 (has_hardware_popc() ? ", popc" : ""),
    1.11                 (has_vis1() ? ", vis1" : ""),
    1.12 @@ -249,6 +249,7 @@
    1.13                 (has_sha256() ? ", sha256" : ""),
    1.14                 (has_sha512() ? ", sha512" : ""),
    1.15                 (is_ultra3() ? ", ultra3" : ""),
    1.16 +               (has_sparc5_instr() ? ", sparc5" : ""),
    1.17                 (is_sun4v() ? ", sun4v" : ""),
    1.18                 (is_niagara_plus() ? ", niagara_plus" : (is_niagara() ? ", niagara" : "")),
    1.19                 (is_sparc64() ? ", sparc64" : ""),
    1.20 @@ -479,16 +480,13 @@
    1.21      if (strstr(impl, "SPARC-T1") != NULL) {
    1.22        features |= T1_model_m;
    1.23      }
    1.24 +  } else if (strstr(impl, "SUN4V-CPU") != NULL) {
    1.25 +    // Generic or migration class LDOM
    1.26 +    features |= T_family_m;
    1.27    } else {
    1.28 -    if (strstr(impl, "SPARC") == NULL) {
    1.29  #ifndef PRODUCT
    1.30 -      // kstat on Solaris 8 virtual machines (branded zones)
    1.31 -      // returns "(unsupported)" implementation. Solaris 8 is not
    1.32 -      // supported anymore, but include this check to be on the
    1.33 -      // safe side.
    1.34 -      warning("Can't parse CPU implementation = '%s', assume generic SPARC", impl);
    1.35 +    warning("Failed to parse CPU implementation = '%s'", impl);
    1.36  #endif
    1.37 -    }
    1.38    }
    1.39    os::free((void*)impl);
    1.40    return features;
     2.1 --- a/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Fri Mar 17 07:52:54 2017 -0700
     2.2 +++ b/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Fri Mar 31 07:46:19 2017 -0700
     2.3 @@ -438,40 +438,47 @@
     2.4      features |= sun4v_m;
     2.5    }
     2.6  
     2.7 -  bool use_solaris_12_api = false;
     2.8 -  Sysinfo impl(SI_CPUBRAND);
     2.9 -  if (impl.valid()) {
    2.10 -    // If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
    2.11 -    // is available to us as well
    2.12 -    use_solaris_12_api = true;
    2.13 -    features |= parse_features(impl.value());
    2.14 +  // If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
    2.15 +  // is available to us as well
    2.16 +  Sysinfo cpu_info(SI_CPUBRAND);
    2.17 +  bool use_solaris_12_api = cpu_info.valid();
    2.18 +  const char* impl;
    2.19 +  int impl_m = 0;
    2.20 +  if (use_solaris_12_api) {
    2.21 +    impl = cpu_info.value();
    2.22 +#ifndef PRODUCT
    2.23 +  if (PrintMiscellaneous && Verbose) {
    2.24 +    tty->print_cr("Parsing CPU implementation from %s", impl);
    2.25 +  }
    2.26 +#endif
    2.27 +    impl_m = parse_features(impl);
    2.28    } else {
    2.29      // Otherwise use kstat to determine the machine type.
    2.30      kstat_ctl_t* kc = kstat_open();
    2.31 -    kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
    2.32 -    const char* implementation;
    2.33 -    bool has_implementation = false;
    2.34 -    if (ksp != NULL) {
    2.35 -      if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
    2.36 -        kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
    2.37 -        for (int i = 0; i < ksp->ks_ndata; i++) {
    2.38 -          if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
    2.39 -            implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
    2.40 -            has_implementation = true;
    2.41 +    if (kc != NULL) {
    2.42 +      kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
    2.43 +      if (ksp != NULL) {
    2.44 +        if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
    2.45 +          kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
    2.46 +          for (int i = 0; i < ksp->ks_ndata; i++) {
    2.47 +            if (strcmp((const char*)&(knm[i].name), "implementation") == 0) {
    2.48 +              impl = KSTAT_NAMED_STR_PTR(&knm[i]);
    2.49  #ifndef PRODUCT
    2.50 -            if (PrintMiscellaneous && Verbose) {
    2.51 -              tty->print_cr("cpu_info.implementation: %s", implementation);
    2.52 +              if (PrintMiscellaneous && Verbose) {
    2.53 +                tty->print_cr("Parsing CPU implementation from %s", impl);
    2.54 +              }
    2.55 +#endif
    2.56 +              impl_m = parse_features(impl);
    2.57 +              break;
    2.58              }
    2.59 -#endif
    2.60 -            features |= parse_features(implementation);
    2.61 -            break;
    2.62            }
    2.63 -        } // for(
    2.64 +        }
    2.65        }
    2.66 +      kstat_close(kc);
    2.67      }
    2.68 -    assert(has_implementation, "unknown cpu info (changed kstat interface?)");
    2.69 -    kstat_close(kc);
    2.70    }
    2.71 +  assert(impl_m != 0, err_msg("Unknown CPU implementation %s", impl));
    2.72 +  features |= impl_m;
    2.73  
    2.74    bool is_sun4v = (features & sun4v_m) != 0;
    2.75    if (use_solaris_12_api && is_sun4v) {

mercurial