I am trying to put the perfmon v2.2 patches into a redhat 2.6.18 kernel and
not having a lot of success.
I have been able to build and load the kernel but both pfmon and some of
the examples delivered
with libpfm have problems running.

I have tried with libpfm/pfmon versions of 3.4 and 3.5 but both seem to get
the same results.

I found the following statement in the libpfm README file:

To run the programs in the examples subdir, you MUST be using a linux
kernel version of
 2.6.24 or later with the corresponding perfmon new code base patch
installed.

Is this comment accurate and if so does it also apply to other tools that
use libpfm ???

If this combination is not expected to work then there is no need to read
the rest of this
message and I should stop what I am doing right now and either move to a
newer
kernel or give up on using perfmon v2.2.

But if it is supposed to work then here is a description of what the errors
that I see report.

When running the self program in the libpfm examples, the error that I am
getting is due to the
pfm_create_context call to the kernel returning a value of zero which the
libpfm code then
uses as the fd for a call to pfm_getinfo_evtsets.  Since the real fd that
was assigned was
3 this function returns a failure with an errno of  9 (Invalid FD).

The kernel messages produced during the failures look like this:

perfmon: perfmon/perfmon_file.c(pfm_alloc_fd.717): CPU3 [6842]: new inode
ino=231804 @ffff810121fdf6c0
perfmon: perfmon/perfmon_sets.c(pfm_find_set.490): CPU3 [6842]: looking for
set=0
perfmon: perfmon/perfmon_sets.c(pfm_find_set.559): CPU3 [6842]: set_id=0
size=2584 view=ffff81002f15e970 remap=0 mmap_offs=0
perfmon: perfmon/perfmon_sets.c(pfm_init_evtset.468): CPU3 [6842]: set0
pmc1=0x100000
perfmon: perfmon/perfmon.c(__pfm_create_context.1626): CPU3 [6842]:
ctx=ffff81002f1ce000 flags=0x0 system=0 notify_block=0 no_msg=0 use_fmt=0
remap=0 ctx_fd=3 mode=0
perfmon: perfmon/perfmon_syscalls.c(pfm_get_ctx.88): CPU3 [6842]: fd 0 not
related to perfmon
perfmon: perfmon/perfmon_syscalls.c(pfm_get_ctx.88): CPU3 [6842]: fd 0 not
related to perfmon
perfmon: perfmon/perfmon_file.c(__pfm_close.509): CPU3 [6842]: state=1
perfmon: perfmon/perfmon.c(pfm_context_free.118): CPU3 [6842]: free ctx
@ffff81002f1ce000

The output from the self program in the examples directory looks like this
(with a couple of extra debug messages I added):

[jax] (hpctk) libpfm-3.5> ./examples/self
sycall base 286
pfmlib_os_linux.c.128 (pfm_create_context): Entered
pfmlib_os_linux.c.140 (pfm_create_context): NOT VERSION_22 ret:urn value: 0
[FIXED_CTRL(pmc16)=0xaa pmi0=1 en0=0x2 pmi1=1 en1=0x2 pmi2=1 en2=0x0]
INSTRUCTIONS_RETIRED UNHALTED_CORE_CYCLES
[FIXED_CTR0(pmd16)]
[FIXED_CTR1(pmd17)]
pfm_write_pmcs error errno 9


PFMON gets slightly different results.  It gets an error trying to write
pmc16 because it is not implemented/unaccessible.  This test also
returns a zero fd from the pfm_create_context call which causes an error on
the next call to the kernel but it seems to go create another
context as part of the next call which ends up actually using an fd of
zero.  It then tries to set up the PMU and gets the error trying to write
pmc16.

Its kernel messages look like this:

perfmon: perfmon/perfmon_file.c(pfm_alloc_fd.717): CPU4 [8896]: new inode
ino=246661 @ffff81012ca50d80
perfmon: perfmon/perfmon_sets.c(pfm_find_set.490): CPU4 [8896]: looking for
set=0
perfmon: perfmon/perfmon_sets.c(pfm_find_set.559): CPU4 [8896]: set_id=0
size=2584 view=ffff8100317de970 remap=0 mmap_offs=0
perfmon: perfmon/perfmon_sets.c(pfm_init_evtset.468): CPU4 [8896]: set0
pmc1=0x100000
perfmon: perfmon/perfmon.c(__pfm_create_context.1626): CPU4 [8896]:
ctx=ffff81007b03e000 flags=0x0 system=0 notify_block=0 no_msg=0 use_fmt=0
remap=0 ctx_fd=3 mode=0
perfmon: perfmon/perfmon_syscalls.c(pfm_get_ctx.88): CPU4 [8896]: fd 0 not
related to perfmon
perfmon: perfmon/perfmon_file.c(pfm_alloc_fd.717): CPU4 [8896]: new inode
ino=246667 @ffff810123d87480
perfmon: perfmon/perfmon_sets.c(pfm_find_set.490): CPU4 [8896]: looking for
set=0
perfmon: perfmon/perfmon_sets.c(pfm_find_set.559): CPU4 [8896]: set_id=0
size=2584 view=ffff81002edce970 remap=0 mmap_offs=0
perfmon: perfmon/perfmon_sets.c(pfm_init_evtset.468): CPU4 [8896]: set0
pmc1=0x100000
perfmon: perfmon/perfmon.c(__pfm_create_contex.1626t): CPU4 [8896]:
ctx=ffff81002f100000 flags=0x0 system=0 notify_block=0 no_msg=0 use_fmt=0
remap=0 ctx_fd=0 mode=0
perfmon: perfmon/perfmon_syscalls.c(pfm_check_task_state.127): CPU4 [8896]:
state=1 [-1] task_state=-1 check_mask=0x1
perfmon: perfmon/perfmon_rw.c(__pfm_write_pmcs.357): CPU4 [8896]: pmc16 is
not implemented/unaccessible
perfmon: perfmon/perfmon_file.c(__pfm_close.509): CPU4 [8896]: state=1
perfmon: perfmon/perfmon.c(pfm_context_free.118): CPU4 [8896]: free ctx
@ffff81002f100000
perfmon: perfmon/perfmon_file.c(__pfm_close.509): CPU4 [8896]: state=1
perfmon: perfmon/perfmon.c(pfm_context_free.118): CPU4 [8896]: free ctx
@ffff81007b03e000

The PFMON stderr output looks like (again with a few extra debug messages):

[jax] (hpctk) hh> cat pfmon.debug
add_module_syms.58: [8896] module added kernel
pfmlib_os_linux.c.128 (pfm_create_context): Entered
pfmlib_os_linux.c.140 (pfm_create_context): NOT VERSION_22 return value: 0
run_measurements.460: [8896] library dispatch for set0
[FIXED_CTRL(pmc16)=0xa pmi0=1 en0=0x2 pmi1=1 en1=0x0 pmi2=1 en2=0x0]
INSTRUCTIONS_RETIRED
[FIXED_CTR0(pmd16)]
pfmon_sdesc_new.835: [8896] vfork parent=8896 pid=8897 tid=8897 flags=0x0
cmd:
pfmon_process_smpl_buf.691: [8896] process_smpl_buf: pid=8896 is_final=0
ret=-1
load_pid_map.707: [8896] 0 0x400000 0x0 0x600000 0x0
/opt/hpctk/test_cases/LoopTest
load_pid_map.707: [8896] 1 0x331c400000 0x0 0x331c619000 0x19000
/lib64/ld-2.5.so
pfmon_task_chain_append.1769: [8896] Adding sdesc to task chain: 8897 -
/opt/hpctk/test_cases/LoopTest (previously: )
pfmon_process_smpl_buf.691: [8896] process_smpl_buf: pid=8896 is_final=0
ret=-1
load_pid_map.707: [8896] 0 0x400000 0x0 0x600000 0x0
/opt/hpctk/test_cases/LoopTest
load_pid_map.707: [8896] 1 0x331c400000 0x0 0x331c619000 0x19000
/lib64/ld-2.5.so
task_pfm_init.1201: [8896]  in: [8897] ctxid=-1 monitoring=0 refcnt=1:
task_pfm_init.1312: [8896] setup perfmon ctx for [8897] monitoring=1
refcnt=1: /opt/hpctk/test_cases/LoopTest
pfmlib_os_linux.c.128 (pfm_create_context): Entered
pfmlib_os_linux.c.140 (pfm_create_context): NOT VERSION_22 ret: 0
cannot write PMCs: Invalid argument


I have been trying to do this for several weeks now and mostly I am just
getting frustrated so any help you can provide would be greatly
appreciated.

As I have mentioned before the perfmon v2.,2 patches to ptrace do not fit
into any code that I can find in the redhat kernel so they have been
commented
out.  I think all the rest of the changes went in OK (although some did
need to be relocated to fit properly.

Thanks
Gary


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to