Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275524

[tip:perf/core] perf bpf: Allow attaching BPF programs to modules symbols

From tip-bot for Wang Nan <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:perf/core] perf bpf: Allow attaching BPF programs to modules symbols
Date 2015-11-23 17:10 +0100
Message-ID <qy1QL-48K-51@gated-at.bofh.it> (permalink)
References <qvron-7n2-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  5dbd16c0c9d17ab1ab2226a5926482c26c0287ed
Gitweb:     http://git.kernel.org/tip/5dbd16c0c9d17ab1ab2226a5926482c26c0287ed
Author:     Wang Nan <wangnan0@huawei.com>
AuthorDate: Mon, 16 Nov 2015 12:10:06 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 18 Nov 2015 17:51:03 -0300

perf bpf: Allow attaching BPF programs to modules symbols

By extending the syntax of BPF object section names, this patch allows
users to attach BPF programs to symbols in modules. For example:

  SEC("module=i915;"
      "parse_cmds=i915_parse_cmds")
  int parse_cmds(void *ctx)
  {
      return 1;
  }

The implementation is very simple: like what 'perf probe' does, for module,
fill 'uprobe' field in 'struct perf_probe_event'. Other parts will be done
automatically.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Ahern <dsahern@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kaixu Xia <xiakaixu@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1447675815-166222-5-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/bpf-loader.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 84169d6..d0f02ed 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -119,6 +119,16 @@ config__exec(const char *value, struct perf_probe_event *pev)
 	return 0;
 }
 
