How do I enable kernel debug symbols for use with perf?

I’d love to use pef for profiling my application and the kernel. I am running perf as

$ doas perf record -g --call-graph dwarf my-app
$ doas chown  $USER perf.data
$ perf script -F +pid > perf_profile

but the resulting profile includes symbolic names for my app only:

image

I think this is because I am missing debug symbols for my kernel.

How do I fix this problem?

apparently you need to run perf script as root. this command will read /proc/kallsyms but when a non-root process reads this file all addresses are redacted (replaced by zero).

Doing so I got this:

2 Likes

Oh dear, how embarrassing, this indeed is the problem, thanks! :sweat_smile: