|
From: William C. <wc...@re...> - 2009-10-13 19:13:15
Attachments:
valgrind-3.5.0-svn-perf.diff
|
I am planning to use valgrind to check that there are no uninitialized uses of memory with PAPI and the new perf event support available in the 2.6.31 kernels. This morning I wrote up a patch to provide a very basic understanding of the sys_perf_event_open syscall. Attached is the patch for the current valgrind in svn code repository. It has been compiled on x86-64. This patch allows valgrind to work on the perf command in the linux-2.6.32/tools/perf directory. valgrind no longer fails on the perf_event_open syscalls and the perf command appears to collect reasonble data (that data isn't going to be quite accurate with valgrind's binary rewrite). There still seems to be some work required to get this to work with PAPI. For PAPI tests programs run with valgrind I am getting: PAPI Error: pfm_initialize(): not supported. unknown FAILED Line # 107 Error: PAPI_library_init failed -Will |
|
From: William C. <wc...@re...> - 2009-10-13 21:08:56
|
William Cohen wrote: > There still seems to be some work required to get this to work with PAPI. For > PAPI tests programs run with valgrind I am getting: > > PAPI Error: pfm_initialize(): not supported. > unknown FAILED > Line # 107 > Error: PAPI_library_init failed > > -Will The papi library is using the cpuid instruction to determine what processor is running on the system. Valgrind doesn't intercepts those instructions and replaces the results. A short program was written to print out the results of cpuid with eax set to 0 and 1. Below one can see the results are very different on the AMD64 machine: [wcohen@dhcp231-201 src]$ /tmp/cpuid cpuid(0) = AuthenticAMD cpuid(1) eax = 00100f23 ebx = 02040800 ecx = 00802009 edx = 178bfbff [wcohen@dhcp231-201 src]$ /home/wcohen/valgrind/valgrind/vg-in-place /tmp/cpuid ==1215== Memcheck, a memory error detector ==1215== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==1215== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright info ==1215== Command: /tmp/cpuid ==1215== cpuid(0) = GenuineIntel cpuid(1) eax = 000006f6 ebx = 00020800 ecx = 0000e3bd edx = bfebfbff ==1215== ==1215== HEAP SUMMARY: ==1215== in use at exit: 0 bytes in 0 blocks ==1215== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==1215== ==1215== All heap blocks were freed -- no leaks are possible ==1215== Would it be possible to add an option to valgrind to allow it use the actual results from cpuid instruction? Use the option would allow accurate identification of the processor and code like PAPI could be tested with valgrind. -Will -Will |