koute / not-perf

A sampling CPU profiler for Linux
Apache License 2.0
871 stars 41 forks source link

The perf_event_open syscall failed for PID XXX #34

Closed ivansanchez-oss closed 1 year ago

ivansanchez-oss commented 1 year ago

Hi, i am trying to run not-perf on an armv7 machine but when i try to run nperf record -p XXX it says perf_event_open failed, maybe it's some silly mistake of mine and I have to edit some other file that I have no idea about or something like that but I haven't found more information on the internet

This is the machine

# lscpu
Architecture:          armv7l
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
Model name:            ARMv7 Processor rev 10 (v7l)

the perf_event_paranoid file

# cat /proc/sys/kernel/perf_event_paranoid
0

this is the output from nperf

[2001-01-08T22:20:43Z INFO  nperf_core::profiler] Opening "20010108_222043_00223_web_server.nperf" for writing...
[2001-01-08T22:20:43Z INFO  nperf_core::cmd_record] Opening perf events for process with PID 223...
[2001-01-08T22:20:43Z ERROR perf_event_open::perf] The perf_event_open syscall failed for PID 223: Operation not permitted (os error 1)
[2001-01-08T22:20:43Z WARN  nwind::frame_descriptions] No .eh_frame section found for '[vdso]'
[2001-01-08T22:20:43Z INFO  nperf_core::cmd_record] Enabling perf events...
[2001-01-08T22:20:43Z INFO  nperf_core::cmd_record] Running...
[2001-01-08T22:20:43Z INFO  nperf_core::profiler] Finished output file initialization
[2001-01-08T22:20:52Z INFO  nperf_core::profiler] Collected 0 samples in total!
koute commented 1 year ago

Can you try setting /proc/sys/kernel/perf_event_paranoid to -1 and try again?

ivansanchez-oss commented 1 year ago

with /proc/sys/kernel/perf_event_paranoid at -1 it still doesn't work but it seems to be a specific problem on the machine since the the PMU isn't being described to the kernel so I'll close this topic, thank you very much!