RFR: 8365673: Incorrect number of cores are reported on Ryzen CPU
Yasumasa Suenaga
ysuenaga at openjdk.org
Wed Aug 27 00:00:48 UTC 2025
On Mon, 18 Aug 2025 10:01:46 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
> `VM.info` DCmd reports CPU information. I ran this on Ryzen 3 3300X, then I got following result:
>
>
> CPU: total 8 (initial active 8) (8 cores per cpu, 2 threads per core) family 23 model 113 stepping 0 microcode 0xffffffff, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4a, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, clmul, bmi1, bmi2, adx, sha, fma, vzeroupper, clflush, clflushopt, hv, rdtscp, rdpid, f16c
> CPU Model and flags from /proc/cpuinfo:
> model name : AMD Ryzen 3 3300X 4-Core Processor
> flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr arat npt nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload umip rdpid
>
>
> It reports "8 cores per cpu, 2 threads per core". However, according to [spec sheet](https://www.amd.com/en/support/downloads/drivers.html/processors/ryzen/ryzen-3000-series/amd-ryzen-3-3300x.html), 3300X has 4 cores 8 threads. (In addition, cpuinfo says "4-Core Processor")
>
> According to [Programmer's Manual by AMD](https://docs.amd.com/v/u/en-US/40332-PUB_4.08), Bit 7:0 in `ECX` from `CPUID` leaf `80000008h` means number of threads, not cores. Thus we should divide it by threads per core.
>
> After this change, we can see correct number of cores as following on 3300X:
>
> CPU: total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 23 model 113 stepping 0 microcode 0xffffffff, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4a, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, clmul, bmi1, bmi2, adx, sha, fma, vzeroupper, clflush, clflushopt, clwb, hv, rdtscp, rdpid, f16c
> CPU Model and flags from /proc/cpuinfo:
> model name : AMD Ryzen 3 3300X 4-Core Processor
Thank you both!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26819#issuecomment-3226151908
More information about the hotspot-dev
mailing list