perf probe: Warn if given uprobe event accesses memory on older kernel
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Sat, 28 Feb 2015 02:53:29 +0000 (11:53 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 2 Mar 2015 15:27:43 +0000 (12:27 -0300)
commit79702f614187f652a814061e8f5875ddcc9e732d
tree9c9b99fbbbc030daf24ab3cb4f4222ec26eb9176
parentde5349fa439dd32d432cd401eb2decfae20b9f74
perf probe: Warn if given uprobe event accesses memory on older kernel

Warn if given uprobe event accesses memory on older kernel.

Until 3.14, uprobe event only supports accessing registers so this warns
to upgrade kernel if uprobe-event returns -EINVAL and an argument of the
event accesses memory ($stack, @+offset, and +|-offs() symtax).

With this patch (on 3.10.0-123.13.2.el7.x86_64);
  -----
  # ./perf probe -x ./perf warn_uprobe_event_compat stack=-0\(%sp\)
  Added new event:
  Failed to write event: Invalid argument
  Please upgrade your kernel to at least 3.14 to have access to feature -0(%sp)
    Error: Failed to add events.
  -----

Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20150228025329.32106.70581.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/probe-event.c