diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2021-06-04 18:28:43 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-06-18 18:50:05 +0200 |
commit | 45237f9898fce54a8cc6d40f7455291e0e6c4277 (patch) | |
tree | 9ac52e5d202e74e177450d3e448a582cc3dbeb7a /tools/perf/builtin-probe.c | |
parent | perf probe: Cleanup synthesize_probe_trace_command() (diff) | |
download | linux-45237f9898fce54a8cc6d40f7455291e0e6c4277.tar.xz linux-45237f9898fce54a8cc6d40f7455291e0e6c4277.zip |
perf probe: Add --bootconfig to output definition in bootconfig format
Now the boot-time tracing supports kprobes events and that must be
written in bootconfig file in the following format.
ftrace.event.kprobes.<EVENT_NAME>.probes = <PROBE-DEF>
'perf probe' already supports --definition (-D) action to show probe
definitions, but the format is for tracefs:
[p|r][:EVENT_NAME] <PROBE-DEF>
This patch adds the --bootconfig option for -D action so that it outputs
the probe definitions in bootconfig format. E.g.
$ perf probe --bootconfig -D "path_lookupat:7 err:s32 s:string"
ftrace.event.kprobes.path_lookupat_L7.probe = 'path_lookupat.isra.0+309 err_s32=%ax:s32 s_string=+0(%r13):string'
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/162282412351.452340.14871995440005640114.stgit@devnote2
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r-- | tools/perf/builtin-probe.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 6b1507566770..2bfd41df621c 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -347,7 +347,10 @@ static int perf_add_probe_events(struct perf_probe_event *pevs, int npevs) goto out_cleanup; if (params.command == 'D') { /* it shows definition */ - ret = show_probe_trace_events(pevs, npevs); + if (probe_conf.bootconfig) + ret = show_bootconfig_events(pevs, npevs); + else + ret = show_probe_trace_events(pevs, npevs); goto out_cleanup; } @@ -581,6 +584,8 @@ __cmd_probe(int argc, const char **argv) "Look for files with symbols relative to this directory"), OPT_CALLBACK(0, "target-ns", NULL, "pid", "target pid for namespace contexts", opt_set_target_ns), + OPT_BOOLEAN(0, "bootconfig", &probe_conf.bootconfig, + "Output probe definition with bootconfig format"), OPT_END() }; int ret; @@ -692,6 +697,11 @@ __cmd_probe(int argc, const char **argv) } break; case 'D': + if (probe_conf.bootconfig && params.uprobes) { + pr_err(" Error: --bootconfig doesn't support uprobes.\n"); + return -EINVAL; + } + __fallthrough; case 'a': /* Ensure the last given target is used */ |