1. 09 2月, 2017 4 次提交
    • A
      perf thread_map: Correctly size buffer used with dirent->dt_name · bdf23a9a
      Arnaldo Carvalho de Melo 提交于
      The size of dirent->dt_name is NAME_MAX + 1, but the size for the 'path'
      buffer is hard coded at 256, which may truncate it because we also
      prepend "/proc/", so that all that into account and thank gcc 7 for this
      warning:
      
        /git/linux/tools/perf/util/thread_map.c: In function 'thread_map__new_by_uid':
        /git/linux/tools/perf/util/thread_map.c:119:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 250 [-Werror=format-truncation=]
           snprintf(path, sizeof(path), "/proc/%s", dirent->d_name);
                                               ^~
        In file included from /usr/include/stdio.h:939:0,
                         from /git/linux/tools/perf/util/thread_map.c:5:
        /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 7 and 262 bytes into a destination of size 256
           return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                __bos (__s), __fmt, __va_arg_pack ());
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-csy0r8zrvz5efccgd4k12c82@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bdf23a9a
    • A
      tools strfilter: Use __fallthrough · d64b721d
      Arnaldo Carvalho de Melo 提交于
      The implicit fall through case label here is intended, so let us inform
      that to gcc >= 7:
      
        util/strfilter.c: In function 'strfilter_node__sprint':
        util/strfilter.c:270:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
           if (len < 0)
              ^
        util/strfilter.c:272:2: note: here
          case '!':
          ^~~~
        cc1: all warnings being treated as errors
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-z2dpywg7u8fim000hjfbpyfm@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d64b721d
    • A
      tools string: Use __fallthrough in perf_atoll() · 94bdd5ed
      Arnaldo Carvalho de Melo 提交于
      The implicit fall through case label here is intended, so let us inform
      that to gcc >= 7:
      
          CC       /tmp/build/perf/util/string.o
        util/string.c: In function 'perf_atoll':
        util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
            if (*p)
               ^
        util/string.c:24:3: note: here
           case '\0':
           ^~~~
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-0ophb30v9apkk6o95el0rqlq@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      94bdd5ed
    • A
      perf tools: Fix include of linux/mman.h · 2f7db555
      Arnaldo Carvalho de Melo 提交于
      It was using uapi/linux/mmap.h which caused for at least one reporter,
      that hasn't specified in what environment the problem manifests itself:
      
       ----
      The original error is:
      
      In file included from util/event.c:2:0:
      ...tools/include/uapi/linux/mman.h:4:27: fatal error: uapi/asm/mman.h:
      No such file or directory
       #include <uapi/asm/mman.h>
                                 ^
      compilation terminated.
       ----
      
      Test built it on these containers:
      
        # dm
         1 alpine:3.4: Ok
         2 android-ndk:r12b-arm: Ok
         3 archlinux:latest: Ok
         4 centos:5: Ok
         5 centos:6: Ok
         6 centos:7: Ok
         7 debian:7: Ok
         8 debian:8: Ok
         9 debian:experimental: Ok
        10 debian:experimental-x-arm64: Ok
        11 debian:experimental-x-mips: Ok
        12 debian:experimental-x-mips64: Ok
        13 debian:experimental-x-mipsel: Ok
        14 fedora:20: Ok
        15 fedora:21: Ok
        16 fedora:22: Ok
        17 fedora:23: Ok
        18 fedora:24: Ok
        19 fedora:24-x-ARC-uClibc: Ok
        20 fedora:25: Ok
        21 fedora:rawhide: Ok
        22 mageia:5: Ok
        23 opensuse:13.2: Ok
        24 opensuse:42.1: Ok
        25 opensuse:tumbleweed: Ok
        26 ubuntu:12.04.5: Ok
        27 ubuntu:14.04.4-x-linaro-arm64: Ok
        28 ubuntu:15.10: Ok
        29 ubuntu:16.04: Ok
        30 ubuntu:16.04-x-arm: Ok
        31 ubuntu:16.04-x-arm64: Ok
        32 ubuntu:16.04-x-powerpc: Ok
        33 ubuntu:16.04-x-powerpc64: Ok
        34 ubuntu:16.04-x-powerpc64el: Ok
        35 ubuntu:16.04-x-s390: Ok
        36 ubuntu:16.10: Ok
      Reported-by: NDavid Carrillo-Cisneros <davidcc@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Michal Marek <mmarek@suse.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: fbef103f ("perf tools: Do hugetlb handling in more systems")
      Link: http://lkml.kernel.org/n/tip-4wm5xmjz5wgbq7ucyz4dyd72@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2f7db555
  2. 08 2月, 2017 10 次提交
  3. 02 2月, 2017 2 次提交
  4. 01 2月, 2017 3 次提交
  5. 27 1月, 2017 2 次提交
    • A
      perf tools: Propagate perf_config() errors · ecc4c561
      Arnaldo Carvalho de Melo 提交于
      Previously these were being ignored, sometimes silently.
      
      Stop doing that, emitting debug messages and handling the errors.
      
      Testing it:
      
        $ cat ~/.perfconfig
        cat: /home/acme/.perfconfig: No such file or directory
        $ perf stat -e cycles usleep 1
      
         Performance counter stats for 'usleep 1':
      
                 938,996      cycles:u
      
             0.003813731 seconds time elapsed
      
        $ perf top --stdio
        Error:
        You may not have permission to collect system-wide stats.
      
        Consider tweaking /proc/sys/kernel/perf_event_paranoid,
        <SNIP>
        [ perf record: Captured and wrote 0.019 MB perf.data (7 samples) ]
        [acme@jouet linux]$ perf report --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        # Overhead  Command  Shared Object      Symbol
        # ........  .......  .................  .........................
          71.77%  usleep   libc-2.24.so       [.] _dl_addr
          27.07%  usleep   ld-2.24.so         [.] _dl_next_ld_env_entry
           1.13%  usleep   [kernel.kallsyms]  [k] page_fault
        $
        $ touch ~/.perfconfig
        $ ls -la ~/.perfconfig
        -rw-rw-r--. 1 acme acme 0 Jan 27 12:14 /home/acme/.perfconfig
        $
        $ perf stat -e instructions usleep 1
      
         Performance counter stats for 'usleep 1':
      
                 244,610      instructions:u
      
             0.000805383 seconds time elapsed
      
        $
        [root@jouet ~]# chown acme.acme ~/.perfconfig
        [root@jouet ~]# perf stat -e cycles usleep 1
          Warning: File /root/.perfconfig not owned by current user or root, ignoring it.
      
         Performance counter stats for 'usleep 1':
      
                 937,615      cycles
      
             0.000836931 seconds time elapsed
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-j2rq96so6xdqlr8p8rd6a3jx@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ecc4c561
    • A
      perf config: Do not consider an error not to have any perfconfig file · afc45cf5
      Arnaldo Carvalho de Melo 提交于
      While propagating the errors from perf_config(), which were being
      completely ignored, everything stopped working for people without a
      ~/.perfconfig file, because the perf_config_set__init() was considering
      an error not to have a .perfconfig file, duh, fix it by checking the
      errno after the failed stat() call.
      
      It should also not return an error when it says it is ignoring the file,
      and also a empty file should not return an error either.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 8beeb00f ("perf config: Use new perf_config_set__init() to initialize config set")
      Link: http://lkml.kernel.org/n/tip-ygpbab3apbs6l8wr97xedwks@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      afc45cf5
  6. 26 1月, 2017 5 次提交
  7. 18 1月, 2017 1 次提交
  8. 17 1月, 2017 6 次提交
    • S
      perf evlist: Fix typo in deliver_sample() · d94386f2
      Soramichi AKIYAMA 提交于
      This patch fixes a typo: s/delievery/delivery/
      Signed-off-by: NSoramichi Akiyama <akiyama@m.soramichi.jp>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20170117222233.dfd92de0ad701e7c53396950@m.soramichi.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d94386f2
    • S
      perf tools: Move two variables usied in libperf from perf.c · d25ed5d9
      Soramichi AKIYAMA 提交于
      The use_browser and perf_version_string variables are both declared in
      perf.c but they are also referenced by other functions of libperf.a.
      
      Therefore a user linking an own main() with libperf.a must declare those
      two variables in their files even if the files never use the browser or
      the version information.
      
      This patch fixes this issue by moving use_browser and
      perf_version_string out of perf.c to some other files.
      Signed-off-by: NSoramichi Akiyama <akiyama@m.soramichi.jp>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20170117002237.c1aec0ce3b4d675dca018deb@m.soramichi.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d25ed5d9
    • M
      perf probe: Fix to probe on gcc generated functions in modules · 613f050d
      Masami Hiramatsu 提交于
      Fix to probe on gcc generated functions on modules. Since
      probing on a module is based on its symbol name, it should
      be adjusted on actual symbols.
      
      E.g. without this fix, perf probe shows probe definition
      on non-exist symbol as below.
      
        $ perf probe -m build-x86_64/net/netfilter/nf_nat.ko -F in_range*
        in_range.isra.12
        $ perf probe -m build-x86_64/net/netfilter/nf_nat.ko -D in_range
        p:probe/in_range nf_nat:in_range+0
      
      With this fix, perf probe correctly shows a probe on
      gcc-generated symbol.
      
        $ perf probe -m build-x86_64/net/netfilter/nf_nat.ko -D in_range
        p:probe/in_range nf_nat:in_range.isra.12+0
      
      This also fixes same problem on online module as below.
      
        $ perf probe -m i915 -D assert_plane
        p:probe/assert_plane i915:assert_plane.constprop.134+0
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/148411450673.9978.14905987549651656075.stgit@devboxSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      613f050d
    • M
      perf probe: Add error checks to offline probe post-processing · 3e96dac7
      Masami Hiramatsu 提交于
      Add error check codes on post processing and improve it for offline
      probe events as:
      
       - post processing fails if no matched symbol found in map(-ENOENT)
         or strdup() failed(-ENOMEM).
      
       - Even if the symbol name is the same, it updates symbol address
         and offset.
      Signed-off-by: NMasami Hiramatsu <mhiramat@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/148411443738.9978.4617979132625405545.stgit@devboxSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3e96dac7
    • M
      perf probe: Fix to show correct locations for events on modules · d2d4edbe
      Masami Hiramatsu 提交于
      Fix to show correct locations for events on modules by relocating given
      address instead of retrying after failure.
      
      This happens when the module text size is big enough, bigger than
      sh_addr, because the original code retries with given address + sh_addr
      if it failed to find CU DIE at the given address.
      
      Any address smaller than sh_addr always fails and it retries with the
      correct address, but addresses bigger than sh_addr will get a CU DIE
      which is on the given address (not adjusted by sh_addr).
      
      In my environment(x86-64), the sh_addr of ".text" section is 0x10030.
      Since i915 is a huge kernel module, we can see this issue as below.
      
        $ grep "[Tt] .*\[i915\]" /proc/kallsyms | sort | head -n1
        ffffffffc0270000 t i915_switcheroo_can_switch	[i915]
      
      ffffffffc0270000 + 0x10030 = ffffffffc0280030, so we'll check
      symbols cross this boundary.
      
        $ grep "[Tt] .*\[i915\]" /proc/kallsyms | grep -B1 ^ffffffffc028\
        | head -n 2
        ffffffffc027ff80 t haswell_init_clock_gating	[i915]
        ffffffffc0280110 t valleyview_init_clock_gating	[i915]
      
      So setup probes on both function and see what happen.
      
        $ sudo ./perf probe -m i915 -a haswell_init_clock_gating \
              -a valleyview_init_clock_gating
        Added new events:
          probe:haswell_init_clock_gating (on haswell_init_clock_gating in i915)
          probe:valleyview_init_clock_gating (on valleyview_init_clock_gating in i915)
      
        You can now use it in all perf tools, such as:
      
        	perf record -e probe:valleyview_init_clock_gating -aR sleep 1
      
        $ sudo ./perf probe -l
          probe:haswell_init_clock_gating (on haswell_init_clock_gating@gpu/drm/i915/intel_pm.c in i915)
          probe:valleyview_init_clock_gating (on i915_vga_set_decode:4@gpu/drm/i915/i915_drv.c in i915)
      
      As you can see, haswell_init_clock_gating is correctly shown,
      but valleyview_init_clock_gating is not.
      
      With this patch, both events are shown correctly.
      
        $ sudo ./perf probe -l
          probe:haswell_init_clock_gating (on haswell_init_clock_gating@gpu/drm/i915/intel_pm.c in i915)
          probe:valleyview_init_clock_gating (on valleyview_init_clock_gating@gpu/drm/i915/intel_pm.c in i915)
      
      Committer notes:
      
      In my case:
      
        # perf probe -m i915 -a haswell_init_clock_gating -a valleyview_init_clock_gating
        Added new events:
          probe:haswell_init_clock_gating (on haswell_init_clock_gating in i915)
          probe:valleyview_init_clock_gating (on valleyview_init_clock_gating in i915)
      
        You can now use it in all perf tools, such as:
      
      	  perf record -e probe:valleyview_init_clock_gating -aR sleep 1
      
        # perf probe -l
          probe:haswell_init_clock_gating (on i915_getparam+432@gpu/drm/i915/i915_drv.c in i915)
          probe:valleyview_init_clock_gating (on __i915_printk+240@gpu/drm/i915/i915_drv.c in i915)
        #
      
        # readelf -SW /lib/modules/4.9.0+/build/vmlinux | egrep -w '.text|Name'
         [Nr] Name   Type      Address          Off    Size   ES Flg Lk Inf Al
         [ 1] .text  PROGBITS  ffffffff81000000 200000 822fd3 00  AX  0   0 4096
        #
      
        So both are b0rked, now with the fix:
      
        # perf probe -m i915 -a haswell_init_clock_gating -a valleyview_init_clock_gating
        Added new events:
          probe:haswell_init_clock_gating (on haswell_init_clock_gating in i915)
          probe:valleyview_init_clock_gating (on valleyview_init_clock_gating in i915)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe:valleyview_init_clock_gating -aR sleep 1
      
        # perf probe -l
          probe:haswell_init_clock_gating (on haswell_init_clock_gating@gpu/drm/i915/intel_pm.c in i915)
          probe:valleyview_init_clock_gating (on valleyview_init_clock_gating@gpu/drm/i915/intel_pm.c in i915)
        #
      
      Both looks correct.
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/148411436777.9978.1440275861947194930.stgit@devboxSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d2d4edbe
    • A
      perf pmu: Factor out scale conversion code · d02fc6bc
      Andi Kleen 提交于
      Move the scale factor parsing code to an own function to reuse it in an
      upcoming patch.
      
      v2: Return error in case strdup returns NULL.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170103150833.6694-2-andi@firstfloor.org
      [ Keep returning -ENOMEM when strdup() fails in perf_pmu__parse_scale()/convert_scale() ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d02fc6bc
  9. 12 1月, 2017 4 次提交
  10. 04 1月, 2017 3 次提交