Perf tool 820c with linaro debian

Hi,

I am using dragon board 820c. Its running “Debian GNU/Linux buster/sid”.
Kernal: Linux linaro-alip 4.11.0-qcomlt.

When I try to run perf in terminal, it says exec:perf_4.11: not found. E: linux-perf-4.11 is not installed.
What should I do?

I checked whether the perf events are enabled in Linux Kernel and it is fine. Except ,
$ cat /proc/sys/kernel/perf_event_paranoid
2
Some document says it has to be 1 and some says it has to be -1. But I could not change it with sudo permission.

Is it possible to be super user, what is the password?

Thanks,
S

Either you can install linux-perf-4.16 and hope it is “compatible enough” with your v4.11 kernel. My DB820C has a running the more recent 4.14-qcomlt kernel and perf_4.16 top appears to be working OK. Alternatively you can build perf from the kernel sources (from the top level of the source make -C tools/perf will work… and cross-compiling with CROSS_COMPILE works fine).

To become super user when try sudo su.

1 Like

Thanks!

Can I get the source code by sudo apt-get install linux-source and install it (which we usually do with ubuntu/debian desktops), so that boot loader can be configured to load the new kernal?

Will this method work for this linaro debian kernal?

Thanks,
S

1 Like

That will fetch the source to the Debian kernel, not the custom one supplied with this image.

The kernel build guide for 820c is here (if you want to run the build on the 820C itself then skip the entire of the “Set up Toolchain Environment” section):

Hi Danielt,

Thank you for the information on the perf tool. I was trying to run the tool on my dragonboard-820. I compiled the source for perf per your instructions on a virtual machine running Ubuntu. Then I copied the perf tool to my dragonboard. It seems to run with “record” ok. But when I run with report, I don’t see symbol names for an application I am running. I just see the addresses and no function names. Any suggestions? The program is built with -g2.

These are the commands I run:
sudo ./perf record -g -a -F 97
sudo ./perf report --stdio

This is some of the output I see:
25.00% 0.00% DSP0 VTNext_ARM64_Debug.out [.] 0xffff5555404aa4b8
|
—0xf94b8
0x10128c
0xfee34
|
|–23.38%–0xfc5f4
| |
| |–22.68%–0x2797f4
| | |
| | |–21.26%–0x261ec0
| | | 0x261964
| | | |
| | | |–7.97%–0x32540c
| | | | 0x322cc4
| | | | |
| | | | --7.88%–0x322a54
| | | | 0x322708

I’ve tried the suggestions from this post, but nothing has changed: linux - How can I get perf to find symbols in my program - Stack Overflow

When I build the perf tool, I get these for options:

Auto-detecting system features:
… dwarf: [ OFF ]
… dwarf_getlocations: [ OFF ]
… glibc: [ on ]
… gtk2: [ OFF ]
… libaudit: [ OFF ]
… libbfd: [ OFF ]
… libelf: [ OFF ]
… libnuma: [ OFF ]
… numa_num_possible_cpus: [ OFF ]
… libperl: [ OFF ]
… libpython: [ OFF ]
… libslang: [ OFF ]
… libcrypto: [ OFF ]
… libunwind: [ OFF ]
… libdw-dwarf-unwind: [ OFF ]
… zlib: [ OFF ]
… lzma: [ OFF ]
… get_cpuid: [ OFF ]
… bpf: [ on ]

Thanks,
Kim

When you cross-compile it looks like several perf features get turned off because the build system cannot find some of the libraries.

Try building on the target instead (and use apt to install the appropriate -dev packages).

Hi Danielt,
I tried your suggestion of building on the target, but I get these errors:
CC debug.o
CC pager.o
CC str_error_r.o
pager.c: In function ‘pager_preexec’:
pager.c:36:12: error: passing argument 2 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
select(1, &in, NULL, &in, NULL);
^~~ ~~~
…/str_error_r.c: In function ‘str_error_r’:
…/str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
snprintf(buf, buflen, “INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d”, errnum, buf, buflen, err);
^~~~~~~~
cc1: all warnings being treated as errors
mv: cannot stat ‘./.str_error_r.o.tmp’: No such file or directory
Build:8: recipe for target ‘str_error_r.o’ failed
make[4]: *** [str_error_r.o] Error 1
Makefile:56: recipe for target ‘libapi-in.o’ failed
make[3]: *** [libapi-in.o] Error 2
Makefile.perf:643: recipe for target ‘/home/linaro/Downloads/820dev/kernel/tools/lib/api/libapi.a’ failed
make[2]: *** [/home/linaro/Downloads/820dev/kernel/tools/lib/api/libapi.a] Error 2
make[2]: *** Waiting for unfinished jobs…
CC event-plugin.o
cc1: all warnings being treated as errors
mv: cannot stat ‘./.pager.o.tmp’: No such file or directory
/home/linaro/Downloads/820dev/kernel/tools/build/Makefile.build:96: recipe for target ‘pager.o’ failed
make[4]: *** [pager.o] Error 1
Makefile:52: recipe for target ‘libsubcmd-in.o’ failed
make[3]: *** [libsubcmd-in.o] Error 2
Makefile.perf:657: recipe for target ‘/home/linaro/Downloads/820dev/kernel/tools/lib/subcmd/libsubcmd.a’ failed
make[2]: *** [/home/linaro/Downloads/820dev/kernel/tools/lib/subcmd/libsubcmd.a] Error 2
CC trace-seq.o
CC parse-filter.o
CC parse-utils.o
CC kbuffer-parse.o
LD libtraceevent-in.o
LINK libtraceevent.a
PERF_VERSION = 4.14.g5a7877
Makefile.perf:209: recipe for target ‘sub-make’ failed
make[1]: *** [sub-make] Error 2
Makefile:69: recipe for target ‘all’ failed
make: *** [all] Error 2

I got the build of perf to work on another SOM, which also had the same build issues, by using gcc version 7 compiler. Thanks,
kimbo

Thanks for the update.

For future reference: if you are trying to build old versions of
perf (such as v4.14) with a very new compiler you can add WERROR=0 to
prevent any newly introduced warnings from causing the build to fail.

(cd tools/perf; make WERROR=0)