1. 24 9月, 2011 1 次提交
    • D
      perf tool: Fix endianness handling of u32 data in samples · 936be503
      David Ahern 提交于
      Currently, analyzing PPC data files on x86 the cpu field is always 0 and
      the tid and pid are backwards. For example, analyzing a PPC file on PPC
      the pid/tid fields show:
      
              rsyslogd  1210/1212
      
      and analyzing the same PPC file using an x86 perf binary shows:
      
              rsyslogd  1212/1210
      
      The problem is that the swap_op method for samples is
      perf_event__all64_swap which assumes all elements in the sample_data
      struct are u64s. cpu, tid and pid are u32s and need to be handled
      individually. Given that the swap is done before the sample is parsed,
      the simplest solution is to undo the 64-bit swap of those elements when
      the sample is parsed and do the proper swap.
      
      The RAW data field is generic and perf cannot have programmatic knowledge
      of how to treat that data. Instead a warning is given to the user.
      
      Thanks to Anton Blanchard for providing a data file for a mult-CPU
      PPC system so I could verify the fix for the CPU fields.
      
      v3 -> v4:
      - fixed use of WARN_ONCE
      
      v2 -> v3:
      - used WARN_ONCE for message regarding raw data
      - removed struct wrapper around union
      - fixed whitespace issues
      
      v1 -> v2:
      - added a union for undoing the byte-swap on u64 and redoing swap on
        u32's to address compiler errors (see git commit 65014ab3)
      
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1315321946-16993-1-git-send-email-dsahern@gmail.comSigned-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      936be503
  2. 21 7月, 2011 2 次提交
  3. 03 6月, 2011 1 次提交
    • A
      perf evlist: Don't die if sample_{id_all|type} is invalid · 56722381
      Arnaldo Carvalho de Melo 提交于
      Fixes two more cases where the python binding would not load:
      
      . Not finding die(), which it shouldn't anyway, not good to just stop the
        world because some particular perf.data file is invalid, just propagate
        the error to the caller.
      
      . Not finding perf_sample_size: fix it by moving it from event.c to evsel,
        where it belongs, as most cases are moving to operate on an evsel object.o
      
      One of the fixed problems:
      
      [root@emilia ~]# python
      >>> import perf
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      ImportError: /home/acme/git/build/perf/python/perf.so: undefined symbol: perf_sample_size
      >>>
      [root@emilia ~]#
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-1hkj7b2cvgbfnoizsekjb6c9@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      56722381
  4. 02 6月, 2011 1 次提交
    • A
      perf evlist: Don't die if sample_{id_all|type} is invalid · c2a70653
      Arnaldo Carvalho de Melo 提交于
      Fixes two more cases where the python binding would not load:
      
      . Not finding die(), which it shouldn't anyway, not good to just stop the
        world because some particular perf.data file is invalid, just propagate
        the error to the caller.
      
      . Not finding perf_sample_size: fix it by moving it from event.c to evsel,
        where it belongs, as most cases are moving to operate on an evsel object.o
      
      One of the fixed problems:
      
      [root@emilia ~]# python
      >>> import perf
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      ImportError: /home/acme/git/build/perf/python/perf.so: undefined symbol: perf_sample_size
      >>>
      [root@emilia ~]#
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-1hkj7b2cvgbfnoizsekjb6c9@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c2a70653
  5. 22 5月, 2011 2 次提交
  6. 15 5月, 2011 1 次提交
    • A
      perf evlist: Fix per thread mmap setup · aece948f
      Arnaldo Carvalho de Melo 提交于
      The PERF_EVENT_IOC_SET_OUTPUT ioctl was returning -EINVAL when using
      --pid when monitoring multithreaded apps, as we can only share a ring
      buffer for events on the same thread if not doing per cpu.
      
      Fix it by using per thread ring buffers.
      
      Tested with:
      
      [root@felicio ~]# tuna -t 26131 -CP | nl
        1                      thread       ctxt_switches
        2    pid SCHED_ rtpri affinity voluntary nonvoluntary             cmd
        3 26131   OTHER     0      0,1  10814276      2397830 chromium-browse
        4  642    OTHER     0      0,1     14688            0 chromium-browse
        5  26148  OTHER     0      0,1    713602       115479 chromium-browse
        6  26149  OTHER     0      0,1    801958         2262 chromium-browse
        7  26150  OTHER     0      0,1   1271128          248 chromium-browse
        8  26151  OTHER     0      0,1         3            0 chromium-browse
        9  27049  OTHER     0      0,1     36796            9 chromium-browse
       10  618    OTHER     0      0,1     14711            0 chromium-browse
       11  661    OTHER     0      0,1     14593            0 chromium-browse
       12  29048  OTHER     0      0,1     28125            0 chromium-browse
       13  26143  OTHER     0      0,1   2202789          781 chromium-browse
      [root@felicio ~]#
      
      So 11 threads under pid 26131, then:
      
      [root@felicio ~]# perf record -F 50000 --pid 26131
      
      [root@felicio ~]# grep perf_event /proc/`pidof perf`/maps | nl
        1 7fa4a2538000-7fa4a25b9000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
        2 7fa4a25b9000-7fa4a263a000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
        3 7fa4a263a000-7fa4a26bb000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
        4 7fa4a26bb000-7fa4a273c000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
        5 7fa4a273c000-7fa4a27bd000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
        6 7fa4a27bd000-7fa4a283e000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
        7 7fa4a283e000-7fa4a28bf000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
        8 7fa4a28bf000-7fa4a2940000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
        9 7fa4a2940000-7fa4a29c1000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
       10 7fa4a29c1000-7fa4a2a42000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
       11 7fa4a2a42000-7fa4a2ac3000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
      [root@felicio ~]#
      
      11 mmaps, one per thread since we didn't specify any CPU list, so we need one
      mmap per thread and:
      
      [root@felicio ~]# perf record -F 50000 --pid 26131
      ^M
      ^C[ perf record: Woken up 79 times to write data ]
      [ perf record: Captured and wrote 20.614 MB perf.data (~900639 samples) ]
      
      [root@felicio ~]# perf report -D | grep PERF_RECORD_SAMPLE | cut -d/ -f2 | cut -d: -f1 | sort -n | uniq -c | sort -nr | nl
           1	 371310 26131
           2	  96516 26148
           3	  95694 26149
           4	  95203 26150
           5	   7291 26143
           6	     87 27049
           7	     76 661
           8	     60 29048
           9	     47 618
          10	     43 642
      [root@felicio ~]#
      
      Ok, one of the threads, 26151 was quiescent, so no samples there, but all the
      others are there.
      
      Then, if I specify one CPU:
      
      [root@felicio ~]# perf record -F 50000 --pid 26131 --cpu 1
      ^C[ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.680 MB perf.data (~29730 samples) ]
      
      [root@felicio ~]# perf report -D | grep PERF_RECORD_SAMPLE | cut -d/ -f2 | cut -d: -f1 | sort -n | uniq -c | sort -nr | nl
           1	   8444 26131
           2	   2584 26149
           3	   2518 26148
           4	   2324 26150
           5	    123 26143
           6	      9 661
           7	      9 29048
      [root@felicio ~]#
      
      This machine has two cores, so fewer threads appeared on the radar, and:
      
      [root@felicio ~]# grep perf_event /proc/`pidof perf`/maps | nl
       1 7f484b922000-7f484b9a3000 rwxs 00000000 00:09 4064 anon_inode:[perf_event]
      [root@felicio ~]#
      
      Just one mmap, as now we can use just one per-cpu buffer instead of the
      per-thread needed in the previous case.
      
      For global profiling:
      
      [root@felicio ~]# perf record -F 50000 -a
      ^C[ perf record: Woken up 26 times to write data ]
      [ perf record: Captured and wrote 7.128 MB perf.data (~311412 samples) ]
      
      [root@felicio ~]# grep perf_event /proc/`pidof perf`/maps | nl
           1	7fb49b435000-7fb49b4b6000 rwxs 00000000 00:09 4064                       anon_inode:[perf_event]
           2	7fb49b4b6000-7fb49b537000 rwxs 00000000 00:09 4064                       anon_inode:[perf_event]
      [root@felicio ~]#
      
      It uses per-cpu buffers.
      
      For just one thread:
      
      [root@felicio ~]# perf record -F 50000 --tid 26148
      ^C[ perf record: Woken up 2 times to write data ]
      [ perf record: Captured and wrote 0.330 MB perf.data (~14426 samples) ]
      
      [root@felicio ~]# perf report -D | grep PERF_RECORD_SAMPLE | cut -d/ -f2 | cut -d: -f1 | sort -n | uniq -c | sort -nr | nl
           1	   9969 26148
      [root@felicio ~]#
      
      [root@felicio ~]# grep perf_event /proc/`pidof perf`/maps | nl
           1	7f286a51b000-7f286a59c000 rwxs 00000000 00:09 4064                       anon_inode:[perf_event]
      [root@felicio ~]#
      Tested-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NLin Ming <ming.m.lin@intel.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Link: http://lkml.kernel.org/r/20110426204401.GB1746@ghostprotocols.netSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      aece948f
  7. 15 4月, 2011 1 次提交
  8. 31 1月, 2011 1 次提交
    • A
      perf evlist: Store pointer to the cpu and thread maps · 7e2ed097
      Arnaldo Carvalho de Melo 提交于
      So that we don't have to pass it around to the several methods that
      needs it, simplifying usage.
      
      There is one case where we don't have the thread/cpu map in advance,
      which is in the parsing routines used by top, stat, record, that we have
      to wait till all options are parsed to know if a cpu or thread list was
      passed to then create those maps.
      
      For that case consolidate the cpu and thread map creation via
      perf_evlist__create_maps() out of the code in top and record, while also
      providing a perf_evlist__set_maps() for cases where multiple evlists
      share maps or for when maps that represent CPU sockets, for instance,
      get crafted out of topology information or subsets of threads in a
      particular application are to be monitored, providing more granularity
      in specifying which cpus and threads to monitor.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7e2ed097
  9. 30 1月, 2011 2 次提交
  10. 28 1月, 2011 1 次提交
  11. 24 1月, 2011 2 次提交
    • A
      perf tools: Move event__parse_sample to evsel.c · d0dd74e8
      Arnaldo Carvalho de Melo 提交于
      To avoid linking more stuff in the python binding I'm working on, future
      csets will make the sample type be taken from the evsel itself, but for
      that we need to first have one file per cpu and per sample_type, not a
      single perf.data file.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d0dd74e8
    • A
      perf threads: Move thread_map to separate file · fd78260b
      Arnaldo Carvalho de Melo 提交于
      To untangle it from struct thread handling, that is tied to symbols, etc.
      
      Right now in the python bindings I'm working on I need just a subset of
      the util/ files, untangling it allows me to do that.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fd78260b
  12. 23 1月, 2011 7 次提交
    • A
      perf test: Add test for the evlist mmap routines · de5fa3a8
      Arnaldo Carvalho de Melo 提交于
      This test will generate random numbers of calls to some getpid syscalls,
      then establish an mmap for a group of events that are created to monitor
      these syscalls.
      
      It will receive the events, using mmap, use its PERF_SAMPLE_ID generated
      sample.id field to map back to its respective perf_evsel instance.
      
      Then it checks if the number of syscalls reported as perf events by the
      kernel corresponds to the number of syscalls made.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      de5fa3a8
    • H
      perf test: check if cpu_map__new() return NULL · 98d77b78
      Han Pingtian 提交于
      It looks like we should check if cpus is NULL after
      
      	cpus = cpu_map__new(NULL);
      
      in test__open_syscall_event_on_all_cpus().
      
      LKML-Reference: <20110114230050.GA7011@localhost>
      Signed-off-by: NHan Pingtian <phan@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      98d77b78
    • A
      perf test: Check counts on all cpus in test__open_syscall_event_on_all_cpus · d2af9687
      Arnaldo Carvalho de Melo 提交于
      We were bailing out after the first count mismatch, do it in all to see
      if only some CPUs are not getting the expected number of events.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d2af9687
    • A
      perf evsel: Allow specifying if the inherit bit should be set · 9d04f178
      Arnaldo Carvalho de Melo 提交于
      As this is a per-cpu attribute, we can't set it up in advance and use it
      for all the calls.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9d04f178
    • A
      perf evsel: Support event groups · f08199d3
      Arnaldo Carvalho de Melo 提交于
      The perf_evsel__open now have an extra boolean argument specifying if
      event grouping is desired.
      
      The first file descriptor created on a CPU becomes the group leader.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f08199d3
    • A
      perf tools: Fix 64 bit integer format strings · 9486aa38
      Arnaldo Carvalho de Melo 提交于
      Using %L[uxd] has issues in some architectures, like on ppc64.  Fix it
      by making our 64 bit integers typedefs of stdint.h types and using
      PRI[ux]64 like, for instance, git does.
      
      Reported by Denis Kirjanov that provided a patch for one case, I went
      and changed all cases.
      Reported-by: NDenis Kirjanov <dkirjanov@kernel.org>
      Tested-by: NDenis Kirjanov <dkirjanov@kernel.org>
      LKML-Reference: <20110120093246.GA8031@hera.kernel.org>
      Cc: Denis Kirjanov <dkirjanov@kernel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Pingtian Han <phan@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9486aa38
    • A
      perf test: Fix build on older glibcs · 57b84e53
      Arnaldo Carvalho de Melo 提交于
      Where we don't have CPU_ALLOC & friends. As the tools are being used in older
      distros where the only allowed change are to replace the kernel, like RHEL4 and
      5.
      Reported-by: NEric Dumazet <eric.dumazet@gmail.com>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      57b84e53
  13. 22 1月, 2011 1 次提交
    • H
      perf test: Use cpu_map->[cpu] when setting affinity · ffb5e0fb
      Han Pingtian 提交于
      When some of CPUs are offline:
      
       # cat /sys/devices/system/cpu/online
       0,6-31
      
      perf test will fail on #3 testcase:
      
         3: detect open syscall event on all cpus:
         --- start ---
         perf_evsel__read_on_cpu: expected to intercept 111 calls on cpu 0, got 681
         perf_evsel__read_on_cpu: expected to intercept 112 calls on cpu 1, got 117
         perf_evsel__read_on_cpu: expected to intercept 113 calls on cpu 2, got 118
         perf_evsel__read_on_cpu: expected to intercept 114 calls on cpu 3, got 119
         perf_evsel__read_on_cpu: expected to intercept 115 calls on cpu 4, got 120
         perf_evsel__read_on_cpu: expected to intercept 116 calls on cpu 5, got 121
         perf_evsel__read_on_cpu: expected to intercept 117 calls on cpu 6, got 122
         perf_evsel__read_on_cpu: expected to intercept 118 calls on cpu 7, got 123
         perf_evsel__read_on_cpu: expected to intercept 119 calls on cpu 8, got 124
         perf_evsel__read_on_cpu: expected to intercept 120 calls on cpu 9, got 125
         perf_evsel__read_on_cpu: expected to intercept 121 calls on cpu 10, got 126
         ....
      
      This patch try to use 'cpus->map[cpu]' when setting cpu affinity, and
      will check the return code of sched_setaffinity()
      
      LKML-Reference: <20110120114707.GA11781@hpt.nay.redhat.com>
      Signed-off-by: NHan Pingtian <phan@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ffb5e0fb
  14. 11 1月, 2011 1 次提交
    • A
      perf evsel: Support perf_evsel__open(cpus > 1 && threads > 1) · 0252208e
      Arnaldo Carvalho de Melo 提交于
      And a test for it:
      
      [acme@felicio linux]$ perf test
       1: vmlinux symtab matches kallsyms: Ok
       2: detect open syscall event: Ok
       3: detect open syscall event on all cpus: Ok
      [acme@felicio linux]$
      
      Translating C the test does:
      
      1. generates different number of open syscalls on each CPU
         by using sched_setaffinity
      2. Verifies that the expected number of events is generated
         on each CPU
      
      It works as expected.
      
      LKML-Reference: <new-submission>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0252208e
  15. 07 1月, 2011 1 次提交
    • L
      perf tools: Pass whole attr to event selectors · 23a2f3ab
      Lin Ming 提交于
      Since commit 69aad6f1(perf tools: Introduce event selectors), only
      perf_event_attr::type and ::config are passed to event selector, which
      makes perf tool not work correctly.
      
      For example, PEBS does not work because perf_event_attr::precise_ip is
      not passed to the syscall.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <1294369869.20563.19.camel@minggr.sh.intel.com>
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      23a2f3ab
  16. 06 1月, 2011 1 次提交
    • A
      perf test: Clarify some error reports in the open syscall test · 454a3bbe
      Arnaldo Carvalho de Melo 提交于
      Rebooted my devel machine, first thing I ran was perf test, that expects
      debugfs to be mounted, test fails. Be more clear about it.
      
      Also add missing newlines and add more informative message when
      sys_perf_event_open fails.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      454a3bbe
  17. 04 1月, 2011 1 次提交
    • A
      perf test: Add test for counting open syscalls · d854861c
      Arnaldo Carvalho de Melo 提交于
      To test the use of the perf_evsel class on something other than
      the tools from where we refactored code to create it.
      
      It calls open() N times and then checks if the event created to
      monitor it returns N events.
      
      [acme@felicio linux]$ perf test
       1: vmlinux symtab matches kallsyms: Ok
       2: detect open syscall event: Ok
      [acme@felicio linux]$
      
      It does.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Han Pingtian <phan@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d854861c
  18. 23 12月, 2010 1 次提交
    • A
      perf test: Look forward for symbol aliases · d3678758
      Arnaldo Carvalho de Melo 提交于
      Not just before, fixing these false positives:
      
      [acme@mica linux]$ perf test -v 1
       1: vmlinux symtab matches kallsyms:
      --- start ---
      Looking at the vmlinux_path (6 entries long)
      Using //lib/modules/2.6.37-rc5-00180-ge06b6bf/build/vmlinux for symbols
      0xffffffff81058dc0: diff name v: sys_vm86old k: sys_ni_syscall
      0xffffffff81058dc0: diff name v: sys_vm86 k: sys_ni_syscall
      0xffffffff81058dc0: diff name v: sys_subpage_prot k: sys_ni_syscall
      0xffffffff810b5f7c: diff name v: probe_kernel_write k: __probe_kernel_write
      0xffffffff810b5fe5: diff name v: probe_kernel_read k: __probe_kernel_read
      0xffffffff811bc380: diff name v: __memset k: memset
      0xffffffff81384a98: diff name v: __sched_text_start k: sleep_on_common
      0xffffffff81386750: diff name v: __sched_text_end k: _raw_spin_trylock
      0xffffffff8138cee8: diff name v: __irqentry_text_start k: do_IRQ
      0xffffffff8138f079: diff name v: __start_notes k: _etext
      0xffffffff8138f079: diff name v: __stop_notes k: _etext
      ---- end ----
      vmlinux symtab matches kallsyms: FAILED!
      
      [acme@mica linux]$
      
      Some are weak functions, others are just markers, etc. They get in the rb tree
      with the same addr, so we need to look around to find the symbol with the same
      name.
      
      We were looking just at the previous entries with the same addr, look forward
      too.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Han Pingtian <phan@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d3678758
  19. 18 5月, 2010 1 次提交
  20. 30 4月, 2010 1 次提交
    • A
      perf test: Initial regression testing command · 1c6a800c
      Arnaldo Carvalho de Melo 提交于
      First an example with the first internal test:
      
      [acme@doppio linux-2.6-tip]$ perf test
       1: vmlinux symtab matches kallsyms: Ok
      
      So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
      successful.
      
      If we run it in verbose mode, we'll see details about errors and extra warnings
      for non-fatal problems:
      
      [acme@doppio linux-2.6-tip]$ perf test -v
       1: vmlinux symtab matches kallsyms:
      --- start ---
      Looking at the vmlinux_path (5 entries long)
      No build_id in vmlinux, ignoring it
      No build_id in /boot/vmlinux, ignoring it
      No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
      Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
      Maps only in vmlinux:
       ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
       ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
       ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
       ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
       ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
       ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
      Maps in vmlinux with a different name in kallsyms:
       ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
       ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
      *ffffffffff600100-ffffffffff60012f 0 [kernel].2
       ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
       ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
      Maps only in kallsyms:
       ffffffffff600130-ffffffffff6003ff 0 [kernel].4
      ---- end ----
      vmlinux symtab matches kallsyms: Ok
      [acme@doppio linux-2.6-tip]$
      
      In the above case we only know the name of the non contiguous kernel ranges in
      the address space when reading the symbol information from the ELF symtab in
      vmlinux.
      
      The /proc/kallsyms file lack this, we only notice they are separate because
      there are modules after the kernel and after that more kernel functions, so we
      need to have a module rbtree backed by the module .ko path to get symtabs in
      the vmlinux case.
      
      The tool uses it to match by address to emit appropriate warning, but don't
      considers this fatal.
      
      The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
      these cases just as extra info in verbose mode.
      
      The end of the sections also aren't in kallsyms, so we the symbols layer does
      another pass and sets the end addresses as the next map start minus one, which
      sometimes pads, causing harmless mismatches.
      
      But at least the symbols match, tested it by copying /proc/kallsyms to
      /tmp/kallsyms and doing changes to see if they were detected.
      
      This first test also should serve as a first stab at documenting the
      symbol library by providing a self contained example that exercises it
      together with comments about what is being done.
      
      More tests to check if actions done on a monitored app, like doing mmaps, etc,
      makes the kernel generate the expected events should be added next.
      
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1c6a800c