1. 01 Feb, 2016 1 commit
  2. 29 Jan, 2016 14 commits
    • Arnaldo Carvalho de Melo's avatar
      perf build: Align the names of the build tests: · 814568db
      Arnaldo Carvalho de Melo authored
        $ make -C tools/perf build-test
        make[1]: Entering directory `/home/acme/git/linux/tools/perf'
                       make_pure_O: cd . && make -f Makefile  O=/tmp/tmp.mPx0Cmik3f DESTDIR=/tmp/tmp.U0SUmVbtJm
                  make_clean_all_O: cd . && make -f Makefile  O=/tmp/tmp.Yl5UzhTU7T DESTDIR=/tmp/tmp.fop1E4jdER clean all
                      make_debug_O: cd . && make -f Makefile  O=/tmp/tmp.pMn2ozBoXC DESTDIR=/tmp/tmp.azxhDp5sEp DEBUG=1
                 make_no_libperl_O: cd . && make -f Makefile  O=/tmp/tmp.qJPiINMtA7 DESTDIR=/tmp/tmp.KNMrLeGDxZ NO_LIBPERL=1
        <SNIP>
      
      More needs to be done to make it more compact, i.e. elide the '-f Makefile',
      remove that 'cd . &&', move the DESTDIR= and O= to the end, as they don't
      convey that much information besides the fact that they are being set to some
      random directory just for this build, move the meat, i.e. the meaningful
      feature disabling bits to the start, etc.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-wir3w3o4f1nmbgcxgnx8cj9c@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      814568db
    • Hemant Kumar's avatar
      perf kvm/powerpc: Add support for HCALL reasons · 78e6c39b
      Hemant Kumar authored
      Powerpc provides hcall events that also provides insights into guest
      behaviour. Enhance perf kvm stat to record and analyze hcall events.
      
       - To trace hcall events :
        perf kvm stat record
      
       - To show the results :
        perf kvm stat report --event=hcall
      
      The result shows the number of hypervisor calls from the guest grouped
      by their respective reasons displayed with the frequency.
      
      This patch makes use of two additional tracepoints
      "kvm_hv:kvm_hcall_enter" and "kvm_hv:kvm_hcall_exit". To map the hcall
      codes to their respective names, it needs a mapping. Such mapping is
      added in this patch in book3s_hcalls.h.
      
       # pgrep qemu
      A sample output :
      19378
      60515
      
      2 VMs running.
      
       # 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 --event=hcall
      
      Analyze events for all VMs, all VCPUs:
      
          HCALL-EVENT Samples Samples% Time% MinTime MaxTime  AvgTime
      
                H_IPI     822  66.08% 88.10% 0.63us  11.38us 2.05us (+- 1.42%)
           H_SEND_CRQ     144  11.58%  3.77% 0.41us   0.88us 0.50us (+- 1.47%)
         H_VIO_SIGNAL     118   9.49%  2.86% 0.37us   0.83us 0.47us (+- 1.43%)
      H_PUT_TERM_CHAR      76   6.11%  2.07% 0.37us   0.90us 0.52us (+- 2.43%)
      H_GET_TERM_CHAR      74   5.95%  2.23% 0.37us   1.70us 0.58us (+- 4.77%)
               H_RTAS       6   0.48%  0.85% 1.10us   9.25us 2.70us (+-48.57%)
            H_PERFMON       4   0.32%  0.12% 0.41us   0.96us 0.59us (+-20.92%)
      
      Total Samples:1244, Total events handled time:1916.69us.
      Signed-off-by: default avatarHemant 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-4-git-send-email-hemant@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      78e6c39b
    • Hemant Kumar's avatar
      perf kvm/powerpc: Port perf kvm stat to powerpc · 066d3593
      Hemant Kumar authored
      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: default avatarHemant 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: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      066d3593
    • Hemant Kumar's avatar
      perf kvm/{x86,s390}: Remove const from kvm_events_tp · 48deaa74
      Hemant Kumar authored
      This patch removes the "const" qualifier from kvm_events_tp declaration
      to account for the fact that some architectures may need to update this
      variable dynamically. For instance, powerpc will need to update this
      variable dynamically depending on the machine type.
      Signed-off-by: default avatarHemant Kumar <hemant@linux.vnet.ibm.com>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.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-2-git-send-email-hemant@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      48deaa74
    • Hemant Kumar's avatar
      perf kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h · 162607ea
      Hemant Kumar authored
      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: default avatarHemant Kumar <hemant@linux.vnet.ibm.com>
      Acked-by: default avatarAlexander Yarygin <yarygin@linux.vnet.ibm.com>
      Acked-by: default avatarDavid 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      162607ea
    • Wang Nan's avatar
      perf record: Use OPT_BOOLEAN_SET for buildid cache related options · d2db9a98
      Wang Nan authored
      'perf record' knows whether buildid cache is enabled (via
      --no-no-buildid-cache) deliberately. Buildid cache can be turned off in
      some situations.
      
      Output switching support needs this feature to turn off buildid cache
      by default.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1453715801-7732-33-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarHe Kuang <hekuang@huawei.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d2db9a98
    • Wang Nan's avatar
      perf tools: Move timestamp creation to util · 37b20151
      Wang Nan authored
      Timestamp generation becomes a public available helper. Which will
      be used by 'perf record', help it output to split output file based
      on time.
      
      For example:
      
       perf.data.2015122620363710
       perf.data.2015122620364092
       perf.data.2015122620365423
       ...
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1453715801-7732-27-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarHe Kuang <hekuang@huawei.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      37b20151
    • Wang Nan's avatar
      perf test: Improve bp_signal · 8fd34e1c
      Wang Nan authored
      Will Deacon [1] has some question on patch [2]. This patch improves
      test__bp_signal so we can test:
      
       1. A watchpoint and a breakpoint that fire on the same instruction
       2. Nested signals
      
      Test result:
      
       On x86_64 and ARM64 (result are similar with patch [2] on ARM64):
      
        # ./perf test -v signal
        17: Test breakpoint overflow signal handler                  :
        --- start ---
        test child forked, pid 10213
        count1 1, count2 3, count3 2, overflow 3, overflows_2 3
        test child finished with 0
        ---- end ----
        Test breakpoint overflow signal handler: Ok
      
      So at least 2 cases Will doubted are handled correctly.
      
      [1] http://lkml.kernel.org/g/20160104165535.GI1616@arm.com
      [2] http://lkml.kernel.org/g/1450921362-198371-1-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1453715801-7732-9-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8fd34e1c
    • Wang Nan's avatar
      perf test: Check environment before start real BPF test · 6a7d550e
      Wang Nan authored
      Copying perf to old kernel system results:
      
        # perf test bpf
        37: Test BPF filter                                          :
        37.1: Test basic BPF filtering                               : FAILED!
        37.2: Test BPF prologue generation                           : Skip
      
      However, in case when kernel doesn't support a test case it should
      return 'Skip', 'FAILED!' should be reserved for kernel tests for when
      the kernel supports a feature that then fails to work as advertised.
      
      This patch checks environment before real testcase.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Suggested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1453715801-7732-7-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6a7d550e
    • Wang Nan's avatar
      perf buildid: Fix cpumode of buildid event · fd786fac
      Wang Nan authored
      There is a nasty confusion that, for kernel module, dso->kernel is not
      necessary to be DSO_TYPE_KERNEL or DSO_TYPE_GUEST_KERNEL.  These two
      enums are for vmlinux. See thread [1]. We tried to fix this part but it
      is costy.
      
      Code machine__write_buildid_table() is another unfortunate function fall
      into this trap that, when issuing buildid event for a kernel module,
      cpumode it gives to the event is PERF_RECORD_MISC_USER, not
      PERF_RECORD_MISC_KERNEL.
      
      However, even with this bug, most of the time it doesn't causes real
      problem. I find this issue when trying to use a perf before commit
      3d39ac53 ("perf machine: No need to have two DSOs lists") to parse a
      perf.data generated by newest perf.
      
      [1] https://lkml.org/lkml/2015/9/21/908Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1454089251-203152-1-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fd786fac
    • Mathieu Poirier's avatar
      perf auxtrace: Add perf_evlist pointer to *info_priv_size() · 14a05e13
      Mathieu Poirier authored
      On some architecture the size of the private header may be dependent on
      the number of tracers used in the session.  As such adding a "struct
      perf_evlist *" parameter, which should contain all the required
      information.
      
      Also adjusting the existing client of the interface to take the new
      parameter into account.
      Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Al Grant <al.grant@arm.com>
      Cc: Chunyan Zhang <zhang.chunyan@linaro.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-doc@vger.kernel.org
      Cc: Mike Leach <mike.leach@arm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Rabin Vincent <rabin@rab.in>
      Cc: Tor Jeremiassen <tor@ti.com>
      Link: http://lkml.kernel.org/r/1452807977-8069-22-git-send-email-mathieu.poirier@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      14a05e13
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Speed up build-tests by reducing the number of builds tested · a639a623
      Arnaldo Carvalho de Melo authored
      The 'tools/perf/test/make' makefile has in its default, 'all' target
      builds that will pollute the source code directory, i.e. that will not
      use O= variable.
      
      The 'build-test' should be run as often as possible, preferrably after
      each non strictly non-code commit, so speed it up by selecting just
      the O= targets.
      
      Furthermore it tests both the Makefile.perf file, that is normally
      driven by the main Makefile, and the Makefile, reduce the time in half
      by having just MK=Makefile, the most usual, tested by 'build-test'.
      
      Please run:
      
        make -C tools/perf -f tests/make
      
      from time to time for testing also the in-place build tests.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-jrt9utscsiqkmjy3ccufostd@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a639a623
    • Wang Nan's avatar
      perf build: Use feature dump file for build-test · 79191c89
      Wang Nan authored
      To prevent the feature check tests to run repeately, one time per
      'tests/make' target/test, this patch utilizes the previously introduced
      'feature-dump' make target and FEATURES_DUMP variable, making sure that
      the feature checkers run only once when doing build-test for normal test
      cases.
      
      However, since standard users doesn't reuse features dump result, we'd
      better give an option to check their behaviors. The above feature
      should be used to make build-test faster only. Only utilize it for
      build-test.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1454068269-235999-1-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      79191c89
    • Wang Nan's avatar
      perf build: Remove all condition feature check {C,LD}FLAGS · 5a155bb7
      Wang Nan authored
      'make feature-dump' should give a stable result, so even 'NO_SOMETHING=1'
      is given (for babeltrace, if LIBBABELTRACE=1 is not given), we should
      try to detect those feature and {C,LD}FLAGS. Build or not should be
      controled independent.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Link: http://lkml.kernel.org/r/1454047050-204993-1-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5a155bb7
  3. 28 Jan, 2016 1 commit
  4. 27 Jan, 2016 1 commit
  5. 26 Jan, 2016 23 commits