Re: [RFC PATCH v6 32/32] perf record: Add LLVM options for compiling BPF scripts

2015-06-09 Thread Alexei Starovoitov

On 6/9/15 5:17 PM, Wangnan (F) wrote:

Could you please give me some URL to LLVM git repositories so I can
track your work on it?


traffic on llvm/clang is very heavy. probably as much as lkml.
you can subscribe to llvmweekly instead.
In the future I'll cc you on new things in that area.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v6 32/32] perf record: Add LLVM options for compiling BPF scripts

2015-06-09 Thread Wangnan (F)



On 2015/6/10 8:02, Alexei Starovoitov wrote:

On 6/8/15 10:50 PM, Wang Nan wrote:

Although previous patch allows setting BPF compiler related options in
perfconfig, on some ad-hoc situation it still requires passing options
through cmdline. This patch introduces 4 options to 'perf record' for
this propose: --clang-path, --clang-opt, --llc-path and --llc-opt.


looks good. I hope only --clang will be used from time to time.


Right. Please see another mail I posted. I'd like to generate command using
command template instead of printf() in next version.


Today, indeed, --llc* are needed too.



With template, --llc can be removed now.


btw, our experimental libbpfprog.so (which is clang and llvm libs
compiled into single .so with C api for compiling .c into bpf):
$ ls -lh libbpfprog.so
-rw-r--r-- 1 ast ast 31M Jun  9 16:49 libbpfprog.so

not tiny, but I think we should be able to include it into perf,
then perf will only have build dependencies on llvm instead of
run-time dependencies.
We'll release this lib as soon as it's a bit more stable.



Could you please give me some URL to LLVM git repositories so I can
track your work on it?

Thank you.

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


Re: [RFC PATCH v6 32/32] perf record: Add LLVM options for compiling BPF scripts

2015-06-09 Thread Alexei Starovoitov

On 6/8/15 10:50 PM, Wang Nan wrote:

Although previous patch allows setting BPF compiler related options in
perfconfig, on some ad-hoc situation it still requires passing options
through cmdline. This patch introduces 4 options to 'perf record' for
this propose: --clang-path, --clang-opt, --llc-path and --llc-opt.


looks good. I hope only --clang will be used from time to time.
Today, indeed, --llc* are needed too.

btw, our experimental libbpfprog.so (which is clang and llvm libs
compiled into single .so with C api for compiling .c into bpf):
$ ls -lh libbpfprog.so
-rw-r--r-- 1 ast ast 31M Jun  9 16:49 libbpfprog.so

not tiny, but I think we should be able to include it into perf,
then perf will only have build dependencies on llvm instead of
run-time dependencies.
We'll release this lib as soon as it's a bit more stable.

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


Re: [RFC PATCH v6 32/32] perf record: Add LLVM options for compiling BPF scripts

2015-06-09 Thread Wangnan (F)



On 2015/6/9 13:50, Wang Nan wrote:

Although previous patch allows setting BPF compiler related options in
perfconfig, on some ad-hoc situation it still requires passing options
through cmdline. This patch introduces 4 options to 'perf record' for
this propose: --clang-path, --clang-opt, --llc-path and --llc-opt.

Signed-off-by: Wang Nan 
---
  tools/perf/builtin-record.c | 8 
  1 file changed, 8 insertions(+)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 235c3d9..ad5892e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1070,6 +1070,14 @@ struct option __record_options[] = {
parse_clockid),
OPT_STRING_OPTARG('S', "snapshot", &record.opts.auxtrace_snapshot_opts,
  "opts", "AUX area tracing Snapshot Mode", ""),
+   OPT_STRING(0, "clang-path", &bpf_param.clang_path, "clang patch",
+   "clang binary to use for compiling BPF scriptlets"),
+   OPT_STRING(0, "clang-opt", &bpf_param.clang_opt, "clang options",
+   "options passed to clang when compiling BPF scriptlets"),
+   OPT_STRING(0, "llc-path", &bpf_param.llc_path, "llc path",
+   "llc binary to use for compiling BPF scriptlets"),
+   OPT_STRING(0, "llc-opt", &bpf_param.llc_opt, "llc opt",
+   "options passed to llc when compiling BPF scriptlets"),
OPT_END()
  };
  
These 4 options should be wrapped inside "#ifdef HAVE_LIBBPF_SUPPORT" 
because

it requires bpf_param which won't be compiled if HAVE_LIBBPF_SUPPORT is set.

Another choice should be introducing something like 
tools/perf/utils/llvm.c and
putting all llvm related things into it. If other part of perf also use 
llvm,

making a new file to hold those options should be a better way.


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


[RFC PATCH v6 32/32] perf record: Add LLVM options for compiling BPF scripts

2015-06-08 Thread Wang Nan
Although previous patch allows setting BPF compiler related options in
perfconfig, on some ad-hoc situation it still requires passing options
through cmdline. This patch introduces 4 options to 'perf record' for
this propose: --clang-path, --clang-opt, --llc-path and --llc-opt.

Signed-off-by: Wang Nan 
---
 tools/perf/builtin-record.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 235c3d9..ad5892e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1070,6 +1070,14 @@ struct option __record_options[] = {
parse_clockid),
OPT_STRING_OPTARG('S', "snapshot", &record.opts.auxtrace_snapshot_opts,
  "opts", "AUX area tracing Snapshot Mode", ""),
+   OPT_STRING(0, "clang-path", &bpf_param.clang_path, "clang patch",
+   "clang binary to use for compiling BPF scriptlets"),
+   OPT_STRING(0, "clang-opt", &bpf_param.clang_opt, "clang options",
+   "options passed to clang when compiling BPF scriptlets"),
+   OPT_STRING(0, "llc-path", &bpf_param.llc_path, "llc path",
+   "llc binary to use for compiling BPF scriptlets"),
+   OPT_STRING(0, "llc-opt", &bpf_param.llc_opt, "llc opt",
+   "options passed to llc when compiling BPF scriptlets"),
OPT_END()
 };
 
-- 
1.8.3.4

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