1. 25 7月, 2012 3 次提交
    • D
      perf kvm: Fix bug resolving guest kernel syms · adb5d2a4
      David Ahern 提交于
      Guest kernel symbols are not resolved despite passing the information
      needed to resolve them. e.g.,
      
      perf kvm --guest --guestmount=/tmp/guest-mount record -a -- sleep 1
      perf kvm --guest --guestmount=/tmp/guest-mount report --stdio
      
          36.55%  [guest/11399]  [unknown]         [g] 0xffffffff81600bc8
          33.19%  [guest/10474]  [unknown]         [g] 0x00000000c0116e00
          30.26%  [guest/11094]  [unknown]         [g] 0xffffffff8100a288
          43.69%  [guest/10474]  [unknown]         [g] 0x00000000c0103d90
          37.38%  [guest/11399]  [unknown]         [g] 0xffffffff81600bc8
          12.24%  [guest/11094]  [unknown]         [g] 0xffffffff810aa91d
           6.69%  [guest/11094]  [unknown]         [u] 0x00007fa784d721c3
      
      which is just pathetic.
      
      After a maddening 2 days sifting through perf minutia I found it --
      id_hdr_size is not initialized for guest machines. This shows up on the
      report side as random garbage for the cpu and timestamp, e.g.,
      
      29816 7310572949125804849 0x1ac0 [0x50]: PERF_RECORD_MMAP ...
      
      That messes up the sample sorting such that synthesized guest maps are
      processed last.
      
      With this patch you get a much more helpful report:
      
        12.11%  [guest/11399]  [guest.kernel.kallsyms.11399]  [g] irqtime_account_process_tick
        10.58%  [guest/11399]  [guest.kernel.kallsyms.11399]  [g] run_timer_softirq
         6.95%  [guest/11094]  [guest.kernel.kallsyms.11094]  [g] printk_needs_cpu
         6.50%  [guest/11094]  [guest.kernel.kallsyms.11094]  [g] do_timer
         6.45%  [guest/11399]  [guest.kernel.kallsyms.11399]  [g] idle_balance
         4.90%  [guest/11094]  [guest.kernel.kallsyms.11094]  [g] native_read_tsc
          ...
      
      v2:
      - changed rbtree walk to use rb_first per Namhyung's suggestion
      Tested-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1342826756-64663-5-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      adb5d2a4
    • D
      perf kvm: Guest userspace samples should not be lumped with host uspace · 7c0f4a41
      David Ahern 提交于
      e.g., perf kvm --host  --guest report -i perf.data --stdio -D
      shows:
      
      1 599127912065356 0x143b8 [0x48]: PERF_RECORD_SAMPLE(IP, 5): 5671/5676: 0x7fdf95a061c0 period: 1 addr: 0
      ... chain: nr:2
      .....  0: ffffffffffffff80
      .....  1: fffffffffffffe00
       ... thread: qemu-kvm:5671
       ...... dso: <not found>
      
      (IP, 5) means sample in guest userspace. Those samples should not be lumped
      into the VMM's host thread. i.e, the report output:
      
          56.86%  qemu-kvm  [unknown]         [u] 0x00007fdf95a061c0
      
      With this patch the output emphasizes it is a guest userspace hit:
      
          56.86%  [guest/5671]  [unknown]         [u] 0x00007fdf95a061c0
      
      Looking at 3 VMs (2 64-bit, 1 32-bit) with each running a CPU bound
      process (openssl speed), perf report currently shows:
      
        93.84%  117726   qemu-kvm  [unknown]   [u] 0x00007fd7dcaea8e5
      
      which is wrong. With this patch you get:
      
        31.50%   39258   [guest/18772]  [unknown]   [u] 0x00007fd7dcaea8e5
        31.50%   39236   [guest/11230]  [unknown]   [u] 0x0000000000a57340
        30.84%   39232   [guest/18395]  [unknown]   [u] 0x00007f66f641e107
      Tested-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1342826756-64663-4-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7c0f4a41
    • D
      perf kvm: Set name for VM process in guest machine · 5cd95c2d
      David Ahern 提交于
      COMM events are not generated in the context of a guest machine, so the
      thread name is never set for the VMM process. For example, the qemu-kvm
      name applies to the process in the host machine, not the guest machine.
      So, samples for guest machines are currently displayed as:
      
          99.67%     :5671  [unknown]         [g] 0xffffffff81366b41
      
      where 5671 is the pid of the VMM. With this patch the samples in the guest
      machine are shown as:
      
          18.43%  [guest/5671]  [unknown]           [g] 0xffffffff810d68b7
      Tested-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1342826756-64663-3-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5cd95c2d
  2. 24 7月, 2012 1 次提交
  3. 05 7月, 2012 3 次提交
  4. 04 7月, 2012 17 次提交
  5. 03 7月, 2012 2 次提交
    • H
      perf bench: Fix confused variable namings and descriptions in mem subsystem · 17d7a112
      Hitoshi Mitake 提交于
      As Namhyung Kim pointed, there are confused namings and descriptions of words
      "cycle" and "clock" in mem-memset.c and mem-memcpy.c.
      
      With the option "-c" (or "--clock", now renamed as "--cycle"), mem subsystem
      measures cost of memset() and memcpy() with cpu-cycles event.
      
      But current mem subsystem source code contains lots of confused variable
      namings and descriptions with "clock" (e.g. the variable use_clock). This is a
      very bad style because there is another software event named "cpu-clock". This
      patch replaces wrong usage of "clock" to "cycle".
      
      v2: modified Documentation/perf-bench.txt for the descriptions of
      --cycle option
      Signed-off-by: NHitoshi Mitake <h.mitake@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1341236777-18457-1-git-send-email-h.mitake@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      17d7a112
    • D
      perf kvm: Fix segfault with report and mixed guestmount use · 7ed97ad4
      David Ahern 提交于
      Using the guestmount option on record:
          $ perf kvm --guest --host --guestmount=/tmp/guest-mount record -ag
      
      But not the subsequent report:
          $ perf kvm report
      
      causes a SEGFAULT in the usual place:
      (gdb) bt
      0  0x0000000000470356 in machine__mmap_name (self=0x0, bf=0x7fffffffbdb0 " z\370\367\377\177", size=
          4096) at util/map.c:712
      1  0x00000000004453e8 in perf_event__process_kernel_mmap (tool=0x7fffffffde10, event=0x7ffff7f87e38,
          machine=0x0) at util/event.c:550
      2  0x00000000004458c9 in perf_event__process_mmap (tool=0x7fffffffde10, event=0x7ffff7f87e38, sample=
          0x7fffffffd2a0, machine=0x0) at util/event.c:656
      3  0x00000000004733e0 in perf_session_deliver_event (session=0x91aca0, event=0x7ffff7f87e38, sample=
          0x7fffffffd2a0, tool=0x7fffffffde10, file_offset=7736) at util/session.c:979
      ...
      
      The MMAP events in this case already contain the full path to the
      module. No need to require it for the report path to.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1341241977-71535-1-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7ed97ad4
  6. 02 7月, 2012 2 次提交
    • D
      perf kvm: Fix regression with guest machine creation · 207b5792
      David Ahern 提交于
      Commit 743eb868 reworked when the
      machines were created. Prior to this commit guest machines could be
      created in perf_event__process_kernel_mmap() while processing kernel
      MMAP events. This commit assumes that the machines exist by the time
      perf_session_deliver_event is called (e.g., during processing of build
      id events) - which is not always correct.
      
      One example is the use of default guest args (--guestkallsyms and
      --guestmodules) for short times where no samples hit within a guest
      module. For this case no build id is added to the file header. No build
      id == no machine created. That leads to the next example -- the use of
      no-buildid (-B) on the record for all perf-kvm invocations. In both
      cases perf report dies with a SEGFAULT of the form:
      
      (gdb) bt
      0  0x000000000046dd7b in machine__mmap_name (self=0x0, bf=0x7fffffffbd20 "q\021", size=4096) at util/map.c:715
      1  0x0000000000444161 in perf_event__process_kernel_mmap (tool=0x7fffffffdd80, event=0x7ffff7fb4120, machine=0x0) at util/event.c:562
      2  0x0000000000444642 in perf_event__process_mmap (tool=0x7fffffffdd80, event=0x7ffff7fb4120, sample=0x7fffffffd210, machine=0x0)
          at util/event.c:668
      3  0x0000000000470e0b in perf_session_deliver_event (session=0x915ca0, event=0x7ffff7fb4120, sample=0x7fffffffd210, tool=0x7fffffffdd80,
          file_offset=8480) at util/session.c:979
      4  0x000000000047032e in flush_sample_queue (s=0x915ca0, tool=0x7fffffffdd80) at util/session.c:679
      5  0x0000000000471c8d in __perf_session__process_events (session=0x915ca0, data_offset=400, data_size=150448, file_size=150848, tool=
          0x7fffffffdd80) at util/session.c:1363
      6  0x0000000000471d42 in perf_session__process_events (self=0x915ca0, tool=0x7fffffffdd80) at util/session.c:1379
      7  0x000000000042484a in __cmd_report (rep=0x7fffffffdd80) at builtin-report.c:368
      8  0x0000000000425bf1 in cmd_report (argc=0, argv=0x915b00, prefix=0x0) at builtin-report.c:756
      9  0x0000000000438505 in __cmd_report (argc=4, argv=0x7fffffffe260) at builtin-kvm.c:84
      10 0x000000000043882a in cmd_kvm (argc=4, argv=0x7fffffffe260, prefix=0x0) at builtin-kvm.c:131
      11 0x00000000004152cd in run_builtin (p=0x7a54e8, argc=9, argv=0x7fffffffe260) at perf.c:273
      12 0x00000000004154c7 in handle_internal_command (argc=9, argv=0x7fffffffe260) at perf.c:345
      13 0x0000000000415613 in run_argv (argcp=0x7fffffffe14c, argv=0x7fffffffe140) at perf.c:389
      14 0x0000000000415899 in main (argc=9, argv=0x7fffffffe260) at perf.c:487
      
      Fix by allowing the machine to be created in perf_session_deliver_event.
      
      Tested with --guestmount option and default guest args, with and without
      -B arg on record for both and for short (10 seconds) and long (10
      minutes) windows.
      Reported-by: NPradeep Kumar Surisetty <psuriset@linux.vnet.ibm.com>
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Pradeep Kumar Surisetty <psuriset@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1341180697-64515-1-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      207b5792
    • D
      perf script: Fix format regression due to libtraceevent merge · 76a8349d
      David Ahern 提交于
      Consider the commands:
          perf record -e sched:sched_switch -fo /tmp/perf.data  -a -- sleep 1
          perf script -i /tmp/perf.data
      
      In v3.4 the output has the form (lines wrapped here)
          perf 29214 [005] 821043.582596: sched_switch:
      prev_comm=perf prev_pid=29214 prev_prio=120
      prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120
      
      In 3.5 that same line has become:
          perf 29214 [005] 821043.582596: sched_switch:
      <...>-29214 [005]     0.000000000: sched_switch:
      prev_comm=perf prev_pid=29214 prev_prio=120
      prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120
      
      Note the duplicates in the output -- pid, cpu, event name. With
      this patch the v3.4 output is restored:
          perf 29214 [005] 821043.582596: sched_switch:
      prev_comm=perf prev_pid=29214 prev_prio=120
      prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120
      
      v3:
      Remove that pesky newline too. Output now matches v3.4 (pre-libtracevent).
      
      v2:
      Change print_trace_event function local to perf per Steve's comments.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1339698977-68962-1-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      76a8349d
  7. 30 6月, 2012 12 次提交