1. 12 4月, 2016 1 次提交
  2. 30 1月, 2016 2 次提交
    • H
      perf kvm/powerpc: Port perf kvm stat to powerpc · 066d3593
      Hemant Kumar 提交于
      perf kvm can be used to analyze guest exit reasons. This support already
      exists in x86. Hence, porting it to powerpc.
      
       - To trace KVM events :
        perf kvm stat record
        If many guests are running, we can track for a specific guest by using
        --pid as in : perf kvm stat record --pid <pid>
      
       - To see the results :
        perf kvm stat report
      
      The result shows the number of exits (from the guest context to
      host/hypervisor context) grouped by their respective exit reasons with
      their frequency.
      
      Since, different powerpc machines have different KVM tracepoints, this
      patch discovers the available tracepoints dynamically and accordingly
      looks for them. If any single tracepoint is not present, this support
      won't be enabled for reporting. To record, this will fail if any of the
      events we are looking to record isn't available.  Right now, its only
      supported on PowerPC Book3S_HV architectures.
      
      To analyze the different exits, group them and present them (in a slight
      descriptive way) to the user, we need a mapping between the "exit code"
      (dumped in the kvm_guest_exit tracepoint data) and to its related
      Interrupt vector description (exit reason). This patch adds this mapping
      in book3s_hv_exits.h.
      
      It records on two available KVM tracepoints for book3s_hv:
      
      "kvm_hv:kvm_guest_exit" and "kvm_hv:kvm_guest_enter".
      
      Here is a sample o/p:
       # pgrep qemu
      19378
      60515
      
      2 Guests are running on the host.
      
       # perf kvm stat record -a
      ^C[ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 4.153 MB perf.data.guest (39624
      samples) ]
      
       # perf kvm stat report -p 60515
      
      Analyze events for pid(s) 60515, all VCPUs:
      
           VM-EXIT Samples Samples% Time% MinTime    MaxTime  Avg time
      
             SYSCALL  9141  63.67%  7.49% 1.26us   5782.39us    9.87us (+- 6.46%)
      H_DATA_STORAGE  4114  28.66%  5.07% 1.72us   4597.68us   14.84us (+-20.06%)
      HV_DECREMENTER   418   2.91%  4.26% 0.70us  30002.22us  122.58us (+-70.29%)
            EXTERNAL   392   2.73%  0.06% 0.64us    104.10us    1.94us (+-18.83%)
      RETURN_TO_HOST   287   2.00% 83.11% 1.53us 124240.15us 3486.52us (+-16.81%)
      H_INST_STORAGE     5   0.03%  0.00% 1.88us      3.73us    2.39us (+-14.20%)
      
      Total Samples:14357, Total events handled time:1203918.42us.
      Signed-off-by: NHemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Scott  Wood <scottwood@freescale.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/1453962787-15376-3-git-send-email-hemant@linux.vnet.ibm.comSigned-off-by: NSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      066d3593
    • H
      perf kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h · 162607ea
      Hemant Kumar 提交于
      Its better to remove the dependency on uapi/kvm_perf.h to allow dynamic
      discovery of kvm events (if its needed). To do this, some extern
      variables have been introduced with which we can keep the generic
      functions generic.
      Signed-off-by: NHemant Kumar <hemant@linux.vnet.ibm.com>
      Acked-by: NAlexander Yarygin <yarygin@linux.vnet.ibm.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Scott  Wood <scottwood@freescale.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/1453962787-15376-1-git-send-email-hemant@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      162607ea
  3. 18 12月, 2015 1 次提交
  4. 11 12月, 2015 1 次提交
  5. 14 9月, 2015 1 次提交
  6. 02 7月, 2015 1 次提交
  7. 20 6月, 2015 1 次提交
  8. 09 5月, 2015 1 次提交
    • A
      perf machine: Protect the machine->threads with a rwlock · b91fc39f
      Arnaldo Carvalho de Melo 提交于
      In addition to using refcounts for the struct thread lifetime
      management, we need to protect access to machine->threads from
      concurrent access.
      
      That happens in 'perf top', where a thread processes events, inserting
      and deleting entries from that rb_tree while another thread decays
      hist_entries, that end up dropping references and ultimately deleting
      threads from the rb_tree and releasing its resources when no further
      hist_entry (or other data structures, like in 'perf sched') references
      it.
      
      So the rule is the same for refcounts + protected trees in the kernel,
      get the tree lock, find object, bump the refcount, drop the tree lock,
      return, use object, drop the refcount if no more use of it is needed,
      keep it if storing it in some other data structure, drop when releasing
      that data structure.
      
      I.e. pair "t = machine__find(new)_thread()" with a "thread__put(t)", and
      "perf_event__preprocess_sample(&al)" with "addr_location__put(&al)".
      
      The addr_location__put() one is because as we return references to
      several data structures, we may end up adding more reference counting
      for the other data structures and then we'll drop it at
      addr_location__put() time.
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-bs9rt4n0jw3hi9f3zxyy3xln@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b91fc39f
  9. 03 4月, 2015 1 次提交
    • Y
      perf kvm: Support using -f to override perf.data.guest file ownership · 8cc5ec1f
      Yunlong Song 提交于
      Enable perf kvm to use perf.data.guest when it is not owned by current
      user or root.
      
      Example:
      
       # perf kvm stat record ls
       # chown Yunlong.Song:Yunlong.Song perf.data.guest
       # ls -al perf.data.guest
       -rw------- 1 Yunlong.Song Yunlong.Song 4128937 Apr  2 11:05 perf.data.guest
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf kvm stat report
       File perf.data.guest not owned by current user or root (use -f to override)
       Initializing perf session failed
       # perf kvm stat report -f
         Error: unknown switch `f'
      
        usage: perf kvm stat report [<options>]
      
               --event <report event>
                                 event for reporting: vmexit, mmio (x86 only),
                                 ioport (x86 only)
               --vcpu <n>        vcpu id to report
           -k, --key <sort-key>  key for sorting: sample(sort by samples
       						   number) time (sort by avg time)
           -p, --pid <pid>       analyze events only for given process id(s)
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       # perf kvm stat report
       File perf.data.guest not owned by current user or root (use -f to override)
       Initializing perf session failed
       # perf kvm stat report -f
       Analyze events for all VMs, all VCPUs:
      
         VM-EXIT    Samples  Samples%     Time%    Min Time    Max Time   Avg time
      
       Total Samples:0, Total events handled time:0.00us.
      
      As shown above, the -f option really works now. Since we have not
      launched any KVM related process, the result shows 0 sample here.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-5-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8cc5ec1f
  10. 12 3月, 2015 1 次提交
  11. 11 3月, 2015 1 次提交
  12. 10 12月, 2014 1 次提交
  13. 29 10月, 2014 1 次提交
    • N
      perf kvm: Print kvm specific --help output · f45d20ff
      Namhyung Kim 提交于
      The 'perf kvm stat record' tool is an alias of 'perf record' with
      predefined kvm related options. All options that passed to 'perf kvm
      stat record' are processed by the 'perf record' tool. So, 'perf kvm
      stat record --help' prints help of usage for the 'perf record'
      command. There are a few options useful for 'perf kvm stat record',
      the rest either break kvm related output or don't change it.
      
      Let's print safe for 'perf kvm stat record' options in addition to
      general 'perf record' --help output.
      
      With this patch, new output looks like below:
      
        $ perf kvm stat record -h
      
         usage: perf kvm stat record [<options>]
      
            -p, --pid <pid>       record events on existing process id
            -t, --tid <tid>       record events on existing thread id
            -r, --realtime <n>    collect data with this RT SCHED_FIFO priority
                --no-buffering    collect data without buffering
            -a, --all-cpus        system-wide collection from all CPUs
            -C, --cpu <cpu>       list of cpus to monitor
            -c, --count <n>       event period to sample
            -o, --output <file>   output file name
            -i, --no-inherit      child tasks do not inherit counters
            -m, --mmap-pages <pages>
                                  number of mmap data pages
            -v, --verbose         be more verbose (show counter open errors, etc)
            -q, --quiet           don't print any message
            -s, --stat            per thread counts
            -D, --delay <n>       ms to wait before starting measurement after program start
            -u, --uid <user>      user to profile
                --per-thread      use per-thread mmaps
      
        $ perf kvm stat record -n sleep 1
          Error: switch `n' is not usable
      
         usage: perf kvm stat record [<options>]
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NHemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1413990949-13953-4-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f45d20ff
  14. 16 10月, 2014 2 次提交
  15. 03 10月, 2014 3 次提交
  16. 26 9月, 2014 3 次提交
  17. 18 9月, 2014 3 次提交
  18. 16 8月, 2014 1 次提交
  19. 14 8月, 2014 2 次提交
    • N
      perf tools: Check recorded kernel version when finding vmlinux · 0a7e6d1b
      Namhyung Kim 提交于
      Currently vmlinux_path__init() only tries to find vmlinux file from
      current directory, /boot and some canonical directories with version
      number of the running kernel.  This can be a problem when reporting old
      data recorded on a kernel version not running currently.
      
      We can use --symfs option for this but it's annoying for user to do it
      always.  As we already have the info in the perf.data file, it can be
      changed to use it for the search automatically.
      
      Before:
      
        $ perf report
        ...
        # Samples: 4K of event 'cpu-clock'
        # Event count (approx.): 1067250000
        #
        # Overhead  Command     Shared Object      Symbol
        # ........  ..........  .................  ..............................
            71.87%     swapper  [kernel.kallsyms]  [k] recover_probed_instruction
      
      After:
      
        # Overhead  Command     Shared Object      Symbol
        # ........  ..........  .................  ....................
            71.87%     swapper  [kernel.kallsyms]  [k] native_safe_halt
      
      This requires to change signature of symbol__init() to receive struct
      perf_session_env *.
      Reported-by: NMinchan Kim <minchan@kernel.org>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1407825645-24586-14-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0a7e6d1b
    • N
      perf kvm: Move call to symbol__init() after creating session · 14d37f38
      Namhyung Kim 提交于
      This is a preparation of fixing dso__load_kernel_sym().  It needs a
      session info before calling symbol__init().
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1407825645-24586-8-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      14d37f38
  20. 13 8月, 2014 1 次提交
  21. 12 8月, 2014 3 次提交
  22. 02 8月, 2014 1 次提交
  23. 17 7月, 2014 4 次提交
  24. 08 7月, 2014 3 次提交