changeset 7017:a8c8adf853c2

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 c3933f52eeb3
children f06c27e55164
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	Wed Dec 17 10:43:38 2014 -0800
+++ 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()) {