I am using perf to monitor the system for certain events. However, I get the following error and I have no idea where it comes from,as the event is listed in perf list
sudo perf record -e msr/tsc/ -a
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (msr/tsc/).
/bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?
How can I check No CONFIG_PERF_EVENTS=y kernel support configured?
**Some test results:
sudo dmesg | grep "perf\|pmu"**
[ 0.029179] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
[ 0.029179] ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)
[ 9475.406967] perf: interrupt took too long (2509 > 2500), lowering kernel.perf_event_max_sample_rate to 79500
[ 9475.990901] perf: interrupt took too long (3146 > 3136), lowering kernel.perf_event_max_sample_rate to 63500
[ 9476.886941] perf: interrupt took too long (3942 > 3932), lowering kernel.perf_event_max_sample_rate to 50500
[76057.268195] perf: interrupt took too long (4934 > 4927), lowering kernel.perf_event_max_sample_rate to 40500
[167368.007839] perf: interrupt took too long (6171 > 6167), lowering kernel.perf_event_max_sample_rate to 32250
[168338.165608] perf: interrupt took too long (7804 > 7713), lowering kernel.perf_event_max_sample_rate to 25500
perf list |grep msr
msr/aperf/ [Kernel PMU event]
msr/mperf/ [Kernel PMU event]
msr/pperf/ [Kernel PMU event]
msr/smi/ [Kernel PMU event]
msr/tsc/
sudo uname -a Linux bla 4.9.0-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
sudo /proc/config.gz returns command not found Any help/ideas are appreciated.
There was a patch introduced in
perfto support MSR Performance Monitoring Units. These MSR PMUs support free-running MSR counters. These counters include time and frequency-based counters likeTSC,IA32_APERF,IA32_MPERFandIA32_PPERF.These MSR events do not support sampling modes. As visible by this line of code in the linux kernel(v4.9) source code.
Snippet:
if event->attr.sample_period) /* no sampling */ return -EINVAL;perf_eventscan instrument in three ways (counting events, sampling events and bpf events). Remember that when you runperf record, you are now invoking the sampling mode. Even though you do not explicitly specify thesampling period, internally sampling is happening at a default sampling frequency.To count
msrevents, you need to runperf_eventsin counting/aggregation mode. You runperf statfor this --Read this to understand more about counting and sampling events/modes.