+static int
+config__module(const char *value, struct perf_probe_event *pev)
+{
+	pev->uprobes = false;
+	pev->target = strdup(value);
+	if (!pev->target)
+		return -ENOMEM;
+	return 0;
+}
+
 static struct {
 	const char *key;
 	const char *usage;
@@ -131,6 +141,12 @@ static struct {
 		.desc	= "Set uprobe target",
 		.func	= config__exec,
 	},
+	{
+		.key	= "module",
+		.usage	= "module=<module name>    ",
+		.desc	= "Set kprobe module",
+		.func	= config__module,
+	}
 };
 
 static int
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/13] perf tools: bpf: Improve BPF program ability Wang Nan <wangnan0@huawei.com> - 2015-11-16 13:50 +0100
  [PATCH 03/13] perf tools: Allow BPF program attach to uprobe events Wang Nan <wangnan0@huawei.com> - 2015-11-16 13:50 +0100
    Re: [PATCH 03/13] perf tools: Allow BPF program attach to uprobe  events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-16 15:20 +0100
    [tip:perf/core] perf bpf:   Allow BPF program attach to uprobe events tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:10 +0100
  [PATCH 10/13] perf tools: Add prologue for BPF programs for fetching arguments Wang Nan <wangnan0@huawei.com> - 2015-11-16 13:50 +0100
    [tip:perf/core] perf bpf:   Add prologue for BPF programs for fetching arguments tip-bot for He Kuang <tipbot@zytor.com> - 2015-11-23 17:10 +0100
  [PATCH 04/13] perf tools: Allow BPF program attach to modules Wang Nan <wangnan0@huawei.com> - 2015-11-16 13:50 +0100
    [tip:perf/core] perf bpf:   Allow attaching BPF programs to modules symbols tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:10 +0100
  [PATCH 07/13] bpf tools: Load a program with different instances using preprocessor Wang Nan <wangnan0@huawei.com> - 2015-11-16 13:50 +0100
    Re: [PATCH 07/13] bpf tools: Load a program with different instances  using preprocessor Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-16 20:10 +0100
      Re: [PATCH 07/13] bpf tools: Load a program with different instances  using preprocessor "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-17 05:00 +0100
    [tip:perf/core] bpf tools:   Load a program with different instances using preprocessor tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:10 +0100
  [PATCH 13/13] perf tools: Use same BPF program if arguments are identical Wang Nan <wangnan0@huawei.com> - 2015-11-16 14:00 +0100
    Re: [PATCH 13/13] perf tools: Use same BPF program if arguments are  identical "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-17 04:10 +0100
      Re: [PATCH 13/13] perf tools: Use same BPF program if arguments are  identical Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-17 14:20 +0100
  [PATCH 12/13] perf test: Test BPF prologue Wang Nan <wangnan0@huawei.com> - 2015-11-16 14:00 +0100
    Re: [PATCH 12/13] perf test: Test BPF prologue Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-17 02:30 +0100
      Re: [PATCH 12/13] perf test: Test BPF prologue "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-17 02:40 +0100
      Re: [PATCH 12/13] perf test: Test BPF prologue "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-17 05:40 +0100
        Re: [PATCH 12/13] perf test: Test BPF prologue Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-17 13:30 +0100
      [PATCH 0/5] perf tools: Improve BPF support Wang Nan <wangnan0@huawei.com> - 2015-11-17 09:40 +0100
        [PATCH 5/5] perf test: Mute test cases if verbose == 0 Wang Nan <wangnan0@huawei.com> - 2015-11-17 09:40 +0100
          Re: [PATCH 5/5] perf test: Mute test cases if verbose == 0 Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-17 14:20 +0100
          [tip:perf/core] perf test:   Mute test cases error messages if verbose == 0 tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:20 +0100
        [PATCH 2/5] perf tools: Use same BPF program if arguments are identical Wang Nan <wangnan0@huawei.com> - 2015-11-17 09:40 +0100
          [tip:perf/core] perf bpf:   Use same BPF program if arguments are identical tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:10 +0100
        [PATCH 4/5] perf test: Print result for each subtest for BPF Wang Nan <wangnan0@huawei.com> - 2015-11-17 09:40 +0100
          [tip:perf/core] perf test: Print result for each BPF subtest tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:20 +0100
        [PATCH 1/5] perf test: Fix 2 bugs in 'perf test BPF' Wang Nan <wangnan0@huawei.com> - 2015-11-17 09:40 +0100
          Re: [PATCH 1/5] perf test: Fix 2 bugs in 'perf test BPF' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-17 14:00 +0100
            Re: [PATCH 1/5] perf test: Fix 2 bugs in 'perf test BPF' pi3orama <pi3orama@163.com> - 2015-11-17 14:10 +0100
              Re: [PATCH 1/5] perf test: Fix 2 bugs in 'perf test BPF' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-17 14:40 +0100
          [tip:perf/core] perf test: Fix 'perf test BPF'   when it fails to find a suitable vmlinux tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:10 +0100
        [PATCH 3/5] perf test: Print result for each subtest for llvm Wang Nan <wangnan0@huawei.com> - 2015-11-17 09:40 +0100
          Re: [PATCH 3/5] perf test: Print result for each subtest for llvm Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-17 14:10 +0100
          [tip:perf/core] perf test: Print result for each LLVM subtest tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:20 +0100
      Re: [PATCH 12/13] perf test: Test BPF prologue "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-17 09:50 +0100
      [PATCH] perf record: Support custom vmlinux path Wang Nan <wangnan0@huawei.com> - 2015-11-17 11:00 +0100
        Re: [PATCH] perf record: Support custom vmlinux path Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-17 13:40 +0100
          Re: [PATCH] perf record: Support custom vmlinux path Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-17 13:50 +0100
            Re: [PATCH] perf record: Support custom vmlinux path pi3orama <pi3orama@163.com> - 2015-11-17 13:50 +0100
            [PATCH 0/2] perf tools: Builtin options related improvements Wang Nan <wangnan0@huawei.com> - 2015-11-19 15:10 +0100
              [PATCH 2/2] perf record: Support custom vmlinux path Wang Nan <wangnan0@huawei.com> - 2015-11-19 15:10 +0100
              [PATCH 1/2] perf tools: Always give options even it not compiled Wang Nan <wangnan0@huawei.com> - 2015-11-19 15:10 +0100
                RE: [PATCH 1/2] perf tools: Always give options even it not compiled 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-11-20 12:00 +0100
                Re: [PATCH 1/2] perf tools: Always give options even it not compiled "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-26 09:10 +0100
                Re: [PATCH 1/2] perf tools: Always give options even it not compiled "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-26 10:10 +0100
    [tip:perf/core] perf test:   Test the BPF prologue adding infrastructure tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:10 +0100
  [PATCH 06/13] perf tools: Allow BPF program config probing options Wang Nan <wangnan0@huawei.com> - 2015-11-16 14:00 +0100
    [tip:perf/core] perf bpf:   Allow BPF program config probing options tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:10 +0100
  [PATCH 08/13] perf tools: Add BPF_PROLOGUE config options for further patches Wang Nan <wangnan0@huawei.com> - 2015-11-16 14:00 +0100
    [tip:perf/core] perf bpf:   Add BPF_PROLOGUE config options for further patches tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:10 +0100
  [PATCH 11/13] perf tools: Generate prologue for BPF programs Wang Nan <wangnan0@huawei.com> - 2015-11-16 14:00 +0100
    [tip:perf/core] perf bpf: Generate prologue for BPF programs tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-23 17:10 +0100
  [PATCH 02/13] perf probe: Clear probe_trace_event when add_probe_trace_event() fails Wang Nan <wangnan0@huawei.com> - 2015-11-16 14:00 +0100
  Re: [PATCH 00/13] perf tools: bpf: Improve BPF program ability Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-16 15:20 +0100

csiph-web