Hi,
I'd like to use perf record to look into some performance counters. I'm using a ThunderX2 system with Centos 8. When i use any of the uncore counters such as uncore_l3c_0/evict_request/, uncore_dmc_1/cnt_cycles/, uncore_dmc_0/cnt_cycles/ I get the same error "The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event ..." Do you guys have any suggestions? see below for more details. Thanks
# rpm -qa |grep perf python3-perf-4.18.0-240.el8.aarch64 perftest-4.4-3.el8.aarch64 perf-4.18.0-240.el8.aarch64 qperf-0.4.11-1.el8.aarch64 # uname -r 4.18.0-240.el8.aarch64 # perf record -a -e uncore_dmc_0/cnt_cycles/ ls Lowering default frequency rate to 1600. Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate. Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_dmc_0/cnt_cycles/). /bin/dmesg | grep -i perf may provide additional information. # /bin/dmesg | grep -i perf |tail -n 3 [194444.313119] perf: interrupt took too long (38453 > 38357), lowering kernel.perf_event_max_sample_rate to 5200 [194444.388648] perf: interrupt took too long (48338 > 48066), lowering kernel.perf_event_max_sample_rate to 4100 [194961.878397] perf: interrupt took too long (60611 > 60422), lowering kernel.perf_event_max_sample_rate to 3200
Unfortunately the error feedback for perf event open isn't that great but it looks like this is the -22 (EINVAL) return code that you are getting. Uncore events just don't support sampling (i.e. perf record) and this is a limitation in the ThunderX2 PMU driver:
/* * SOC PMU counters are shared across all cores. * Therefore, it does not support per-process mode. * Also, it does not support event sampling mode. */ if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK) return -EINVAL;
If you want the counter values then perf stat works for me on TX2:
$ sudo ./perf stat -e uncore_dmc_0/cnt_cycles/ ls ... Performance counter stats for 'system wide': 15,638,408 uncore_dmc_0/cnt_cycles/ 0.001504234 seconds time elapsed
Thanks
James
Thanks for the tip. I tested it and it worked.
# started on Wed May 5 13:11:18 2021 Performance counter stats for 'system wide': 38565488800 uncore_dmc_0/cnt_cycles/ 1783808 uncore_dmc_0/data_transfers/ 3.766226605 seconds time elapsed