1. 21 3月, 2018 6 次提交
  2. 20 3月, 2018 5 次提交
    • A
      perf tests bp_account: Fix build with clang-6 · 1cd61883
      Arnaldo Carvalho de Melo 提交于
      To shut up this compiler warning:
      
          CC       /tmp/build/perf/tests/bp_account.o
          CC       /tmp/build/perf/tests/task-exit.o
          CC       /tmp/build/perf/tests/sw-clock.o
        tests/bp_account.c:106:20: error: pointer type mismatch ('int (*)(void)' and 'void *') [-Werror,-Wpointer-type-mismatch]
                void *addr = is_x ? test_function : (void *) &the_var;
                                  ^ ~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~
        1 error generated.
      
      Noticed with clang 6 on fedora rawhide.
      
        [perfbuilder@44490f0e7241 perf]$ clang -v
        clang version 6.0.0 (tags/RELEASE_600/final)
        Target: x86_64-unknown-linux-gnu
        Thread model: posix
        InstalledDir: /usr/bin
        Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/8
        Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/8
        Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/8
        Candidate multilib: .;@m64
        Candidate multilib: 32;@m32
        Selected multilib: .;@m64
        [perfbuilder@44490f0e7241 perf]$
      
      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>
      Fixes: 032db28e ("perf tests: Add breakpoint accounting/modify test")
      Link: https://lkml.kernel.org/n/tip-a3jnkzh4xam0l954de5tn66d@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1cd61883
    • M
      perf probe: Use right type to access array elements · d0461794
      Masami Hiramatsu 提交于
      Current 'perf probe' converts the type of array-elements incorrectly. It
      always converts the types as a pointer of array. This passes the "array"
      type DIE to the type converter so that it can get correct "element of
      array" type DIE from it.
      
      E.g.
        ====
        $ cat hello.c
        #include <stdio.h>
      
        void foo(int a[])
        {
      	  printf("%d\n", a[1]);
        }
      
        void main()
        {
      	  int a[3] = {4, 5, 6};
      	  printf("%d\n", a[0]);
      	  foo(a);
        }
      
        $ gcc -g hello.c -o hello
        $ perf probe -x ./hello -D "foo a[1]"
        ====
      
      Without this fix, above outputs
        ====
        p:probe_hello/foo /tmp/hello:0x4d3 a=+4(-8(%bp)):u64
        ====
      The "u64" means "int *", but a[1] is "int".
      
      With this,
        ====
        p:probe_hello/foo /tmp/hello:0x4d3 a=+4(-8(%bp)):s32
        ====
      So, "int" correctly converted to "s32"
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
      Cc: linux-kselftest@vger.kernel.org
      Cc: linux-trace-users@vger.kernel.org
      Fixes: b2a3c12b ("perf probe: Support tracing an entry of array")
      Link: http://lkml.kernel.org/r/152129114502.31874.2474068470011496356.stgit@devboxSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d0461794
    • A
      perf annotate: Use ops->target.name when available for unresolved call targets · 4c9cb2c2
      Arnaldo Carvalho de Melo 提交于
      There is a bug where when using 'perf annotate timerqueue_add' the
      target for its only routine called with the 'callq' instruction,
      'rb_insert_color', doesn't get resolved from its address when parsing
      that 'callq' instruction.
      
      That symbol resolution works when using 'perf report --tui' and then
      doing annotation for 'timerqueue_add' from there, the vmlinux
      dso->symbols rb_tree somehow gets in a state that we can't find that
      address, that is a bug that has to be further investigated.
      
      But since the objdump output has the function name, i.e. the raw objdump
      disassembled line looks like:
      
      So, before:
      
        # perf annotate timerqueue_add
      
                    │      mov    %rbx,%rdi
                    │      mov    %rbx,(%rdx)
                    │    → callq  *ffffffff8184dc80
                    │      mov    0x8(%rbp),%rdx
                    │      test   %rdx,%rdx
                    │    ↓ je     67
      
        # perf report
      
                    │      mov    %rbx,%rdi
                    │      mov    %rbx,(%rdx)
                    │    → callq  rb_insert_color
                    │      mov    0x8(%rbp),%rdx
                    │      test   %rdx,%rdx
                    │    ↓ je     67
      
      And after both look the same:
      
        # perf annotate timerqueue_add
      
                    │      mov    %rbx,%rdi
                    │      mov    %rbx,(%rdx)
                    │    → callq  rb_insert_color
                    │      mov    0x8(%rbp),%rdx
                    │      test   %rdx,%rdx
                    │    ↓ je     67
      
      From 'perf report' one can annotate and navigate to that 'rb_insert_color'
      function, but not directly from 'perf annotate timerqueue_add', that
      remains to be investigated and fixed.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-nkktz6355rhqtq7o8atr8f8r@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4c9cb2c2
    • A
      perf top: Document --ignore-vmlinux · a8403912
      Arnaldo Carvalho de Melo 提交于
      We've had this since 2013, document it.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Willy Tarreau <w@1wt.eu>
      Fixes: fc2be696 ("perf symbols: Add new option --ignore-vmlinux for perf top")
      Link: https://lkml.kernel.org/n/tip-0jwfueooddwfsw9r603belxi@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a8403912
    • J
      perf tools: Fix python extension build for gcc 8 · b7a313d8
      Jiri Olsa 提交于
      The gcc 8 compiler won't compile the python extension code with the
      following errors (one example):
      
        python.c:830:15: error: cast between incompatible  function types from              \
        ‘PyObject * (*)(struct pyrf_evsel *, PyObject *, PyObject *)’                       \
        uct _object * (*)(struct pyrf_evsel *, struct _object *, struct _object *)’} to     \
        ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _objeuct \
        _object *)’} [-Werror=cast-function-type]
           .ml_meth  = (PyCFunction)pyrf_evsel__open,
      
      The problem with the PyMethodDef::ml_meth callback is that its type is
      determined based on the PyMethodDef::ml_flags value, which we set as
      METH_VARARGS | METH_KEYWORDS.
      
      That indicates that the callback is expecting an extra PyObject* arg, and is
      actually PyCFunctionWithKeywords type, but the base PyMethodDef::ml_meth type
      stays PyCFunction.
      
      Previous gccs did not find this, gcc8 now does. Fixing this by silencing this
      warning for python.c build.
      
      Commiter notes:
      
      Do not do that for CC=clang, as it breaks the build in some clang
      versions, like the ones in fedora up to fedora27:
      
        fedora:25:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
        fedora:26:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
        fedora:27:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
        #
      
      those have:
      
        clang version 3.9.1 (tags/RELEASE_391/final)
      
      The one in rawhide accepts that:
      
        clang version 6.0.0 (tags/RELEASE_600/final)
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Link: http://lkml.kernel.org/r/20180319082902.4518-2-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b7a313d8
  3. 19 3月, 2018 1 次提交
    • J
      perf tools: Fix snprint warnings for gcc 8 · 77f18153
      Jiri Olsa 提交于
      With gcc 8 we get new set of snprintf() warnings that breaks the
      compilation, one example:
      
        tests/mem.c: In function ‘check’:
        tests/mem.c:19:48: error: ‘%s’ directive output may be truncated writing \
              up to 99 bytes into a region of size 89 [-Werror=format-truncation=]
          snprintf(failure, sizeof failure, "unexpected %s", out);
      
      The gcc docs says:
      
       To avoid the warning either use a bigger buffer or handle the
       function's return value which indicates whether or not its output
       has been truncated.
      
      Given that all these warnings are harmless, because the code either
      properly fails due to uncomplete file path or we don't care for
      truncated output at all, I'm changing all those snprintf() calls to
      scnprintf(), which actually 'checks' for the snprint return value so the
      gcc stays silent.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Link: http://lkml.kernel.org/r/20180319082902.4518-1-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      77f18153
  4. 17 3月, 2018 28 次提交