oprofile on the iMX6 platform error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

oprofile on the iMX6 platform error

Jump to solution
5,632 Views
leroy_o
Contributor III

Hello,

has anyone got oprofile working on the i.MX6 platform?

I used to use oprofile on the i.MX51 platform, and it worked perfectly. I follow the same procedure on the i.MX6, and I always get the same error:

opreport error: No sample file found: try running opcontrol --dump

or specify a session containing sample files

I have this error with kernels 3.0.15 and 3.0.35 from ltib.


oprofile procedure:


# opcontrol --deinit
# opcontrol --vmlinux=/boot/vmlinux-3.0.35
# opcontrol --init
# opcontrol --reset
# opcontrol --start
# ./test-program
# opcontrol --stop
# opreport -l ./test-program 
Labels (2)
Tags (2)
1 Solution
2,090 Views
janhorbach
Contributor II

I stumbled across the same problem and I added the following line to arch/arm/mach-mx6/board-mx6q_sabrelite.c (which I found in board-mx6q_sabresd.c) in the kernel source tree:

imx6_add_armpmu();

directly above the imx6q_add_perfmon() calls in the mx6_sabrelite_board_init() function.

This requires kernel sources and recompile, tho.

That line was missing for a reason for sure - but at least "perf stat" seems to work with that change... "perf top" seems to lead to backtraces due to IRQs nobody cared for, tho... maybe oprofile will work better...

View solution in original post

0 Kudos
13 Replies
2,090 Views
ko-hey
Senior Contributor II

Hi LeonardoSandovalGonzalez

I got oprofile error with i.MX6Q and L4.1.15.

Could you advise to avoid following error message ?

When I execute the oprofile, I got the message in my custom board.

irq 22: nobody cared (try booting with the "irqpoll" option)

Ko-hey

0 Kudos
2,090 Views
pavanpatil
Contributor I

Hi all,

i have been trying to use oprofile for my imx6 sabrelite target.

has anyone managed to oprofile-9.7 or later version working with imx6q_sabrelite.

i did compilation of oprofile-0.9.8 for target,using timer mode it's showing me the flat profile but not callgraph.

without timer mode i can't get opreport properly,


following command giving me error

opcontrol --start

hw perfevents: unable to reserve pmu

Profiler running.

Regards

Pavan

0 Kudos
2,090 Views
janhorbach
Contributor II

The sabrelite seems to lack PMU support in the kernel.

I tried adding a function to add this support (see above) and the error message is gone then - but it still doesn't work properly afterwards.

Although I managed to get a callgraph (calls also see above), so it might still be worth a try...

0 Kudos
2,090 Views
pavanpatil
Contributor I

thanks for the help.

anyway are there any profiler does the same job on arm target?

0 Kudos
2,090 Views
LeonardoSandova
Specialist I

