RFR: 8366847: JFR reports incorrect number of cores on hybrid CPU
Yasumasa Suenaga
ysuenaga at openjdk.org
Thu Sep 4 11:34:54 UTC 2025
On Thu, 4 Sep 2025 02:15:01 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
> On hybrid CPU like Intel Arrow Lake, JFR reports incorrect number of cores in `jdk.CPUInformation`.
>
>
> $ jfr print --events jdk.CPUInformation test.jfr
> jdk.CPUInformation {
> startTime = 10:49:27.692 (2025-09-04)
> cpu = "Intel (null) (HT) SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 Core Intel64"
> description = "Brand: Intel(R) Core(TM) Ultra 5 225U, Vendor: GenuineIntel
> Family: <unknown> (0x6), Model: <unknown> (0xb5), Stepping: 0x0
> Ext. family: 0x0, Ext. model: 0xb, Type: 0x0, Signature: 0x000b0650
> Features: ebx: 0x40800800, ecx: 0xfffaf38b, edx: 0xbfcbfbff
> Ext. features: eax: 0x00000000, ebx: 0x00000000, ecx: 0x00000121, edx: 0x2c100800
> Supports: On-Chip FPU, Virtual Mode Extensions, Debugging Extensions, Page Size Extensions, Time Stamp Counter, Model Specific Registers, Physical Address Extension, Machine Check Exceptions, CMPXCHG8B Instruction, On-Chip APIC, Fast System Call, Memory Type Range Registers, Page Global Enable, Machine Check Architecture, Conditional Mov Instruction, Page Attribute Table, 36-bit Page Size Extension, CLFLUSH Instruction, ACPI registers in MSR space, Intel Architecture MMX Technology, Fast Float Point Save and Restore, Streaming SIMD extensions, Streaming SIMD extensions 2, Self-Snoop, Hyper Threading, Thermal Monitor, Streaming SIMD Extensions 3, PCLMULQDQ, MONITOR/MWAIT instructions, Enhanced Intel SpeedStep technology, Thermal Monitor 2, Supplemental Streaming SIMD Extensions 3, Fused Multiply-Add, CMPXCHG16B, xTPR Update Control, Perfmon and Debug Capability, Process-context identifiers, Streaming SIMD extensions 4.1, Streaming SIMD extensions 4.2, x2APIC, MOVBE, Popcount instruc
tion, TSC-Deadline, AESNI, XSAVE, OSXSAVE, AVX, F16C, LAHF/SAHF instruction support, Advanced Bit Manipulations: LZCNT, SYSCALL/SYSRET, Execute Disable Bit, RDTSCP, Intel 64 Architecture, Invariant TSC"
> sockets = 1
> cores = 7
> hwThreads = 14
> }
>
>
> Flight record in above was created on Intel Core Ultra 5 225U. According to [datasheet](https://www.intel.com/content/www/us/en/products/sku/241861/intel-core-ultra-5-processor-225u-12m-cache-up-to-4-80-ghz/specifications.html), it has 12 cores, 14 threads. Thus JFR should report `12` in `cores`.
>
> We tackled similar issue on [JDK-8365633](https://bugs.openjdk.org/browse/JDK-8365633), then we concluded it is difficult to calculate number of physical cores. Thus we might not set correct value at here, but we should avoid to set incorrect value at least.
>
> This patch sets `0` to `cores` and "Hybrid Architecture" ...
src/hotspot/cpu/x86/vm_version_x86.cpp line 2581:
> 2579: // CPUID 0Bh (ECX = 1) might return 0 on older AMD processor (EPYC 7763 at least)
> 2580: threads_per_package = threads_per_core() * cores_per_cpu();
> 2581: }
Check `thread_per_package` from `CPUID` to avoid SIGFPE (div by zero).
`CPUID` leaf 0Bh with ECX (subleaf) = 1 seems to return `0` as number of logical processors in spite of leaf 08h is supported in some older processors. It's strange, but I saw it on AMD EPYC 7763 on GitHub Actions runner. The problem appears as following.
I haven't faced this problem on AMD Ryzen 3 3300X.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGFPE (0x8) at pc=0x00007f19e11ffeed, pid=11344, tid=11345
#
# JRE version: OpenJDK Runtime Environment (26.0) (build 26-internal-YaSuenag-ebf4aec23fa95c8d54d1196c7be85e99f0846420)
# Java VM: OpenJDK 64-Bit Server VM (26-internal-YaSuenag-ebf4aec23fa95c8d54d1196c7be85e99f0846420, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x11ffeed] VM_Version::initialize_cpu_information()+0x2d
#
# CreateCoredumpOnCrash turned off, no core file dumped
#
# JFR recording file will be written. Location: /home/runner/work/jdk/jdk/build/run-test-prebuilt/test-support/jtreg_test_jdk_tier1_part3/scratch/1/hs_err_pid11344.jfr
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
--------------- S U M M A R Y ------------
Command Line: -Xmx768m -XX:MaxRAMPercentage=12.5 -Dtest.boot.jdk=/home/runner/work/jdk/jdk/bootjdk/jdk -Djava.io.tmpdir=/home/runner/work/jdk/jdk/build/run-test-prebuilt/test-support/jtreg_test_jdk_tier1_part3/tmp -ea -esa -XX:-CreateCoredumpOnCrash -Xlog:jfr=trace -XX:StartFlightRecording:filename=./dumped.jfr,dumponexit=true,settings=profile jdk.jfr.startupargs.TestDumpOnExit$TestMain
Host: AMD EPYC 7763 64-Core Processor, 4 cores, 15G, Ubuntu 22.04.5 LTS
Time: Thu Sep 4 07:17:02 2025 UTC elapsed time: 0.570221 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x00007f19d802ad20): JavaThread "main" [_thread_in_vm, id=11345, stack(0x00007f19dff00000,0x00007f19e0000000) (1024K)]
Stack: [0x00007f19dff00000,0x00007f19e0000000], sp=0x00007f19dfffbd40, free space=1007k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x11ffeed] VM_Version::initialize_cpu_information()+0x2d (vm_version_x86.cpp:2581)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27080#discussion_r2321741255
More information about the hotspot-dev
mailing list