7

I was tying to use perf on Renesas target and I configured the yocto "local.conf" as showed in this link.

#avoid stripping binaries 
INHIBIT_PACKAGE_STRIP = "1"

#add the debug information
EXTRA_IMAGE_FEATURES= "debug-tweaks tools-debug dbg-pkgs tools-profile"

#format the debug info into a readable format for PERF
PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory'

perf is working but I need to monitor the context switches which require to use perf timechart and other commands that depends on perf-events, but the commands can't find this path "/sys/kernel/debug/tracing/events" .

What should I do in order to get this folder and its files compiled with my kernel?

Guido
  • 103
  • 4
gemad
  • 83
  • 1
  • 5

3 Answers3

7

You probably need to mount the debugfs filesystem:

mount -t debugfs none /sys/kernel/debug

If you already have a startup script of your own in /etc/init.d/ it should be possible to add it there, or you might add it to /etc/fstab as

debugfs /sys/kernel/debug debugfs defaults
meuh
  • 49,672
  • 2
  • 52
  • 114
  • 1
    this folder already mounted but the debug folder have no folders named events – gemad Jul 10 '17 at 09:41
  • Did your kernel get compiled with `CONFIG_PERF_EVENTS=y` ? – meuh Jul 10 '17 at 10:06
  • where should i add this option ? – gemad Jul 10 '17 at 10:08
  • Did you check if it is already there? If not yocto has its own way complex way of handling the kernel config. You need to look for examples of creating your own `.bbappend` recipe in `recipes-kernel` to add the line `CONFIG_PERF_EVENTS=y` to `${B}/.config` and run `yes '' | oe_runmake oldconfig`. – meuh Jul 10 '17 at 14:20
  • 1
    I did so and recompiled , but still th events folder not exist at the debug folder , only those files and folders do , { asoc, dri, hid, pm_qos, sleep_time, bdi, extfrag, memblock, pwm, suspend_stats, clk , fault_around_bytes, mmc0, regmap ,usb, debug_enabled, gcov, opp, regulator, virtio-ports, dma_buf, gpio, pinctrl, sched_features, wakeup_sources } – gemad Jul 11 '17 at 07:32
  • Not all cpu architectures support events. Can you find the `.config` file actually used by the build (somewhere in `.../tmp/...`) and check if it has `CONFIG_HAVE_PERF_EVENTS=y`, for example. – meuh Jul 12 '17 at 19:46
  • -my board use ARM A57 and A53 cores which have a PMUs. (Renesas R-car) -both of the CONFIG_HAVE_PERF_EVENT=y && CONFIG_PERF_EVENT=y exist – gemad Jul 13 '17 at 10:43
2

I found an answer for this exact same problem I had here.

The steps to fully 'activate' ftrace on the Linux kernel are:

  • bitbake -c menuconfig linux-imx (the target is going to be different for each board so you have to look it up)
  • Then from the menu choose 'Kernel Hacking' -> Tracers. Type 'Y' to activate.
  • Go into the Tracers sub-directory and enable 'Function Tracers' (this also enables 'Function Graph Tracers'.
  • Save the config file, overwriting your current one, and rebuild.
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
0

In my case, with yocto and a 5.10 kernel, the proper kernel config options were enabled. However, only /sys/kernel/tracing was mounted, and the path /sys/kernel/debug/tracing (which should be mounted for backwards compatibility when debugfs is mounted according to the doc) was missing, because of the option CONFIG_TRACEFS_DISABLE_AUTOMOUNT=y.

Étienne
  • 123
  • 9