1. 28 5月, 2020 4 次提交
  2. 24 5月, 2020 2 次提交
  3. 23 5月, 2020 2 次提交
  4. 21 5月, 2020 2 次提交
  5. 16 5月, 2020 1 次提交
  6. 15 5月, 2020 3 次提交
  7. 12 5月, 2020 1 次提交
  8. 08 5月, 2020 9 次提交
  9. 07 5月, 2020 6 次提交
  10. 06 5月, 2020 10 次提交
    • P
      KVM: selftests: Fix build for evmcs.h · 8ffdaf91
      Peter Xu 提交于
      I got this error when building kvm selftests:
      
      /usr/bin/ld: /home/xz/git/linux/tools/testing/selftests/kvm/libkvm.a(vmx.o):/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:222: multiple definition of `current_evmcs'; /tmp/cco1G48P.o:/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:222: first defined here
      /usr/bin/ld: /home/xz/git/linux/tools/testing/selftests/kvm/libkvm.a(vmx.o):/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:223: multiple definition of `current_vp_assist'; /tmp/cco1G48P.o:/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:223: first defined here
      
      I think it's because evmcs.h is included both in a test file and a lib file so
      the structs have multiple declarations when linking.  After all it's not a good
      habit to declare structs in the header files.
      
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <20200504220607.99627-1-peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      8ffdaf91
    • A
      perf flamegraph: Use /bin/bash for report and record scripts · 19ce2321
      Arnaldo Carvalho de Melo 提交于
      As all the other tools/perf/scripts/python/bin/*-{report,record}
      scripts, fixing the this problem reported by Daniel Diaz:
      
        Our OpenEmbedded builds detected an issue with 5287f926 ("perf
        script: Add flamegraph.py script"):
          ERROR: perf-1.0-r9 do_package_qa: QA Issue:
        /usr/libexec/perf-core/scripts/python/bin/flamegraph-report contained
        in package perf-python requires /usr/bin/sh, but no providers found in
        RDEPENDS_perf-python? [file-rdeps]
      
        This means that there is a new binary pulled in in the shebang line
        which was unaccounted for: `/usr/bin/sh`. I don't see any other usage
        of /usr/bin/sh in the kernel tree (does not even exist on my Ubuntu
        dev machine) but plenty of /bin/sh. This patch is needed:
        -----8<----------8<----------8<-----
        diff --git a/tools/perf/scripts/python/bin/flamegraph-record
        b/tools/perf/scripts/python/bin/flamegraph-record
        index 725d66e71570..a2f3fa25ef81 100755
        --- a/tools/perf/scripts/python/bin/flamegraph-record
        +++ b/tools/perf/scripts/python/bin/flamegraph-record
        @@ -1,2 +1,2 @@
        -#!/usr/bin/sh
        +#!/bin/sh
         perf record -g "$@"
        diff --git a/tools/perf/scripts/python/bin/flamegraph-report
        b/tools/perf/scripts/python/bin/flamegraph-report
        index b1a79afd903b..b0177355619b 100755
        --- a/tools/perf/scripts/python/bin/flamegraph-report
        +++ b/tools/perf/scripts/python/bin/flamegraph-report
        @@ -1,3 +1,3 @@
        -#!/usr/bin/sh
        +#!/bin/sh
         # description: create flame graphs
         perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@"
        ----->8---------->8---------->8-----
      
      Fixes: 5287f926 ("perf script: Add flamegraph.py script")
      Reported-by: NDaniel Díaz <daniel.diaz@linaro.org>
      Acked-by: NAndreas Gerstmayr <agerstmayr@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: lkft-triage@lists.linaro.org
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/CAEUSe7_wmKS361mKLTB1eYbzYXcKkXdU26BX5BojdKRz8MfPCw@mail.gmail.com
      Link: http://lore.kernel.org/lkml/20200505170320.GZ30487@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      19ce2321
    • L
      perf cs-etm: Move definition of 'traceid_list' global variable from header file · 168200b6
      Leo Yan 提交于
      The variable 'traceid_list' is defined in the header file cs-etm.h,
      if multiple C files include cs-etm.h the compiler might complaint for
      multiple definition of 'traceid_list'.
      
      To fix multiple definition error, move the definition of 'traceid_list'
      into cs-etm.c.
      
      Fixes: cd8bfd8c ("perf tools: Add processing of coresight metadata")
      Reported-by: NThomas Backlund <tmb@mageia.org>
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Reviewed-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Reviewed-by: NMike Leach <mike.leach@linaro.org>
      Tested-by: NMike Leach <mike.leach@linaro.org>
      Tested-by: NThomas Backlund <tmb@mageia.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Tor Jeremiassen <tor@ti.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lore.kernel.org/lkml/20200505133642.4756-1-leo.yan@linaro.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      168200b6
    • I
      libsymbols kallsyms: Move hex2u64 out of header · 32add10f
      Ian Rogers 提交于
      hex2u64 is a helper that's out of place in kallsyms.h as not being
      kallsyms related. Move from kallsyms.h to the only user.
      
      Committer notes:
      
      Move it out of tools/lib/symbol/kallsyms.c as well, as we had to leave
      it there in the previous patch lest we break the build.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lore.kernel.org/lkml/20200501221315.54715-4-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      32add10f
    • I
      libsymbols kallsyms: Parse using io api · 53df2b93
      Ian Rogers 提交于
      'perf record' will call kallsyms__parse 4 times during startup and
      process megabytes of data. This changes kallsyms__parse to use the io
      library rather than fgets to improve performance of the user code by
      over 8%.
      
      Before:
      
        Running 'internals/kallsyms-parse' benchmark:
        Average kallsyms__parse took: 103.988 ms (+- 0.203 ms)
      
      After:
      
        Running 'internals/kallsyms-parse' benchmark:
        Average kallsyms__parse took: 95.571 ms (+- 0.006 ms)
      
      For a workload like:
      
        $ perf record /bin/true
        Run under 'perf record -e cycles:u -g' the time goes from:
        Before
        30.10%     1.67%  perf     perf                [.] kallsyms__parse
        After
        25.55%    20.04%  perf     perf                [.] kallsyms__parse
      
      So a little under 5% of the start-up time is removed. A lot of what
      remains is on the kernel side, but caching kallsyms within perf would at
      least impact memory footprint.
      
      Committer notes:
      
      The internal/kallsyms-parse bench is run using:
      
        [root@five ~]# perf bench internals kallsyms-parse
        # Running 'internals/kallsyms-parse' benchmark:
          Average kallsyms__parse took: 80.381 ms (+- 0.115 ms)
        [root@five ~]#
      
      And this pre-existing test uses these routines to parse kallsyms and
      then compare with the info obtained from the matching ELF symtab:
      
        [root@five ~]# perf test vmlinux
         1: vmlinux symtab matches kallsyms                       : Ok
        [root@five ~]#
      
      Also we can't remove hex2u64() in this patch as this breaks the build:
      
        /usr/bin/ld: /tmp/build/perf/perf-in.o: in function `modules__parse':
        /home/acme/git/perf/tools/perf/util/symbol.c:607: undefined reference to `hex2u64'
        /usr/bin/ld: /home/acme/git/perf/tools/perf/util/symbol.c:607: undefined reference to `hex2u64'
        /usr/bin/ld: /tmp/build/perf/perf-in.o: in function `dso__load_perf_map':
        /home/acme/git/perf/tools/perf/util/symbol.c:1477: undefined reference to `hex2u64'
        /usr/bin/ld: /home/acme/git/perf/tools/perf/util/symbol.c:1483: undefined reference to `hex2u64'
        collect2: error: ld returned 1 exit status
      
      Leave it there, move it in the next patch.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lore.kernel.org/lkml/20200501221315.54715-3-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      53df2b93
    • I
      perf bench: Add kallsyms parsing · 51876bd4
      Ian Rogers 提交于
      Add a benchmark for kallsyms parsing. Example output:
      
        Running 'internals/kallsyms-parse' benchmark:
        Average kallsyms__parse took: 103.971 ms (+- 0.121 ms)
      
      Committer testing:
      
      Test Machine: AMD Ryzen 5 3600X 6-Core Processor
      
        [root@five ~]# perf bench internals kallsyms-parse
        # Running 'internals/kallsyms-parse' benchmark:
          Average kallsyms__parse took: 79.692 ms (+- 0.101 ms)
        [root@five ~]# perf stat -r5 perf bench internals kallsyms-parse
        # Running 'internals/kallsyms-parse' benchmark:
          Average kallsyms__parse took: 80.563 ms (+- 0.079 ms)
        # Running 'internals/kallsyms-parse' benchmark:
          Average kallsyms__parse took: 81.046 ms (+- 0.155 ms)
        # Running 'internals/kallsyms-parse' benchmark:
          Average kallsyms__parse took: 80.874 ms (+- 0.104 ms)
        # Running 'internals/kallsyms-parse' benchmark:
          Average kallsyms__parse took: 81.173 ms (+- 0.133 ms)
        # Running 'internals/kallsyms-parse' benchmark:
          Average kallsyms__parse took: 81.169 ms (+- 0.074 ms)
      
         Performance counter stats for 'perf bench internals kallsyms-parse' (5 runs):
      
                  8,093.54 msec task-clock                #    0.999 CPUs utilized            ( +-  0.14% )
                     3,165      context-switches          #    0.391 K/sec                    ( +-  0.18% )
                        10      cpu-migrations            #    0.001 K/sec                    ( +- 23.13% )
                       744      page-faults               #    0.092 K/sec                    ( +-  0.21% )
            34,551,564,954      cycles                    #    4.269 GHz                      ( +-  0.05% )  (83.33%)
             1,160,584,308      stalled-cycles-frontend   #    3.36% frontend cycles idle     ( +-  1.60% )  (83.33%)
            14,974,323,985      stalled-cycles-backend    #   43.34% backend cycles idle      ( +-  0.24% )  (83.33%)
            58,712,905,705      instructions              #    1.70  insn per cycle
                                                          #    0.26  stalled cycles per insn  ( +-  0.01% )  (83.34%)
            14,136,433,778      branches                  # 1746.632 M/sec                    ( +-  0.01% )  (83.33%)
               141,943,217      branch-misses             #    1.00% of all branches          ( +-  0.04% )  (83.33%)
      
                    8.1040 +- 0.0115 seconds time elapsed  ( +-  0.14% )
      
        [root@five ~]#
      Signed-off-by: NIan Rogers <irogers@google.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lore.kernel.org/lkml/20200501221315.54715-2-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      51876bd4
    • M
      perf: cs-etm: Update to build with latest opencsd version. · 29e2eb2a
      Mike Leach 提交于
      OpenCSD version v0.14.0 adds in a new output element. This is represented
      by a new value in the generic element type enum, which must be added to
      the handling code in perf cs-etm-decoder to prevent build errors due to
      build options on the perf project.
      
      This element is not currently used by the perf decoder.
      
      Perf build feature test updated to require a minimum of 0.14.0
      
      Tested on Linux 5.7-rc3.
      Signed-off-by: NMike Leach <mike.leach@linaro.org>
      Reviewed-by: NLeo Yan <leo.yan@linaro.org>
      Reviewed-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lore.kernel.org/lkml/20200501143615.1180-1-mike.leach@linaro.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      29e2eb2a
    • T
      perf symbol: Fix kernel symbol address display · 51d96355
      Thomas Richter 提交于
      Running commands
      
         ./perf record -e rb0000 -- find .
         ./perf report -v
      
      reveals symbol names and its addresses. There is a mismatch between
      kernel symbol and address. Here is an example for kernel symbol
      check_chain_key:
      
       3.55%  find /lib/modules/.../build/vmlinux  0xf11ec  v [k] check_chain_key
      
      This address is off by 0xff000 as can be seen with:
      
      [root@t35lp46 ~]# fgrep check_chain_key /proc/kallsyms
      00000000001f00d0 t check_chain_key
      [root@t35lp46 ~]# objdump -t ~/linux/vmlinux| fgrep check_chain_key
      00000000001f00d0 l     F .text	00000000000001e8 check_chain_key
      [root@t35lp46 ~]#
      
      This function is located in main memory 0x1f00d0 - 0x1f02b4. It has
      several entries in the perf data file with the correct address:
      
      [root@t35lp46 perf]# ./perf report -D -i perf.data.find-bad | \
      				fgrep SAMPLE| fgrep 0x1f01ec
      PERF_RECORD_SAMPLE(IP, 0x1): 22228/22228: 0x1f01ec period: 1300000 addr: 0
      PERF_RECORD_SAMPLE(IP, 0x1): 22228/22228: 0x1f01ec period: 1300000 addr: 0
      
      The root cause happens when reading symbol tables during perf report.
      A long gdb call chain leads to
      
         machine__deliver_events
           perf_evlist__deliver_event
             perf_evlist__deliver_sample
               build_id__mark_dso_hits
      	   thread__find_map(1)      Read correct address from sample entry
      	     map__load
      	       dso__load            Some more functions to end up in
      	         ....
      		 dso__load_sym.
      
      Function dso__load_syms  checks for kernel relocation and symbol
      adjustment for the kernel and results in kernel map adjustment of
      	 kernel .text segment address (0x100000 on s390)
      	 kernel .text segment offset in file (0x1000 on s390).
      This results in all kernel symbol addresses to be changed by subtracting
      0xff000 (on s390). For the symbol check_chain_key we end up with
      
          0x1f00d0 - 0x100000 + 0x1000 = 0xf11d0
      
      and this address is saved in the perf symbol table. This calculation is
      also applied by the mapping functions map__mapip() and map__unmapip()
      to map IP addresses to dso mappings.
      
      During perf report processing functions
      
         process_sample_event    (builtin-report.c)
           machine__resolve
             thread__find_map
           hist_entry_iter_add
      
      are called. Function thread__find_map(1)
      takes the correct sample address and applies the mapping function
      map__mapip() from the kernel dso and saves the modified address
      in struct addr_location for further reference. From now on this address
      is used.
      
      Funktion process_sample_event() then calls hist_entry_iter_add() to save
      the address in member ip of struct hist_entry.
      
      When samples are displayed using
      
          perf_evlist__tty_browse_hists
            hists__fprintf
              hist_entry__fprintf
      	  hist_entry__snprintf
      	    __hist_entry__snprintf
      	      _hist_entry__sym_snprintf()
      
      This simply displays the address of the symbol and ignores the dso <-> map
      mappings done in function thread__find_map. This leads to the address
      mismatch.
      
      Output before:
      
      ot@t35lp46 perf]# ./perf report -v | fgrep check_chain_key
           3.55%  find     /lib/modules/5.6.0d-perf+/build/vmlinux
           						0xf11ec v [k] check_chain_key
      [root@t35lp46 perf]#
      
      Output after:
      
      [root@t35lp46 perf]# ./perf report -v | fgrep check_chain_key
           3.55%  find     /lib/modules/5.6.0d-perf+/build/vmlinux
           						0x1f01ec v [k] check_chain_key
      [root@t35lp46 perf]#
      Signed-off-by: NThomas Richter <tmricht@linux.ibm.com>
      Acked-by: NSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/lkml/20200415070744.59919-1-tmricht@linux.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      51d96355
    • A
      perf inject: Rename perf_evsel__*() operating on 'struct evsel *' to evsel__*() · b14b36d0
      Arnaldo Carvalho de Melo 提交于
      As those is a 'struct evsel' methods, not part of tools/lib/perf/, aka
      libperf, to whom the perf_ prefix belongs.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b14b36d0
    • A
      perf annotate: Rename perf_evsel__*() operating on 'struct evsel *' to evsel__*() · 74aa90e8
      Arnaldo Carvalho de Melo 提交于
      As those is a 'struct evsel' methods, not part of tools/lib/perf/, aka
      libperf, to whom the perf_ prefix belongs.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      74aa90e8