Skip to content
Commit e8ca4f0f authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Arnaldo Carvalho de Melo
Browse files

perf probe: Show correct error message about @symbol usage for uprobe



Since @symbol variable access is not supported by uprobe event, it must be
correctly warn user instead of kernel version update.

Committer testing:

With/without the patch:

  [root@quaco ~]# perf probe -x ~/bin/perf -L sigtrap_handler
  <sigtrap_handler@/home/acme/git/perf-tools-next/tools/perf/tests/sigtrap.c:0>
        0  sigtrap_handler(int signum __maybe_unused, siginfo_t *info, void *ucontext __maybe_unused)
        1  {
        2         if (!__atomic_fetch_add(&ctx.signal_count, 1, __ATOMIC_RELAXED))
        3                 ctx.first_siginfo = *info;
        4         __atomic_fetch_sub(&ctx.tids_want_signal, syscall(SYS_gettid), __ATOMIC_RELAXED);
        5  }

           static void *test_thread(void *arg)
           {

  [root@quaco ~]# perf probe -x ~/bin/perf sigtrap_handler:4 "ctx.signal_count"

Without the patch:

  [root@quaco ~]# perf probe -x ~/bin/perf sigtrap_handler:4 "ctx.signal_count"
  Failed to write event: Invalid argument
  Please upgrade your kernel to at least 3.14 to have access to feature @ctx
    Error: Failed to add events.
  [root@quaco ~]#

With the patch:

  [root@quaco ~]#
  Failed to write event: Invalid argument
  @ctx accesses a variable by symbol name, but that is not supported for user application probe.
    Error: Failed to add events.
  [root@quaco ~]#

Reported-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Closes: https://lore.kernel.org/all/ZLWDEjvFjrrEJODp@kernel.org/


Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/169055397023.67089.12693645664676964310.stgit@devnote2


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent ed847e30
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment