Question regarding the attached instructions. #5 Modify arch/processor/kernel/timer.c to record oprofile sampels. Are there existing examples or is that just the do_profile function in all the existing archs?

William Cohen <> wrote:
Dave Jiang wrote:
> I'm looking into getting Oprofile running on the XScale architecture
> (ARM). What is needed to do this? Can oprofile be enabled without arch
> specific code or do I need to create an oprofile dir under arch/arm/ and
> put in necessary support code? Thanks!

OProfile needs to be integrated into each new architecture. The amount
of code that needed to be added is relatively small at this point. In
some earlier email I wrote up some steps porting OProfile to new
architectures. I have attached the earlier email to this message. This
should outline what needs to be done. There are probably some changes
since this was written, e.g. the consolidation of the code for the timer
interrupt data.

I don't know which kernel you are planning on doing the working, 2.4 or
2.6. It would be preferable to do the work in the 2.6 kernel. If the
work has to go into a 2.4 kernel,you might use the backport Red Hat has
in its kernel to provide the 2.6 oprofile kernel support in a 2.4
kernel. The one caution is the patch is missing the pointer_size in the
/dev/oprofile, so the development verions of OProfile won't work with
the the backport.

Steps to port oprofile to new architecture
William Cohen
Wed, 16 Jul 2003 11:02:19 -0400

I wrote up a simple outline of steps to provide basic TIMER_INT OProfile support to the 2.5 kernel. Comments on them? I would think this would be something that would end up in an "OProfile Internals" manual.


List of things need to do for minimal oprofile timer interrupt support
for platform for 2.5 kernel

1) create arch/processor/oprofile directory
2) put arch/processor/oprofile/Makefile
3) Add to arch/processor/Kconfig just before "Kernel hacking" section:

source "arch/processor/oprofile/Kconfig"

4) Add to arch/processor/Makefile:

# must be linked after kernel/
drivers-$(CONFIG_OPROFILE) += arch/processor/oprofile/

5) Modify arch/processor/kernel/timer.c to record oprofile samples

6) Adding support for lookup_dcookie.
Add __NR_lookup_dcookie entry to include/asm-processor/unistd.h
May also need additional support in arch/processor/kernel for
processors that have 64-bit kernel and 32-bit user space, e.g. ppc64.
Need to add lookup_dcookie entry to syscall table.

7) For older 2.4 kernel you will need to implement cpu_possible() for
the oprofile driver.

8) For the user space oprofile need to add appropriate
__NR_lookup_dcookie to oprofile/daemon/opd_cookie.h

This email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here:
oprofile-list mailing list

Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square