Skip to contentSkip to conversation

tools/power turbostat: Allow execution to continue after perf_l2_init() failure

PATCH In review David Arcari 2 participants 7 messages Mar 19 – Apr 14 2 messages not in the archive Turbostat utility

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/power turbostat: Allow execution to continue after perf_l2_init() failure

Currently, if perf_l2_init() fails turbostat exits after issuing the following error (which was encountered on AlderLake):

turbostat: perf_l2_init(cpu0, 0x0, 0xff24) REFS: Invalid argument

This occurs because perf_l2_init() calls err(). However, the code has been written in such a manner that it is able to perform cleanup and continue. Therefore, this issue can be addressed by changing the appropriate calls to err() to warnx().

Additionally, correct the PMU type arguments passed to the warning strings in the ecore and lcore blocks so the logs accurately reflect the failing counter type.

---
 tools/power/x86/turbostat/turbostat.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tools/power/x86/turbostat/turbostat.c +8 -8
index 1a2671c28209..f1b8059a4eec 100644
@@ -9403,13 +9403,13 @@ void perf_l2_init(void)
 		if (!is_hybrid) {
 			fd_l2_percpu[cpu] = open_perf_counter(cpu, perf_pmu_types.uniform, perf_model_support->first.refs, -1, PERF_FORMAT_GROUP);
 			if (fd_l2_percpu[cpu] == -1) {
-				err(-1, "%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.uniform, perf_model_support->first.refs);
+				warnx("%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.uniform, perf_model_support->first.refs);
 				free_fd_l2_percpu();
 				return;
 			}
 			retval = open_perf_counter(cpu, perf_pmu_types.uniform, perf_model_support->first.hits, fd_l2_percpu[cpu], PERF_FORMAT_GROUP);
 			if (retval == -1) {
-				err(-1, "%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.uniform, perf_model_support->first.hits);
+				warnx("%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.uniform, perf_model_support->first.hits);
 				free_fd_l2_percpu();
 				return;
 			}
@@ -9418,39 +9418,39 @@ void perf_l2_init(void)
 		if (perf_pcore_set && CPU_ISSET_S(cpu, cpu_possible_setsize, perf_pcore_set)) {
 			fd_l2_percpu[cpu] = open_perf_counter(cpu, perf_pmu_types.pcore, perf_model_support->first.refs, -1, PERF_FORMAT_GROUP);
 			if (fd_l2_percpu[cpu] == -1) {
-				err(-1, "%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->first.refs);
+				warnx("%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->first.refs);
 				free_fd_l2_percpu();
 				return;
 			}
 			retval = open_perf_counter(cpu, perf_pmu_types.pcore, perf_model_support->first.hits, fd_l2_percpu[cpu], PERF_FORMAT_GROUP);
 			if (retval == -1) {
-				err(-1, "%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->first.hits);
+				warnx("%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->first.hits);
 				free_fd_l2_percpu();
 				return;
 			}
 		} else if (perf_ecore_set && CPU_ISSET_S(cpu, cpu_possible_setsize, perf_ecore_set)) {
 			fd_l2_percpu[cpu] = open_perf_counter(cpu, perf_pmu_types.ecore, perf_model_support->second.refs, -1, PERF_FORMAT_GROUP);
 			if (fd_l2_percpu[cpu] == -1) {
-				err(-1, "%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->second.refs);
+				warnx("%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.ecore, perf_model_support->second.refs);
 				free_fd_l2_percpu();
 				return;
 			}
 			retval = open_perf_counter(cpu, perf_pmu_types.ecore, perf_model_support->second.hits, fd_l2_percpu[cpu], PERF_FORMAT_GROUP);
 			if (retval == -1) {
-				err(-1, "%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->second.hits);
+				warnx("%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.ecore, perf_model_support->second.hits);
 				free_fd_l2_percpu();
 				return;
 			}
 		} else if (perf_lcore_set && CPU_ISSET_S(cpu, cpu_possible_setsize, perf_lcore_set)) {
 			fd_l2_percpu[cpu] = open_perf_counter(cpu, perf_pmu_types.lcore, perf_model_support->third.refs, -1, PERF_FORMAT_GROUP);
 			if (fd_l2_percpu[cpu] == -1) {
-				err(-1, "%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->third.refs);
+				warnx("%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.lcore, perf_model_support->third.refs);
 				free_fd_l2_percpu();
 				return;
 			}
 			retval = open_perf_counter(cpu, perf_pmu_types.lcore, perf_model_support->third.hits, fd_l2_percpu[cpu], PERF_FORMAT_GROUP);
 			if (retval == -1) {
-				err(-1, "%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->third.hits);
+				warnx("%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.lcore, perf_model_support->third.hits);
 				free_fd_l2_percpu();
 				return;
 			}
Signature · 1 line
2.53.0
maintainer
#1 lore raw

Hmm, the check of perf_model_support covers unknown CPUs. (and this code runs fine on my Alderlake)

So the failure you see must be from the kernel perf support failing? What is the kernel config?

thanks,
-Len

Quoted 93 lines · David Arcari

Currently, if perf_l2_init() fails turbostat exits after issuing the following error (which was encountered on AlderLake):

turbostat: perf_l2_init(cpu0, 0x0, 0xff24) REFS: Invalid argument

This occurs because perf_l2_init() calls err(). However, the code has been written in such a manner that it is able to perform cleanup and continue. Therefore, this issue can be addressed by changing the appropriate calls to err() to warnx().

Additionally, correct the PMU type arguments passed to the warning strings in the ecore and lcore blocks so the logs accurately reflect the failing counter type.

---
 tools/power/x86/turbostat/turbostat.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tools/power/x86/turbostat/turbostat.c +8 -9
index 1a2671c28209..f1b8059a4eec 100644
@@ -9403,13 +9403,13 @@ void perf_l2_init(void)
                if (!is_hybrid) {
                        fd_l2_percpu[cpu] = open_perf_counter(cpu, perf_pmu_types.uniform, perf_model_support->first.refs, -1, PERF_FORMAT_GROUP);
                        if (fd_l2_percpu[cpu] == -1) {
-                               err(-1, "%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.uniform, perf_model_support->first.refs);
+                               warnx("%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.uniform, perf_model_support->first.refs);
                                free_fd_l2_percpu();
                                return;
                        }
                        retval = open_perf_counter(cpu, perf_pmu_types.uniform, perf_model_support->first.hits, fd_l2_percpu[cpu], PERF_FORMAT_GROUP);
                        if (retval == -1) {
-                               err(-1, "%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.uniform, perf_model_support->first.hits);
+                               warnx("%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.uniform, perf_model_support->first.hits);
                                free_fd_l2_percpu();
                                return;
                        }
@@ -9418,39 +9418,39 @@ void perf_l2_init(void)
                if (perf_pcore_set && CPU_ISSET_S(cpu, cpu_possible_setsize, perf_pcore_set)) {
                        fd_l2_percpu[cpu] = open_perf_counter(cpu, perf_pmu_types.pcore, perf_model_support->first.refs, -1, PERF_FORMAT_GROUP);
                        if (fd_l2_percpu[cpu] == -1) {
-                               err(-1, "%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->first.refs);
+                               warnx("%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->first.refs);
                                free_fd_l2_percpu();
                                return;
                        }
                        retval = open_perf_counter(cpu, perf_pmu_types.pcore, perf_model_support->first.hits, fd_l2_percpu[cpu], PERF_FORMAT_GROUP);
                        if (retval == -1) {
-                               err(-1, "%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->first.hits);
+                               warnx("%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->first.hits);
                                free_fd_l2_percpu();
                                return;
                        }
                } else if (perf_ecore_set && CPU_ISSET_S(cpu, cpu_possible_setsize, perf_ecore_set)) {
                        fd_l2_percpu[cpu] = open_perf_counter(cpu, perf_pmu_types.ecore, perf_model_support->second.refs, -1, PERF_FORMAT_GROUP);
                        if (fd_l2_percpu[cpu] == -1) {
-                               err(-1, "%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->second.refs);
+                               warnx("%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.ecore, perf_model_support->second.refs);
                                free_fd_l2_percpu();
                                return;
                        }
                        retval = open_perf_counter(cpu, perf_pmu_types.ecore, perf_model_support->second.hits, fd_l2_percpu[cpu], PERF_FORMAT_GROUP);
                        if (retval == -1) {
-                               err(-1, "%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->second.hits);
+                               warnx("%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.ecore, perf_model_support->second.hits);
                                free_fd_l2_percpu();
                                return;
                        }
                } else if (perf_lcore_set && CPU_ISSET_S(cpu, cpu_possible_setsize, perf_lcore_set)) {
                        fd_l2_percpu[cpu] = open_perf_counter(cpu, perf_pmu_types.lcore, perf_model_support->third.refs, -1, PERF_FORMAT_GROUP);
                        if (fd_l2_percpu[cpu] == -1) {
-                               err(-1, "%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->third.refs);
+                               warnx("%s(cpu%d, 0x%x, 0x%llx) REFS", __func__, cpu, perf_pmu_types.lcore, perf_model_support->third.refs);
                                free_fd_l2_percpu();
                                return;
                        }
                        retval = open_perf_counter(cpu, perf_pmu_types.lcore, perf_model_support->third.hits, fd_l2_percpu[cpu], PERF_FORMAT_GROUP);
                        if (retval == -1) {
-                               err(-1, "%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.pcore, perf_model_support->third.hits);
+                               warnx("%s(cpu%d, 0x%x, 0x%llx) HITS", __func__, cpu, perf_pmu_types.lcore, perf_model_support->third.hits);
                                free_fd_l2_percpu();
                                return;
                        }
--

2.53.0

Signature · 1 line
Len Brown, Intel Open Source Technology Center
maintainer
#2 lore raw

Thank you for the patch, David, it is helpful.

I agree that turbostat should do its best to run properly when the underlying kernel
doesn't have full support, and you found a configuration that I missed.

I'd like to understand how/why your kernel perf support is failing on alder lake to be sure turbostat is coping the best it can.

If you can identify an upstream kernel version that fails this way, that would be great.

You can poke with "perf stat" as well, but this will depend on what .json counter list is compiled into
your version of perf.

probably a first sanity check would be if these commands for the LLC and the L2 work:

sudo perf stat -e cache-misses sleep 1
sudo perf stat -e L2_REQUEST.ALL sleep 1

Also, with your L2 patch applied, does turbostat still successfully show the LLC stats?

thanks,
Len Brown, Intel Open Source Technology Center

#3 lore raw

Hi Len,

Quoted 11 lines · Len Brown

Thank you for the patch, David, it is helpful.

I agree that turbostat should do its best to run properly when the underlying kernel
doesn't have full support, and you found a configuration that I missed.

I'd like to understand how/why your kernel perf support is failing on alder lake to be sure turbostat is coping the best it can.

If you can identify an upstream kernel version that fails this way, that would be great.

I'm using a Fedora kernel:

vmlinuz-7.0.0-0.rc4.260320g0e4f8f1a3d08.40.eln155.x86_64

And turbostat is:

# turbostat -v
turbostat version 2026.02.14 - Len Brown <[email protected]>
Quoted 10 lines

You can poke with "perf stat" as well, but this will depend on what .json counter list is compiled into
your version of perf.

probably a first sanity check would be if these commands for the LLC and the L2 work:

sudo perf stat -e cache-misses sleep 1
sudo perf stat -e L2_REQUEST.ALL sleep 1

# sudo perf stat -e cache-misses sleep 1

Performance counter stats for 'sleep 1':

<not supported> cpu_atom/cache-misses/

            11,212      cpu_core/cache-misses/ 


       1.001044852 seconds time elapsed

       0.000793000 seconds user
       0.000000000 seconds sys
# sudo perf stat -e L2_REQUEST.ALL sleep 1

Performance counter stats for 'sleep 1':

<not supported> cpu_atom/L2_REQUEST.ALL/

            98,451      cpu_core/L2_REQUEST.ALL/ 


       1.001072723 seconds time elapsed

       0.000761000 seconds user
       0.000000000 seconds sys
Quoted 4 lines

Also, with your L2 patch applied, does turbostat still successfully show the LLC stats?

# ./turbostat --quiet -s Core,CPU,LLCMRPS,LLC%hit -n 1
Core	CPU	LLCMRPS	LLC%hit
-	-	1	91.33
0	0	0	93.48
0	1	0	86.86
1	2	0	90.68
1	3	0	98.61
2	4	0	98.59
2	5	0	98.79
3	6	0	90.86
3	7	0	97.64
4	8	0	97.52
4	9	0	99.33
5	10	0	85.54
5	11	0	90.85

Let me know if you need something else.

Thanks,
-DA

Quoted 3 lines

thanks,
Len Brown, Intel Open Source Technology Center

maintainer
#4 lore raw
Quoted 17 lines · David Arcari

I'm using a Fedora kernel:

vmlinuz-7.0.0-0.rc4.260320g0e4f8f1a3d08.40.eln155.x86_64

And turbostat is:

# turbostat -v
turbostat version 2026.02.14 - Len Brown <[email protected]>
Quoted 8 lines

You can poke with "perf stat" as well, but this will depend on what .json counter list is compiled into
your version of perf.

probably a first sanity check would be if these commands for the LLC and the L2 work:

Quoted 8 lines
Quoted 2 lines

sudo perf stat -e cache-misses sleep 1
sudo perf stat -e L2_REQUEST.ALL sleep 1

# sudo perf stat -e cache-misses sleep 1

Performance counter stats for 'sleep 1':

<not supported> cpu_atom/cache-misses/

I think this should work. There may be an issue either with the perf utility or the perf kernel support on that system.

I'll cc Dapeng. Already the weekend where he is, but maybe he can give us some perf insight next week.

thx,
-Len

A message that is not in the archive (sent off-list or not yet received): MN0PR11MB6160DDF6952E2B595B2EA1C1CD242@MN0PR11MB6160.namprd11.prod.outlook.com

#6 lore raw

Here is the -vvv output:

# sudo perf stat -e cache-misses -vvv sleep 1
Control descriptor is not initialized
Opening: cache-misses
------------------------------------------------------------
perf_event_attr:
  type                             10 (cpu_atom)
  size                             144
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms: event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms: event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms: event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms: event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms: event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms: event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'ldlat' for pmu 'cpu_atom' (valid terms: event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms: event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms: event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
  config                           0x412e (cache-misses)
  sample_type                      IDENTIFIER
  read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
  disabled                         1
  inherit                          1
  enable_on_exec                   1
------------------------------------------------------------
sys_perf_event_open: pid 9255  cpu -1  group_fd -1  flags 0x8
sys_perf_event_open failed, error -12
Warning:
skipping event cache-misses that kernel failed to open.
The sys_perf_event_open() syscall failed for event (cache-misses): Cannot allocate memory
"dmesg | grep -i perf" may provide additional information.

Opening: cache-misses
------------------------------------------------------------
perf_event_attr:

  type                             4 (cpu_core)
  size                             144
  config                           0x412e (cache-misses)
  sample_type                      IDENTIFIER
  read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
  disabled                         1
  inherit                          1
  enable_on_exec                   1

------------------------------------------------------------
sys_perf_event_open: pid 9255 cpu -1 group_fd -1 flags 0x8 = 3
cache-misses: -1: 11224 321150 321150
failed to read counter cache-misses
cache-misses: 11224 321150 321150

Performance counter stats for 'sleep 1':

<not supported> cpu_atom/cache-misses/

            11,224      cpu_core/cache-misses/ 


       1.003110088 seconds time elapsed

       0.000000000 seconds user
       0.000846000 seconds sys
Quoted 49 lines · On 4/12/26 8:34 PM, Mi, Dapeng1 wrote:

The most possible reason for the "<not supported>" is that the "sleep 1" process runs on a P-core where "cpu_atom/cache-misses/" can't be supported. It's expected.

BTW, you can add "-vvv" option which gives more details like "sudo perf stat -e cache-misses -vvv sleep 1".

Thanks.

------------------------------------------------------------------------
*From:* Len Brown <[email protected]>
*Sent:* Saturday, April 11, 2026 2:09 AM
*To:* Arcari, David <[email protected]>; Mi, Dapeng1 <[email protected]>
*Cc:* Linux PM list <[email protected]>; Linux Kernel Mailing List <[email protected]> *Subject:* Re: [PATCH] tools/power turbostat: Allow execution to continue after perf_l2_init() failure

Quoted 17 lines · David Arcari

I'm using a Fedora kernel:

vmlinuz-7.0.0-0.rc4.260320g0e4f8f1a3d08.40.eln155.x86_64

And turbostat is:

# turbostat -v
turbostat version 2026.02.14 - Len Brown <[email protected]>
Quoted 8 lines

You can poke with "perf stat" as well, but this will depend on what .json counter list is compiled into
your version of perf.

probably a first sanity check would be if these commands for the LLC and the L2 work:

Quoted 8 lines
Quoted 2 lines

sudo perf stat -e cache-misses sleep 1
sudo perf stat -e L2_REQUEST.ALL sleep 1

# sudo perf stat -e cache-misses sleep 1

   Performance counter stats for 'sleep 1':

     <not supported>      cpu_atom/cache-misses/

I think this should work.  There may be an issue either with the perf utility or the perf kernel support on that system.

I'll cc Dapeng.  Already the weekend where he is, but maybe he can give us some perf insight next week.

thx,
-Len

A message that is not in the archive (sent off-list or not yet received): MN0PR11MB61604669C6DF6D1F372108EACD252@MN0PR11MB6160.namprd11.prod.outlook.com

#8 lore raw

kernel is a Fedora version of 7.0.0-0.rc4

I have two ADL systems that exhibit the same behavior.

# grep . /sys/devices/cpu_core/events/* /sys/devices/cpu_core/events/branch-instructions:event=0xc4 /sys/devices/cpu_core/events/branch-misses:event=0xc5 /sys/devices/cpu_core/events/bus-cycles:event=0x3c,umask=0x01 /sys/devices/cpu_core/events/cache-misses:event=0x2e,umask=0x41 /sys/devices/cpu_core/events/cache-references:event=0x2e,umask=0x4f /sys/devices/cpu_core/events/cpu-cycles:event=0x3c /sys/devices/cpu_core/events/instructions:event=0xc0 /sys/devices/cpu_core/events/mem-loads:event=0xcd,umask=0x1,ldlat=3 /sys/devices/cpu_core/events/mem-loads-aux:event=0x03,umask=0x82 /sys/devices/cpu_core/events/mem-stores:event=0xcd,umask=0x2 /sys/devices/cpu_core/events/ref-cycles:event=0x3c,umask=0x01 /sys/devices/cpu_core/events/slots:event=0x00,umask=0x4 /sys/devices/cpu_core/events/topdown-bad-spec:event=0x00,umask=0x81 /sys/devices/cpu_core/events/topdown-be-bound:event=0x00,umask=0x83 /sys/devices/cpu_core/events/topdown-br-mispredict:event=0x00,umask=0x85 /sys/devices/cpu_core/events/topdown-fe-bound:event=0x00,umask=0x82 /sys/devices/cpu_core/events/topdown-fetch-lat:event=0x00,umask=0x86 /sys/devices/cpu_core/events/topdown-heavy-ops:event=0x00,umask=0x84 /sys/devices/cpu_core/events/topdown-mem-bound:event=0x00,umask=0x87 /sys/devices/cpu_core/events/topdown-retiring:event=0x00,umask=0x80

# grep . /sys/devices/cpu_atom/events/*
/sys/devices/cpu_atom/events/branch-instructions:event=0xc4
/sys/devices/cpu_atom/events/branch-misses:event=0xc5
/sys/devices/cpu_atom/events/bus-cycles:event=0x3c,umask=0x01
/sys/devices/cpu_atom/events/cache-misses:event=0x2e,umask=0x41
/sys/devices/cpu_atom/events/cache-references:event=0x2e,umask=0x4f
/sys/devices/cpu_atom/events/cpu-cycles:event=0x3c
/sys/devices/cpu_atom/events/instructions:event=0xc0
grep: /sys/devices/cpu_atom/events/mem-loads: binary file matches
grep: /sys/devices/cpu_atom/events/mem-stores: binary file matches
/sys/devices/cpu_atom/events/ref-cycles:event=0x3c,umask=0x01
grep: /sys/devices/cpu_atom/events/topdown-bad-spec: binary file matches
grep: /sys/devices/cpu_atom/events/topdown-be-bound: binary file matches
grep: /sys/devices/cpu_atom/events/topdown-fe-bound: binary file matches
grep: /sys/devices/cpu_atom/events/topdown-retiring: binary file matches
Quoted 144 lines · On 4/13/26 9:22 PM, Mi, Dapeng1 wrote:

It looks strange. Suppose cache-misses event doesn't need to assign the offcore_rsp field. Could you please run below commands ?

grep . /sys/devices/cpu_core/events/*
grep . /sys/devices/cpu_atom/events/*

BTW, which kernel did you use? I would find a ADL and check if it can be reproduced. Thanks.

------------------------------------------------------------------------
*From:* David Arcari <[email protected]>
*Sent:* Monday, April 13, 2026 7:53 PM
*To:* Mi, Dapeng1 <[email protected]>; Len Brown <[email protected]>
*Cc:* Linux PM list <[email protected]>; Linux Kernel Mailing List <[email protected]> *Subject:* Re: [PATCH] tools/power turbostat: Allow execution to continue after perf_l2_init() failure

Here is the -vvv output:

# sudo perf stat -e cache-misses -vvv sleep 1
Control descriptor is not initialized
Opening: cache-misses
------------------------------------------------------------
perf_event_attr:
    type                             10 (cpu_atom)
    size                             144
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms:
event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms:
event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms:
event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms:
event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms:
event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms:
event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'ldlat' for pmu 'cpu_atom' (valid terms:
event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms:
event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
unknown term 'offcore_rsp' for pmu 'cpu_atom' (valid terms:
event,pc,edge,inv,umask,cmask,config,config1,config2,config3,config4,name,period,percore,metric-id,cpu)
    config                           0x412e (cache-misses)
    sample_type                      IDENTIFIER
    read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
    disabled                         1
    inherit                          1
    enable_on_exec                   1
------------------------------------------------------------
sys_perf_event_open: pid 9255  cpu -1  group_fd -1  flags 0x8
sys_perf_event_open failed, error -12
Warning:
skipping event cache-misses that kernel failed to open.
The sys_perf_event_open() syscall failed for event (cache-misses):
Cannot allocate memory
"dmesg | grep -i perf" may provide additional information.

Opening: cache-misses
------------------------------------------------------------
perf_event_attr:
   type                             4 (cpu_core)
   size                             144
   config                           0x412e (cache-misses) sample_type                      IDENTIFIER
   read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled                         1
   inherit                          1
   enable_on_exec                   1
------------------------------------------------------------
sys_perf_event_open: pid 9255  cpu -1  group_fd -1  flags 0x8 = 3
cache-misses: -1: 11224 321150 321150
failed to read counter cache-misses
cache-misses: 11224 321150 321150

  Performance counter stats for 'sleep 1':

    <not supported>      cpu_atom/cache-misses/

             11,224      cpu_core/cache-misses/

        1.003110088 seconds time elapsed

        0.000000000 seconds user
        0.000846000 seconds sys

Quoted 7 lines · On 4/12/26 8:34 PM, Mi, Dapeng1 wrote:

The most possible reason for the "<not supported>" is that the "sleep 1" process runs on a P-core where "cpu_atom/cache-misses/" can't be supported. It's expected.

BTW, you can add "-vvv" option which gives more details like "sudo perf stat -e cache-misses -vvv sleep 1".

Quoted 6 lines

Thanks.

------------------------------------------------------------------------
*From:* Len Brown <[email protected]>
*Sent:* Saturday, April 11, 2026 2:09 AM *To:* Arcari, David <[email protected]>; Mi, Dapeng1

<[email protected]>

Quoted 41 lines

*Cc:* Linux PM list <[email protected]>; Linux Kernel Mailing List <[email protected]>
*Subject:* Re: [PATCH] tools/power turbostat: Allow execution to continue after perf_l2_init() failure

On Fri, Apr 10, 2026 at 12:06 PM David Arcari <[email protected]> wrote:

  > I'm using a Fedora kernel:
  >
  > vmlinuz-7.0.0-0.rc4.260320g0e4f8f1a3d08.40.eln155.x86_64
  >
  > And turbostat is:
  >
  > # turbostat -v
  > turbostat version 2026.02.14 - Len Brown <[email protected]> >
  > >
  > > You can poke with "perf stat" as well, but this will depend on what > > .json counter list is compiled into
  > > your version of perf.
  > >
  > > probably a first sanity check would be if these commands for the LLC > > and the L2 work:
  > >
  > > sudo perf stat -e cache-misses sleep 1
  > > sudo perf stat -e L2_REQUEST.ALL sleep 1
  >
  > # sudo perf stat -e cache-misses sleep 1
  >
  >   Performance counter stats for 'sleep 1':
  >
  >     <not supported>      cpu_atom/cache-misses/

I think this should work.  There may be an issue either with the perf utility or the perf kernel support on that system.

I'll cc Dapeng.  Already the weekend where he is, but maybe he can give us some perf insight next week.

thx,
-Len