Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect E-cores and P-cores in Linux alder lake system?

How can I check particular cpu core belongs to P-core or E-core group? Is there any way to list information about Performance/Energy cores in a running Linux x86_64 alder lake system? Like, Printing any of the sysfs parameters?

like image 889
Krishnamoorthi M Avatar asked Sep 07 '25 03:09

Krishnamoorthi M


2 Answers

We can identify which core has SMT (hyper-threading) enabled. Run:

lscpu --all --extended

This is the result for 12900K:

➜ lscpu --all --extended
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE    MAXMHZ   MINMHZ
  0    0      0    0 0:0:0:0          yes 6700.0000 800.0000
  1    0      0    0 0:0:0:0          yes 6700.0000 800.0000
  2    0      0    1 1:1:1:0          yes 6700.0000 800.0000
  3    0      0    1 1:1:1:0          yes 6700.0000 800.0000
  4    0      0    2 2:2:2:0          yes 6500.0000 800.0000
  5    0      0    2 2:2:2:0          yes 6500.0000 800.0000
  6    0      0    3 3:3:3:0          yes 6500.0000 800.0000
  7    0      0    3 3:3:3:0          yes 6500.0000 800.0000
  8    0      0    4 4:4:4:0          yes 6500.0000 800.0000
  9    0      0    4 4:4:4:0          yes 6500.0000 800.0000
 10    0      0    5 5:5:5:0          yes 6500.0000 800.0000
 11    0      0    5 5:5:5:0          yes 6500.0000 800.0000
 12    0      0    6 6:6:6:0          yes 6500.0000 800.0000
 13    0      0    6 6:6:6:0          yes 6500.0000 800.0000
 14    0      0    7 7:7:7:0          yes 6500.0000 800.0000
 15    0      0    7 7:7:7:0          yes 6500.0000 800.0000
 16    0      0    8 8:8:8:0          yes 3900.0000 800.0000
 17    0      0    9 9:9:8:0          yes 3900.0000 800.0000
 18    0      0   10 10:10:8:0        yes 3900.0000 800.0000
 19    0      0   11 11:11:8:0        yes 3900.0000 800.0000
 20    0      0   12 12:12:9:0        yes 3900.0000 800.0000
 21    0      0   13 13:13:9:0        yes 3900.0000 800.0000
 22    0      0   14 14:14:9:0        yes 3900.0000 800.0000
 23    0      0   15 15:15:9:0        yes 3900.0000 800.0000

Now, look at the CPU column and CORE column. For example:

  • CPU 0 and CPU 1 belong to CORE 0. Therefore, CORE 0 is a P-core with SMT.
  • CPU 16 belongs to CORE 8. Therefore, CORE 8 is an E-core.

Note that this method will only work if you haven't explicitly disabled P-core's SMT in BIOS. If you disabled SMT in BIOS, you may look at the MAXMHZ column as suggested in Peter's comment.

like image 161
Yixing Avatar answered Sep 10 '25 12:09

Yixing


A more precise answer that doesn't require guessing based on processor characteristics like frequency or number of threads, is that this information is exposed in the /sys pseudo filesystem:

On Alder lake (and mostly like other hybrid Intel architectures), instead of /sys/devices/cpu there are two directories: /sys/devices/cpu_atom/ and /sys/devices/cpu_core/, being the first (cpu_atom) for the e-cores and the second (cpu_core) for the p-cores.

Inside each directory there is a file named cpus that contain the cpu range number.

For example, in my i7-1360P:

  • /sys/devices/cpu_core/cpus contain 0-7 (four p-cores with two threads each)
  • /sys/devices/cpu_atom/cpus contain 8-15
like image 31
Marcelo Avatar answered Sep 10 '25 13:09

Marcelo