1. 03 2月, 2016 4 次提交
  2. 02 2月, 2016 10 次提交
  3. 01 2月, 2016 1 次提交
  4. 30 1月, 2016 14 次提交
    • A
      perf build: Align the names of the build tests: · 814568db
      Arnaldo Carvalho de Melo 提交于
        $ 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      814568db
    • H
      perf kvm/powerpc: Add support for HCALL reasons · 78e6c39b
      Hemant Kumar 提交于
      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: 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-4-git-send-email-hemant@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      78e6c39b
    • 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 const from kvm_events_tp · 48deaa74
      Hemant Kumar 提交于
      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: NHemant Kumar <hemant@linux.vnet.ibm.com>
      Acked-by: NDavid 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      48deaa74
    • 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
    • W
      perf record: Use OPT_BOOLEAN_SET for buildid cache related options · d2db9a98
      Wang Nan 提交于
      '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: NWang 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: NHe Kuang <hekuang@huawei.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d2db9a98
    • W
      perf tools: Move timestamp creation to util · 37b20151
      Wang Nan 提交于
      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: NWang 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: NHe Kuang <hekuang@huawei.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      37b20151
    • W
      perf test: Improve bp_signal · 8fd34e1c
      Wang Nan 提交于
      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: NWang 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: NJiri Olsa <jolsa@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8fd34e1c
    • W
      perf test: Check environment before start real BPF test · 6a7d550e
      Wang Nan 提交于
      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: NWang Nan <wangnan0@huawei.com>
      Suggested-by: NArnaldo 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      6a7d550e
    • W
      perf buildid: Fix cpumode of buildid event · fd786fac
      Wang Nan 提交于
      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: NWang 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      fd786fac
    • M
      perf auxtrace: Add perf_evlist pointer to *info_priv_size() · 14a05e13
      Mathieu Poirier 提交于
      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: NMathieu Poirier <mathieu.poirier@linaro.org>
      Acked-by: NAdrian 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      14a05e13
    • A
      perf tools: Speed up build-tests by reducing the number of builds tested · a639a623
      Arnaldo Carvalho de Melo 提交于
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      a639a623
    • W
      perf build: Use feature dump file for build-test · 79191c89
      Wang Nan 提交于
      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: NWang 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      79191c89
    • W
      perf build: Remove all condition feature check {C,LD}FLAGS · 5a155bb7
      Wang Nan 提交于
      '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: NWang 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      5a155bb7
  5. 29 1月, 2016 1 次提交
  6. 27 1月, 2016 4 次提交
  7. 26 1月, 2016 6 次提交
    • J
      kselftests: timers: Add adjtimex SETOFFSET validity tests · e03a58c3
      John Stultz 提交于
      Add some simple tests to check both valid and invalid
      offsets when using adjtimex's ADJ_SETOFFSET method.
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Acked-by: NShuah Khan <shuahkh@osg.samsung.com>
      Cc: Sasha Levin <sasha.levin@oracle.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Harald Hoyer <harald@redhat.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Cc: David Herrmann <dh.herrmann@gmail.com>
      Link: http://lkml.kernel.org/r/1453417415-19110-3-git-send-email-john.stultz@linaro.orgSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      e03a58c3
    • W
      tools build: Allow subprojects select all feature checkers · 9fd4186a
      Wang Nan 提交于
      Put feature checkers not in original FEATURE_TESTS to a new list and
      allow subproject select all feature checkers by setting FEATURE_TESTS to
      'all'.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      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>
      Link: http://lkml.kernel.org/r/1453715801-7732-4-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9fd4186a
    • W
      perf bpf: Check relocation target section · 666810e8
      Wang Nan 提交于
      Libbpf should check the target section before doing relocation to ensure
      the relocation is correct. If not, a bug in LLVM causes an error. See
      [1].  Also, if an incorrect BPF script uses both global variable and
      map, global variable whould be treated as map and be relocated without
      error.
      
      This patch saves the id of the map section into obj->efile and compare
      target section of a relocation symbol against it during relocation.
      
      Previous patch introduces a test case about this problem.  After this
      patch:
      
        # ~/perf test BPF
        37: Test BPF filter                                          :
        37.1: Test basic BPF filtering                               : Ok
        37.2: Test BPF prologue generation                           : Ok
        37.3: Test BPF relocation checker                            : Ok
      
        # perf test -v BPF
        ...
        37.3: Test BPF relocation checker                            :
        ...
        libbpf: loading object '[bpf_relocation_test]' from buffer
        libbpf: section .strtab, size 126, link 0, flags 0, type=3
        libbpf: section .text, size 0, link 0, flags 6, type=1
        libbpf: section .data, size 0, link 0, flags 3, type=1
        libbpf: section .bss, size 0, link 0, flags 3, type=8
        libbpf: section func=sys_write, size 104, link 0, flags 6, type=1
        libbpf: found program func=sys_write
        libbpf: section .relfunc=sys_write, size 16, link 10, flags 0, type=9
        libbpf: section maps, size 16, link 0, flags 3, type=1
        libbpf: maps in [bpf_relocation_test]: 16 bytes
        libbpf: section license, size 4, link 0, flags 3, type=1
        libbpf: license of [bpf_relocation_test] is GPL
        libbpf: section version, size 4, link 0, flags 3, type=1
        libbpf: kernel version of [bpf_relocation_test] is 40400
        libbpf: section .symtab, size 144, link 1, flags 0, type=2
        libbpf: map 0 is "my_table"
        libbpf: collecting relocating info for: 'func=sys_write'
        libbpf: Program 'func=sys_write' contains non-map related relo data pointing to section 65522
        bpf: failed to load buffer
        Compile BPF program failed.
        test child finished with 0
        ---- end ----
        Test BPF filter subtest 2: Ok
      
      [1] https://llvm.org/bugs/show_bug.cgi?id=26243Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      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-3-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      666810e8
    • W
      perf test: Add libbpf relocation checker · 7b6982ce
      Wang Nan 提交于
      There's a bug in LLVM that it can generate unneeded relocation
      information. See [1] and [2]. Libbpf should check the target section of
      a relocation symbol.
      
      This patch adds a testcase which references a global variable (BPF
      doesn't support global variables). Before fixing libbpf, the new test
      case can be loaded into kernel, the global variable acts like the first
      map. It is incorrect.
      
      Result:
      
        # ~/perf test BPF
        37: Test BPF filter                                          :
        37.1: Test basic BPF filtering                               : Ok
        37.2: Test BPF prologue generation                           : Ok
        37.3: Test BPF relocation checker                            : FAILED!
      
        # ~/perf test -v BPF
        ...
        libbpf: loading object '[bpf_relocation_test]' from buffer
        libbpf: section .strtab, size 126, link 0, flags 0, type=3
        libbpf: section .text, size 0, link 0, flags 6, type=1
        libbpf: section .data, size 0, link 0, flags 3, type=1
        libbpf: section .bss, size 0, link 0, flags 3, type=8
        libbpf: section func=sys_write, size 104, link 0, flags 6, type=1
        libbpf: found program func=sys_write
        libbpf: section .relfunc=sys_write, size 16, link 10, flags 0, type=9
        libbpf: section maps, size 16, link 0, flags 3, type=1
        libbpf: maps in [bpf_relocation_test]: 16 bytes
        libbpf: section license, size 4, link 0, flags 3, type=1
        libbpf: license of [bpf_relocation_test] is GPL
        libbpf: section version, size 4, link 0, flags 3, type=1
        libbpf: kernel version of [bpf_relocation_test] is 40400
        libbpf: section .symtab, size 144, link 1, flags 0, type=2
        libbpf: map 0 is "my_table"
        libbpf: collecting relocating info for: 'func=sys_write'
        libbpf: relocation: insn_idx=7
        Success unexpectedly: libbpf error when dealing with relocation
        test child finished with -1
        ---- end ----
        Test BPF filter subtest 2: FAILED!
      
      [1] https://llvm.org/bugs/show_bug.cgi?id=26243
      [2] https://patchwork.ozlabs.org/patch/571385/Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      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-2-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7b6982ce
    • A
      perf test: Fixup aliases checking in the 'vmlinux matches kallsyms' test · ab414dcd
      Arnaldo Carvalho de Melo 提交于
      There are cases where looking at just the next and prev entries is not
      enough, like with:
      
        $ readelf -sW /usr/lib/debug/lib/modules/4.3.3-301.fc23.x86_64/vmlinux | grep ffffffff81065ec0
         4979: ffffffff81065ec0 53 FUNC  LOCAL  DEFAULT 1 try_to_free_pud_page
         4980: ffffffff81065ec0 53 FUNC  LOCAL  DEFAULT 1 try_to_free_pte_page
         4981: ffffffff81065ec0 53 FUNC  LOCAL  DEFAULT 1 try_to_free_pmd_page
      
      So just search by name to see if the symbol is in kallsyms.
      
      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-jj1vlljg7ol4i713l60rt5ai@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ab414dcd
    • A
      perf machine: Introduce machine__find_kernel_symbol_by_name() · 8acd3da0
      Arnaldo Carvalho de Melo 提交于
      To be used in the 'vmlinux matches kallsyms' 'perf test'  entry.
      
      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-m56g1853lz2c6nhnqxibq4jd@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8acd3da0