powerapi: RAPL_ENERGY_PKG is invalid or unsupported by this machine

Hi Power API team,

I’ve tried to run a couple of tests, but apparently sensor is failing to start off, due to unsupported event group. The processor architecture in which I’m running tests has Willow Cove architecture, which is from 2020 (i.e. Sandy Brige +).

Machine characteristics:

  • Processor architecture: Willow Cove
  • Processor collection: 11th Generation Intel® Core™ i7 Processors
  • Cores: 4
  • Threads: 8
$ sudo lshw -C CPU            
 *-cpu                     
      description: CPU
      product: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
      vendor: Intel Corp.
      physical id: 400
      bus info: cpu@0
      version: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
      slot: U3E1
      size: 2704MHz
      capacity: 4800MHz
      width: 64 bits
      clock: 100MHz
      capabilities: lm fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp x86-64 constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l2 invpcid_single cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves split_lock_detect dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid movdiri movdir64b fsrm avx512_vp2intersect md_clear flush_l1d arch_capabilities cpufreq
      configuration: cores=4 enabledcores=4 threads=8

Steps I took

  1. Install MongoDb (as docker container)
  2. Install powerapi-sensor (as docker container)
docker run --net=host --privileged --name powerapi-sensor -d \
           -v /tmp/sys:/sys -v /var/lib/docker/containers:/var/lib/docker/containers:ro \
           -v /tmp/powerapi-sensor-reporting:/reporting \
		   powerapi/hwpc-sensor:latest \
		   -n "powerapi" \
		   -r "mongodb" -U "mongodb://127.0.0.1:27888" -D "db1" -C "col1" \
		   -s "rapl" -o -e "RAPL_ENERGY_PKG" \
		   -s "msr" -e "TSC" -e "APERF" -e "MPERF" \
		   -c "core" -e "CPU_CLK_THREAD_UNHALTED:REF_P" -e "CPU_CLK_THREAD_UNHALTED:THREAD_P" \
                     -e "LLC_MISSES" -e "INSTRUCTIONS_RETIRED"

Container logs:

I: 21-12-07 11:14:26 build: version undefined (rev: undefined) (Sep 28 2021 - 14:40:24)
I: 21-12-07 11:14:26 uname: Linux 5.13.0-1020-oem #24-Ubuntu SMP Thu Nov 11 14:28:56 UTC 2021 x86_64
E: 21-12-07 11:14:26 config: event 'RAPL_ENERGY_PKG' is invalid or unsupported by this machine
E: 21-12-07 11:14:26 config: failed to parse the provided command-line arguments

I would appreciate if you could help out for me to move forward, do you think there is something I’m missing? Thanks.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

I was having the same issue with following setup, though my system has rapl drivers and perf is able to access it perfectly.

OS: Ubuntu 20.04.5 LTS
Linux Kernel: 5.15.0-58-generic
Processor: 12th Gen Intel® Core™ i5-12500 × 12 

After debugging the hwpc-sensor, I found that it’s using pfm_get_os_event_encoding from libpfm to verify the provided events.

Unfortunately, that library has not been updated according to the latest Linux perf interface.

So as a quick hack I commented the call in src/events.c:setup_perf_event_attr and it works fine for me.

I don’t have the time to create a proper fix. I hope it helps!

It’s not a commit that broke the counter but an update on the linux kernel change the way to access counters via perf_event and we did not updated to the last version of the kernel yet. If you can try on a system with an older linux kernel it should work.

Just a heads up, there are some RAPL results available in the machine

$ ls /sys/class/powercap/intel-rapl:0
constraint_0_max_power_uw    constraint_0_time_window_us  constraint_1_power_limit_uw  constraint_2_name            device     intel-rapl:0:0       name       uevent
constraint_0_name            constraint_1_max_power_uw    constraint_1_time_window_us  constraint_2_power_limit_uw  enabled    intel-rapl:0:1       power
constraint_0_power_limit_uw  constraint_1_name            constraint_2_max_power_uw    constraint_2_time_window_us  energy_uj  max_energy_range_uj  subsystem

The problem come from the fact that you are using /tmp/sys instead of /sys in the volumes. This folder is used to read rapl and /tmp/sys do not contain the needed information (like RAPL).