[PATCH 2/2] perf record: Support custom vmlinux path

From: Wang Nan
Date: Thu Nov 19 2015 - 09:04:13 EST

From: He Kuang <hekuang@xxxxxxxxxx>

Make perf-record command support --vmlinux option if BPF_PROLOGUE is on.

'perf record' needs vmlinux as the source of DWARF info to generate
prologue for BPF programs, so path of vmlinux should be specified.

Short name 'k' has been taken by 'clockid'. This patch skips the short
option name and use '--vmlinux' for vmlinux path.

Documentation is also updated.

Signed-off-by: He Kuang <hekuang@xxxxxxxxxx>
Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Cc: Alexei Starovoitov <ast@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
tools/perf/Documentation/perf-record.txt | 10 ++++++++--
tools/perf/builtin-record.c | 11 +++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index e630a7d..8d032f4 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -314,11 +314,17 @@ This option sets the time out limit. The default value is 500 ms.
Record context switch events i.e. events of type PERF_RECORD_SWITCH or

Path to clang binary to use for compiling BPF scriptlets.
+(enabled when BPF support is on)

Options passed to clang when compiling BPF scriptlets.
+(enabled when BPF support is on)
+Specify vmlinux path which has debuginfo.
+(enabled when BPF prologue is on)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index b02d1ee..b046fc3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1118,6 +1118,14 @@ struct option __record_options[] = {
"clang binary to use for compiling BPF scriptlets"),
OPT_STRING(0, "clang-opt", &llvm_param.clang_opt, "clang options",
"options passed to clang when compiling BPF scriptlets"),
+ OPT_STRING(0, "vmlinux", &symbol_conf.vmlinux_name,
+ "file", "vmlinux pathname"),
+ OPT_NOTBUILT(0, "vmlinux", "file",
+ "vmlinux pathname",
+ "BPF prologue not built-in", true),
OPT_NOTBUILT(0, "clang-path", "clang path",
"clang binary to use for compiling BPF scriptlets",
@@ -1125,6 +1133,9 @@ struct option __record_options[] = {
OPT_NOTBUILT(0, "clang-opt", "clang options",
"options passed to clang when compiling BPF scriptlets",
"disabled by NO_LIBBPF", true),
+ OPT_NOTBUILT(0, "vmlinux", "file",
+ "vmlinux pathname",
+ "disabled by NO_LIBBPF", true),

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/