changeset 7463:e2c93c0a76df

8058935: CPU detection gives 0 cores per cpu, 2 threads per core in Amazon EC2 environment Reviewed-by: kvn, dsamersoff
author vkempik
date Mon, 01 Dec 2014 18:22:45 +0400
parents a0dd995271c4
children da92e4c42b24
files src/cpu/x86/vm/vm_version_x86.hpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/x86/vm/vm_version_x86.hpp	Mon Dec 01 12:16:15 2014 -0500
+++ b/src/cpu/x86/vm/vm_version_x86.hpp	Mon Dec 01 18:22:45 2014 +0400
@@ -570,10 +570,12 @@
   static uint cores_per_cpu()  {
     uint result = 1;
     if (is_intel()) {
-      if (supports_processor_topology()) {
+      bool supports_topology = supports_processor_topology();
+      if (supports_topology) {
         result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
                  _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
-      } else {
+      }
+      if (!supports_topology || result == 0) {
         result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
       }
     } else if (is_amd()) {