RFR: 8365673: Incorrect number of cores are reported on Ryzen CPU
Yasumasa Suenaga
ysuenaga at openjdk.org
Thu Aug 21 06:52:51 UTC 2025
On Thu, 21 Aug 2025 03:02:23 GMT, David Holmes <dholmes at openjdk.org> wrote:
> I'm not sure the meaning actually changed based on the chip family (`if (cpu_family() >= 0x17)` )
I made the change in `VM_Version::cores_per_cpu()`, however this function calls from `threads_per_core()` in some case as following. To prevent recursive call, I add a condition for CPU family. SMT (equivalent with HT in Intel) seems to be introduced in Zen architecture (family `17h`), thus this logic should work.
uint VM_Version::threads_per_core() {
uint result = 1;
if (is_intel() && supports_processor_topology()) {
result = _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
} else if (is_zx() && supports_processor_topology()) {
result = _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
} else if (_cpuid_info.std_cpuid1_edx.bits.ht != 0) {
if (cpu_family() >= 0x17) {
result = _cpuid_info.ext_cpuid1E_ebx.bits.threads_per_core + 1;
} else {
result = _cpuid_info.std_cpuid1_ebx.bits.threads_per_cpu /
cores_per_cpu();
}
}
return (result == 0 ? 1 : result);
}
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26819#issuecomment-3209226406
More information about the hotspot-dev
mailing list