The most basic profiling you can do (I think) is through strace and its brother ltrace command. The former trace system calls, the latter, the library calls. The [arameter '-c' in both provides a nice report.

Leo

0 Kudos
2,090 Views
janhorbach
Contributor II

Has anyone got oprofile (or perf) running on the SabreLite or SabreAuto board? Whatever I do, i only get CPU_CYCLES samples. Here's what I've been trying:

Compile and install oprofile-0.9.8:

The version in LTIB (L3.0.35_4.0.0_130424) is too old...

Add PMU support to kernel:

Add imx6_add_armpmu(); to  arch/arm/mach-mx6/board-mx6q_sabrelite.c and ~sabreauto.c to get rid of the "unable to reserve pmu" message.

Initialisation:

I need to disable all but one core to get rid of the unhandled IRQ exceptions in the kernel...

echo "0" > /sys/devices/system/cpu/cpu3/online

echo "0" > /sys/devices/system/cpu/cpu2/online

echo "0" > /sys/devices/system/cpu/cpu1/online

#modprobe oprofile #timer=1  # it's compiled into the kernel now


With operf:

operf --callgraph --vmlinux /boot/vmlinux --events CPU_CYCLES:100000:0:1:1,L1D_CACHE:10000:0:1:1,L2D_CACHE:10000:0:1:1,\

BUS_ACCESS:100000:0:1:1,BUS_CYCLES:100000:0:1:1,UNALIGNED_LDST_RETIRED:10000:0:1:1 program

opreport


With opcontrol:

opcontrol --callgraph=8 --separate=kernel --vmlinux=/boot/vmlinux

opcontrol --event=CPU_CYCLES:100000:0:1:1 --event=L1D_CACHE:100000:0:1:1 --event=L2D_CACHE:10000:0:1:1\

--event=BUS_ACCESS:100000:0:1:1 --event=BUS_CYCLES:100000:0:1:1 --event=UNALIGNED_LDST_RETIRED:10000:0:1:1

opcontrol --init

opcontrol --reset

opcontrol --start-daemon

opcontrol --status

opcontrol --start

program

opcontrol --dump

opreport

So, is there anything wrong with what I'm doing (apart from the really ugly hack in the kernel)? Am I missing something obvious? I heard that oprofile should be supported in this LTIB version, but it really seems only the timer mode is working and even with the ugly hack and a newer oprofile only CPU_CYCLES samples can be obtained.

0 Kudos
2,090 Views
LeonardoSandova
Specialist I

By change, have you done the same steps on a Yocto image? Not sure if you will find the same problems...

I found this link, useful for a quick start-up

Yocto Project Development Manual

0 Kudos
2,090 Views
janhorbach
Contributor II

Is there a chance to get a newer kernel than 3.0.35 for LTIB?

Or at least a newer kernel at all that contains the Freescale patches for the i.MX6?

I had a look at the Yocto kernel images, but they don't seem to contain it.. and I couldn't find additional layers with the Freescale stuff either.

It would be really helpful to have a newer kernel, e.g. 3.7+

But 3.5.7 would be helpful already as well (LTIB seems to be prepared for this version).

Thank you!

0 Kudos
2,090 Views
LeonardoSandova
Specialist I

Hi, now 3.10.17 is ready, ready to be bake through Yocto.

BTW, at least on 3.10.17, adding the maxcpus=1 to the kernel line allow to run oprofile/perf without problem. This is ugly but at least so can profile one core.

2,090 Views
janhorbach
Contributor II

I haven't had the time yet to try it with Yocto.

To be honest, I'm not sure it's worth the effort to try it because the kernel does seem to lack PMU support for these boards.

And I'm sure it's not in there for a reason, probably related to Re: [PATCH 0/9] ARM perf updates for 3.7 — ARM, OMAP, Xscale Linux Kernel - as pointed out by henryyei.

With a newer kernel, this might be different, though... but as I said, I didn't try yet.

Anyway, thanks for the link, it was still really helpful, especially the linked Yocto Project Profiling and Tracing Manual.

0 Kudos
2,091 Views
janhorbach
Contributor II

I stumbled across the same problem and I added the following line to arch/arm/mach-mx6/board-mx6q_sabrelite.c (which I found in board-mx6q_sabresd.c) in the kernel source tree:

imx6_add_armpmu();

directly above the imx6q_add_perfmon() calls in the mx6_sabrelite_board_init() function.

This requires kernel sources and recompile, tho.

That line was missing for a reason for sure - but at least "perf stat" seems to work with that change... "perf top" seems to lead to backtraces due to IRQs nobody cared for, tho... maybe oprofile will work better...

0 Kudos
2,090 Views
henryyei
Contributor I

You can try timer mode by loading the oprofile module with the command:

modprobe oprofile timer=1

I do not think the kernel currently supports events and oprofile properly on the imx6 platform, based on the information I've seen here.:

Re: [PATCH 0/9] ARM perf updates for 3.7 — ARM, OMAP, Xscale Linux Kernel

2,090 Views
leroy_o
Contributor III

oprofile seems to be OK if I use modprobe oprofile timer=1, and if core1, core2 and core3 are invalidated with 'echo "0" > /sys/devices/system/cpu/cpu3/online', ... commands.

I can get opreport correctly.

0 Kudos