RFR: 8366847: JFR reports incorrect number of cores on hybrid CPU [v3]
David Holmes
dholmes at openjdk.org
Tue Oct 7 07:10:49 UTC 2025
On Tue, 7 Oct 2025 05:43:45 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
>> Can we not check for "Intel Hybrid Information" CPUID leaf (0x1A) that reports the type of each core and use that to get an accurate core count? So that:
>>
>> int cores_per_cpu() {
>> if (is_hybrid()) {
>> if (hyper_threaded() ) {
>> return _no_of_threads - _no_of_e_cores;
>> } else {
>> return _no_of_threads;
>> }
>> } else {
>> return _no_of_threads / threads_per_core();
>> }
>> }
>
> I think it is difficult for the following reasons:
>
> 1. We need to set affinity & issue `CPUID` leaf 1Ah on all of cores. See example: https://github.com/YaSuenag/garakuta/blob/master/check-hybrid-cores/hy-core-check.c
> 2. E-core does not have HT for now, but we don't know this architecture (P core has HT, both E core and LP E core do not have HT) keeps in future.
Oh that is awful - I did not realize that, I assumed we got some kind of bit vector we could query.
I'm less concerned about them adding HT to E-cores in the future as we will likely have to expand the code to deal with specific chips anyway.
So where does this leave us?
- `cores_per_cpu` is an approximation
- anything reporting the `cores_per_cpu` value needs to include some text (if it is a hybrid) to indicate it is an approximation
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27080#discussion_r2409613404
More information about the hotspot-dev
mailing list