RFR: 8366847: JFR reports incorrect number of cores on hybrid CPU [v3]
Yasumasa Suenaga
ysuenaga at openjdk.org
Fri Oct 3 12:42:52 UTC 2025
On Fri, 3 Oct 2025 06:53:26 GMT, David Holmes <dholmes at openjdk.org> wrote:
> Okay but this is not a JFR specific change - you are changing these values for all clients of the VM version info.
Yes, so I think this PR needs reviewer(s) from HotSpot folks.
> So the current code would do:
Unfortunately, no. It would derive wrong number of sockets as following:
_no_of_threads = 28 // 2 sockets * (6 P-cores * 2 threads + 2 E-cores)
threads_per_core() = 2 // HT enabled
cores_per_cpu() = 7 // ** different from your thought ** 14 threads per cpu / 2 logical processors
threads_per_package = 14 // 2 threads per core * 7 cores per cpu
_no_of_sockets = 2 // 28 threads / 14 threads per package
`cores_per_cpu()` would return `CPUID` leaf 0Bh for modern Intel CPU as following. According to Software Developer's Manual, leaf 0Bh returns number of "logical" processor in each domains (selected by subleaf (ECX)).
if (is_intel()) {
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;
}
In this PR, all of variables are same with current implementation, thus we can calculate `_no_of_sockets` correctly. But only `threads_per_package` comes from `CPUID`.
_no_of_threads = 28 // 2 sockets * (6 P-cores * 2 threads + 2 E-cores)
threads_per_core() = 2 // HT enabled
cores_per_cpu() = 7 // incorrect, but it would be calculated by values from `CPUID`
threads_per_package = 14 // ** different from current implementation ** the value from `CPUID`
_no_of_sockets = 2 // 28 threads / 14 threads per package
I uploaded test code for `CPUID` leaf 0Bh: https://github.com/YaSuenag/garakuta/blob/master/check-hybrid-cores/hy-core-check.c
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27080#discussion_r2401759645
More information about the hotspot-dev
mailing list