Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAPL_ENERGY_PKG is invalid or unsupported by this machine #125

Open
fmuyassarov opened this issue Dec 7, 2021 · 19 comments
Open

RAPL_ENERGY_PKG is invalid or unsupported by this machine #125

fmuyassarov opened this issue Dec 7, 2021 · 19 comments
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested

Comments

@fmuyassarov
Copy link

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.

@fmuyassarov
Copy link
Author

/cc @altor @rouvoy

@ldesauw ldesauw self-assigned this Dec 7, 2021
@rouvoy rouvoy added bug Something isn't working help wanted Extra attention is needed question Further information is requested labels Dec 7, 2021
@rouvoy
Copy link
Contributor

rouvoy commented Dec 7, 2021

Thanks for reaching out @fmuyassarov, we will have a look to your issue with @ldesauw and come back to you asap.

@fmuyassarov
Copy link
Author

Thanks a lot @rouvoy and @ldesauw . Let me know if there is more info needed from my side.

@ldesauw
Copy link
Contributor

ldesauw commented Dec 7, 2021

I've reproduced your problem on my machine using your command line.
Could you try this one :

docker run --privileged --rm --name sensorhwpc --network="host" --pid host \
   -v /sys:/sys  \
   -v /var/lib/docker/containers:/var/lib/docker/containers:ro     \
   -v /tmp/powerapi-sensor-reporting:/reporting \
   powerapi/hwpc-sensor \
   -n sensor \
   -f 500 \
   -r mongodb -U "mongodb://127.0.0.1:27888" -D db -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"

@ldesauw
Copy link
Contributor

ldesauw commented Dec 7, 2021

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).

@fmuyassarov
Copy link
Author

Thank you. That makes sense. But I still get the same error for the pkg + flags. I wonder if there is some kind of typo I'm doing when passing those arguments.

docker run --privileged --rm --name sensorhwpc --network="host" --pid host \
   -v /sys:/sys  \
   -v /var/lib/docker/containers:/var/lib/docker/containers:ro     \
   -v /tmp/powerapi-sensor-reporting:/reporting \
   powerapi/hwpc-sensor \
   -n sensor \
   -f 500 \
   -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"
I: 21-12-07 13:55:40 build: version undefined (rev: undefined) (Sep 28 2021 - 14:40:24)
I: 21-12-07 13:55:40 uname: Linux 5.13.0-1020-oem #24-Ubuntu SMP Thu Nov 11 14:28:56 UTC 2021 x86_64
E: 21-12-07 13:55:40 config: event 'RAPL_ENERGY_PKG' is invalid or unsupported by this machine
E: 21-12-07 13:55:40 config: failed to parse the provided command-line arguments

@fmuyassarov
Copy link
Author

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

@ldesauw
Copy link
Contributor

ldesauw commented Dec 7, 2021

It appears that recent change in the kernel broke the way we acceded the perf counter, we are currently working on solving that.

@fmuyassarov
Copy link
Author

I see, thanks for verifying. Do you know the hash of the commit that you think potentially broke the counter? Perhaps, meanwhile I can go back on the git history and try it out with older releases.

@ldesauw
Copy link
Contributor

ldesauw commented Dec 7, 2021

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.

@ldesauw
Copy link
Contributor

ldesauw commented Dec 7, 2021

@fmuyassarov could you provide me your kernel version ?

@fmuyassarov
Copy link
Author

Sure, it is 5.13.0-1020-oem

@PierreRustOrange
Copy link
Contributor

PierreRustOrange commented Dec 16, 2021

Hi @fmuyassarov could you check you the module for rapl access is loaded ? see powerapi-ng/hwpc-sensor#20 for details.

@fmuyassarov
Copy link
Author

Hi @PierreRustOrange . I think it isn't unfortunately

$ perf list | grep energy
$ sudo perf stat -a -e "power/energy-cores/" /bin/ls                              
event syntax error: 'power/energy-cores/'
                     \___ Cannot find PMU `power'. Missing kernel support?
Run 'perf list' for a list of valid events

 Usage: perf stat [<options>] [<command>]

    -e, --event <event>   event selector. use 'perf list' to list available events

@fmuyassarov
Copy link
Author

fmuyassarov commented Dec 16, 2021

I'm wondering if it's just issue with perf access

@fmuyassarov
Copy link
Author

as you said I have rapl values, but the issue is with the access probably

$ sudo ./rapl-read

RAPL read -- use -s for sysfs, -p for perf_event, -m for msr

Found Unsupported model 140
 Processor type
	0 (0), 1 (0), 2 (0), 3 (0), 4 (0), 5 (0), 6 (0), 7 (0)
	
	Detected 8 cores in 1 packages


Trying sysfs powercap interface to gather results

	Sleeping 1 second

	Package 0
		package-0	: 6.549300J
		core	: 3.245536J
		uncore	: 0.044190J

@fmuyassarov
Copy link
Author

@ldesauw I was able to run the sensor on 5.11.0-40-generic Kernel with no issues.

@PierreRustOrange
Copy link
Contributor

@fmuyassarov : ok, correct me if I did not get this right :

  • on a Willow Cove i7-1185G7 cpu, with a 5.13.0-1020-oem kernel you have rapl access though the powercaop sysfs but not with perf and the hwpc-sensor
  • on the same processor, with a 5.11.0-40-generic kernel, this works fine, both withe the sensor and perf

Can you check that you have the right module when using 5.13.0-1020-oem ?

lsmod | grep rap
intel_rapl_msr         20480  0
intel_rapl_common      28672  2 intel_rapl_msr,processor_thermal_device
intel_rapl_perf        20480  0

If it's not the case you should be able to install it (see powerapi-ng/hwpc-sensor#20), please tell us if that solve the issue on that kernel version.

@psolve
Copy link

psolve commented Feb 9, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants