1. 15 Feb, 2017 1 commit
  2. 14 Feb, 2017 14 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Be consistent on the type of map->symbols[] interator · a0b2f5af
      Arnaldo Carvalho de Melo authored
      In a few cases we were using 'enum map_type' and that triggered this
      warning when using clang:
      
        util/session.c:1923:16: error: comparison of constant 2 with expression of type 'enum map_type' is always true
            [-Werror,-Wtautological-constant-out-of-range-compare]
              for (i = 0; i < MAP__NR_TYPES; ++i) {
      
      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-i6uyo6bsopa2dghnx8qo7rri@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a0b2f5af
    • Arnaldo Carvalho de Melo's avatar
      perf intel pt decoder: clang has no -Wno-override-init · 35670dd0
      Arnaldo Carvalho de Melo authored
      So set it only for other compilers, allowing us to overcome yet another
      build failure due to an inexistent clang -W option:
      
        error: unknown warning option '-Wno-override-init'; did you mean '-Wno-override-module'? [-Werror,-Wunknown-warning-option]
      
      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-oaa1ici3j8nygp4pzl2oobh3@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      35670dd0
    • Arnaldo Carvalho de Melo's avatar
      perf evsel: Do not put a variable sized type not at the end of a struct · c24ae6d9
      Arnaldo Carvalho de Melo authored
      As this is a GNU extension and while harmless in this case, we can do
      the same thing in a more clearer way by using a existing thread_map and
      cpu_map constructors:
      
      With this we avoid this while compiling with clang:
      
        util/evsel.c:1659:17: error: field 'map' with variable sized type 'struct cpu_map' not at the end of a struct or class is a GNU extension
              [-Werror,-Wgnu-variable-sized-type-not-at-end]
                struct cpu_map map;
                               ^
        util/evsel.c:1667:20: error: field 'map' with variable sized type 'struct thread_map' not at the end of a struct or class is a GNU extension
              [-Werror,-Wgnu-variable-sized-type-not-at-end]
                struct thread_map map;
                                  ^
      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-207juvrqjiar7uvas2s83v5i@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c24ae6d9
    • Arnaldo Carvalho de Melo's avatar
      perf probe: Avoid accessing uninitialized 'map' variable · 8a2efd6d
      Arnaldo Carvalho de Melo authored
      Genuine problem detected with clang, the warnings are spot on:
      
        util/probe-event.c:2079:7: error: variable 'map' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
                        if (addr) {
                            ^~~~
        util/probe-event.c:2094:6: note: uninitialized use occurs here
                if (map && !is_kprobe) {
                    ^~~
        util/probe-event.c:2079:3: note: remove the 'if' if its condition is always true
                        if (addr) {
                        ^~~~~~~~~~
        util/probe-event.c:2075:8: error: variable 'map' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                                if (kernel_get_symbol_address_by_name(tp->symbol,
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        util/probe-event.c:2094:6: note: uninitialized use occurs here
                if (map && !is_kprobe) {
                    ^~~
        util/probe-event.c:2075:4: note: remove the 'if' if its condition is always false
                                if (kernel_get_symbol_address_by_name(tp->symbol,
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        util/probe-event.c:2064:17: note: initialize the variable 'map' to silence this warning
                struct map *map;
                               ^
                                = NULL
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-m3501el55i10hctfbmi2qxzr@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8a2efd6d
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Do not put a variable sized type not at the end of a struct · 89896051
      Arnaldo Carvalho de Melo authored
      As this is a GNU extension and while harmless in this case, we can do
      the same thing in a more clearer way by using an existing thread_map
      constructor.
      
      With this we avoid this while compiling with clang:
      
        util/parse-events.c:2024:21: error: field 'map' with variable sized type 'struct thread_map' not at the end of a struct or class is a GNU extension
              [-Werror,-Wgnu-variable-sized-type-not-at-end]
                        struct thread_map map;
                                        ^
        1 error generated.
      
      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-tqocbplnyyhpst6drgm2u4m3@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      89896051
    • Arnaldo Carvalho de Melo's avatar
      perf record: Do not put a variable sized type not at the end of a struct · 9d6aae72
      Arnaldo Carvalho de Melo authored
      As this is a GNU extension and while harmless in this case, we can do
      the same thing in a more clearer way by using an existing thread_map
      constructor.
      
      With this we avoid this while compiling with clang:
      
        builtin-record.c:659:21: error: field 'map' with variable sized type 'struct thread_map' not at the end of a struct or class is a GNU extension
              [-Werror,-Wgnu-variable-sized-type-not-at-end]
                        struct thread_map map;
                                          ^
        1 error generated.
      
      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-c9drclo52ezxmwa7qxklin2y@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9d6aae72
    • Arnaldo Carvalho de Melo's avatar
      perf tests: Synthesize struct instead of using field after variable sized type · 423d856a
      Arnaldo Carvalho de Melo authored
      End result is the same, its an ABI, so the struct won't change, avoid
      using a GNU extension, so that we can catch other cases that may be bugs.
      
      Caught when building with clang:
      
        tests/parse-no-sample-id-all.c:53:20: error: field 'attr' with variable sized type 'struct attr_event' not at the end of a struct or class is a GNU extension
              [-Werror,-Wgnu-variable-sized-type-not-at-end]
                struct attr_event attr;
                                  ^
        1 error generated.
      
      Testing it:
      
        # perf test sample_id
        24: Parse with no sample_id_all bit set        : Ok
        #
      
      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-e2vs1x771fc208uvxnwcf08b@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      423d856a
    • Arnaldo Carvalho de Melo's avatar
      perf bench numa: Make sure dprintf() is not defined · 6aa4d826
      Arnaldo Carvalho de Melo authored
      When building with clang we get this error:
      
        bench/numa.c:46:9: error: 'dprintf' macro redefined [-Werror,-Wmacro-redefined]
        #define dprintf(x...) do { if (g && g->p.show_details >= 1) printf(x); } while (0)
                ^
        /usr/include/bits/stdio2.h:145:12: note: previous definition is here
        #   define dprintf(fd, ...) \
                   ^
          CC       /tmp/build/perf/tests/parse-no-sample-id-all.o
        1 error generated.
      
      So, make sure it is undefined before using that name.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Jakub Jelen <jjelen@redhat.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-f654o2svtrutamvxt7igwz74@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6aa4d826
    • Arnaldo Carvalho de Melo's avatar
      Revert "perf bench futex: Sanitize numeric parameters" · 16cab322
      Arnaldo Carvalho de Melo authored
      This reverts commit 60758d66.
      
      Now that libsubcmd makes sure that OPT_UINTEGER options will not
      return negative values, we can revert this patch while addressing
      the problem it solved:
      
        # perf bench futex hash -t  -4
        # Running 'futex/hash' benchmark:
         Error: switch `t' expects an unsigned numerical value
         Usage: perf bench futex hash <options>
      
            -t, --threads <n>     Specify amount of threads
        # perf bench futex hash -t-4
        # Running 'futex/hash' benchmark:
         Error: switch `t' expects an unsigned numerical value
         Usage: perf bench futex hash <options>
      
            -t, --threads <n>     Specify amount of threads
        #
      
      IMO it is more reasonable to flat out refuse to process a negative
      number than to silently turn it into an absolute value.
      
      This also helps in silencing clang's complaint about asking for an
      absolute value of an unsigned integer:
      
        bench/futex-hash.c:133:10: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                nsecs = futexbench_sanitize_numeric(nsecs);
                      ^
        bench/futex.h:104:42: note: expanded from macro 'futexbench_sanitize_numeric'
        #define futexbench_sanitize_numeric(__n) abs((__n))
                                                 ^
        bench/futex-hash.c:133:10: note: remove the call to 'abs' since unsigned values cannot be negative
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-2kl68v22or31vw643m2exz8x@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      16cab322
    • Arnaldo Carvalho de Melo's avatar
      tools lib subcmd: Make it an error to pass a signed value to OPTION_UINTEGER · b9889716
      Arnaldo Carvalho de Melo authored
      Options marked OPTION_UINTEGER or OPTION_U64 clearly indicates that an
      unsigned value is expected, so just error out when a negative value is
      passed, instead of returning something undesired to the tool.
      
      E.g.:
      
        # perf bench futex hash -t -4
        # Running 'futex/hash' benchmark:
         Error: switch `t' expects an unsigned numerical value
         Usage: perf bench futex hash <options>
      
            -t, --threads <n>     Specify amount of threads
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-2mdn8s2raatyhz7tamrsz22r@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b9889716
    • Arnaldo Carvalho de Melo's avatar
      tools: Set the maximum optimization level according to the compiler being used · 49b3cd30
      Arnaldo Carvalho de Melo authored
      To avoid this when using clang:
      
        warning: optimization level '-O6' is not supported; using '-O3' instead
      
      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-kaghp8ddvzdsg03putemcq96@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      49b3cd30
    • Arnaldo Carvalho de Melo's avatar
      tools: Suppress request for warning options not existent in clang · 093b75ef
      Arnaldo Carvalho de Melo authored
      To allow building with clang, avoiding:
      
        error: unknown warning option '-Wstrict-aliasing=3'; did you mean '-Wstring-plus-int'? [-Werror,-Wunknown-warning-option]
      
      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-xvthlvmhzfnt7jx73jgmaea1@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      093b75ef
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.11-20170213' of... · 277d6f1d
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.11-20170213' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      New features:
      
       - Introduce the 'delta-abs' 'perf diff' compute method, that orders the
         histogram entries by the absolute value of the percentage delta for a
         function in two perf.data files, i.e. the functions that changed the
         most (increase or decrease in samples) comes first (Namhyung Kim)
      
      User visible changes:
      
       - Improve message about tweaking the kernel.perf_event_paranoid setting,
         telling how to make the change permanent by editing /etc/sysctl.conf
         (Arnaldo Carvalho de Melo)
      
      Infrastructure changes:
      
       - Introduce linux/compiler-gcc.h as a counterpart to the kernel's,
         initially containing the definition of __fallthrough, more to
         come (__maybe_unused, etc) (Arnaldo Carvalho de Melo)
      
       - Fixes for problems uncovered by building tools/perf with clang, such
         as always true tests of arrays against NULL and variables that sometimes
         were used without being initialized (Arnaldo Carvalho de Melo, Steven Rostedt)
      
       - Before loading a new ELF, clear global variables set by the
         samples/bpf loader (Mickaël Salaün)
      
       - Ignore already processed ELF sections in the samples/bpf
         loader (Mickaël Salaün)
      
       - Fix compile error in the scripting code with some perl5
         versions (Wang YanQing)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      277d6f1d
    • Ingo Molnar's avatar
      210f400d
  3. 13 Feb, 2017 15 commits
  4. 12 Feb, 2017 1 commit
  5. 11 Feb, 2017 9 commits