Greetings and Happy New Year Stephane, Ok, thanks to your tips, and digging through Vince’s perf_event_tests codes, I tracked down this bug - it’s the exclude_guest = 1 flag. The systems I’m running on are paranoid level 2. Here’s the GDB log… What’s the right way to fix this? I have a patched library working for me, but it’s not generalized. Let me know and I’ll send you a patch.
I’m preparing an answer for the other email about Intel event names as well... Regards, > Reading symbols from /home/pjmucci/bob/perf_examples/self...done. > (gdb) break perf_event_open > Breakpoint 1 at 0x4015ee: file > /home/pjmucci/bob/perf_examples/../include/perfmon/perf_event.h, line 506. > (gdb) run > Starting program: /home/pjmucci/bob/perf_examples/self > [Thread debugging using libthread_db enabled] > > Breakpoint 1, perf_event_open (hw_event_uptr=0x73e1b0, pid=0, cpu=-1, > group_fd=-1, flags=0) at > /home/pjmucci/bob/perf_examples/../include/perfmon/perf_event.h:506 > 506 return syscall( > Missing separate debuginfos, use: debuginfo-install > glibc-2.12-1.132.el6_5.4.x86_64 > (gdb) p *hw_event_uptr > $1 = {type = 0, size = 112, config = 0, {sample_period = 0, sample_freq = 0}, > sample_type = 0, read_format = 3, disabled = 1, inherit = 0, pinned = 0, > exclusive = 0, exclude_user = 0, exclude_kernel = 0, exclude_hv = 0, > exclude_idle = 0, mmap = 0, comm = 0, freq = 0, inherit_stat = 0, > enable_on_exec = 0, task = 0, watermark = 0, precise_ip = 0, mmap_data = 0, > sample_id_all = 0, exclude_host = 0, exclude_guest = 1, > exclude_callchain_kernel = 0, > exclude_callchain_user = 0, mmap2 = 0, comm_exec = 0, use_clockid = 0, > __reserved_1 = 0, {wakeup_events = 0, wakeup_watermark = 0}, bp_type = 0, > {bp_addr = 0, config1 = 0}, {bp_len = 0, config2 = 0}, branch_sample_type = > 0, > sample_regs_user = 0, sample_stack_user = 0, clockid = 0, sample_regs_intr > = 0, aux_watermark = 0, __reserved_2 = 0} > (gdb) c > Continuing. > self: cannot open event 0: Invalid argument > > Program exited with code 01. > (gdb) run > Starting program: /home/pjmucci/bob/perf_examples/self > [Thread debugging using libthread_db enabled] > > Breakpoint 1, perf_event_open (hw_event_uptr=0x73e1b0, pid=0, cpu=-1, > group_fd=-1, flags=0) at > /home/pjmucci/bob/perf_examples/../include/perfmon/perf_event.h:506 > 506 return syscall( > (gdb) set hw_event_uptr->exclude_guest=0 > (gdb) c > Continuing. > self: cannot open event 0: Permission denied > > Program exited with code 01. > (gdb) run cycles:u > Starting program: /home/pjmucci/bob/perf_examples/self cycles:u > [Thread debugging using libthread_db enabled] > > Breakpoint 1, perf_event_open (hw_event_uptr=0x73e1b0, pid=0, cpu=-1, > group_fd=-1, flags=0) at > /home/pjmucci/bob/perf_examples/../include/perfmon/perf_event.h:506 > 506 return syscall( > (gdb) set hw_event_uptr->exclude_guest=0 > (gdb) c > Continuing. > INITIAL: 2,788 cycles:u (0.00% scaling, raw=2,788, ena=6,001, > run=6,001) > Final counts: > FINAL: 25,899,440,206 cycles:u (0.00% scaling, raw=25,899,440,206, > ena=9,979,548,313, run=9,979,548,313) > > On Dec 27, 2015, at 4:24 AM, Stephane Eranian <eran...@googlemail.com> wrote: > > Hi Phil, > > On Thu, Dec 24, 2015 at 1:55 AM, Philip Mucci <mu...@icl.utk.edu > <mailto:mu...@icl.utk.edu>> wrote: > Hi folks, > > Does the nmi_watchdog prevent libpfm from working at all? I’m on an older > Sandia system (compton) > > No, this only affects the number of events you can measure simultaneously. > > Is this a kernel version and perf attr data structure problem? It can’t be > NMI since perf with raw registers seems to work fine… > > Looks like it because you have perf stat working. Your kernel is set to > paranoid 2, which means you can only monitor > user level execution. > > Normally, the key field is attr.size. It should always be set to attr.size = > sizeof(attr). But that is in the example. > Furthermore, the kernel handles older attr struct (with smaller size). Bigger > are not a problem as long as the excess > fields are zero. What could cause a problem is: > - attr.reserved1 != 0 > - attr.sample_type has unknown bits set for kernel > - attr.read_format has unknown bits set for kernel > - attr.branch_sample_type has unknown bits set for kernel > > I would check that first. > > > > [pjmucci@compton1 perfmon2-libpfm4.git]$ uname -a > Linux compton1 2.6.32-131.0.15.el6.x86_64 #1 SMP Tue May 10 15:42:40 EDT 2011 > x86_64 x86_64 x86_64 GNU/Linux > [pjmucci@compton1 perfmon2-libpfm4.git]$ cat /etc/*ease > Red Hat Enterprise Linux Workstation release 6.1 (Santiago) > Red Hat Enterprise Linux Workstation release 6.1 (Santiago) > > [pjmucci@compton32 perfmon2-libpfm4.git]$ cat /etc/*ease > Red Hat Enterprise Linux Server release 6.2 (Santiago) > Red Hat Enterprise Linux Server release 6.2 (Santiago) > [pjmucci@compton32 perfmon2-libpfm4.git]$ uname -a > Linux compton32 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 > x86_64 x86_64 x86_64 GNU/Linux > > [pjmucci@compton32 perfmon2-libpfm4.git]$ cat > /proc/sys/kernel/perf_event_paranoid > 2 > [pjmucci@compton32 perfmon2-libpfm4.git]$ cat /proc/sys/kernel/nmi_watchdog > 1 > [pjmucci@compton32 perfmon2-libpfm4.git]$ ./examples/check_events > snb_ep::UOPS_RETIRED:TOTAL_CYCLES:u > Requested Event: snb_ep::UOPS_RETIRED:TOTAL_CYCLES:u > Actual Event: snb_ep::UOPS_RETIRED:ALL:k=0:u=1:e=0:i=0:c=16:t=0 > PMU : Intel Sandy Bridge EP > IDX : 148897869 > Codes : 0x105101c2 > [pjmucci@compton32 perfmon2-libpfm4.git]$ perf stat -e r105301c2:uh sleep 1 > > Performance counter stats for 'sleep 1': > > 0 r105301c2:uh > > > 1.001672975 seconds time elapsed > [pjmucci@compton32 perfmon2-libpfm4.git]$ ./perf_examples/self_count > snb_ep::UOPS_RETIRED:TOTAL_CYCLES:u > self_count: cannot open event 0: Invalid argument > > > [pjmucci@compton32 perfmon2-libpfm4.git]$ ./perf_examples/evt2raw > snb_ep::UNHALTED_CORE_CYCLES:u > r53003c:uh > [pjmucci@compton32 perfmon2-libpfm4.git]$ ./perf_examples/evt2raw > snb_ep::UNHALTED_REFERENCE_CYCLES:u > r530300:uh > [pjmucci@compton32 perfmon2-libpfm4.git]$ perf stat -e r530300:uh sleep 1 > > Performance counter stats for 'sleep 1': > > 3 r530300:uh > > > 1.002638998 seconds time elapsed > > [pjmucci@compton32 perfmon2-libpfm4.git]$ perf stat -e r53003c:uh sleep 1 > > Performance counter stats for 'sleep 1': > > 300,065 r53003c:uh > > > 1.001350589 seconds time elapsed > > [pjmucci@compton32 perfmon2-libpfm4.git]$ ./perf_examples/self_count > snb_ep::UNHALTED_CORE_CYCLES:u > self_count: cannot open event 0: Invalid argument > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > perfmon2-devel mailing list > perfmon2-devel@lists.sourceforge.net > <mailto:perfmon2-devel@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/perfmon2-devel > <https://lists.sourceforge.net/lists/listinfo/perfmon2-devel> > >
------------------------------------------------------------------------------
_______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel