All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Wang Nan <wangnan0@huawei.com>
Cc: masami.hiramatsu.pt@hitachi.com, ast@kernel.org,
	lizefan@huawei.com, pi3orama@163.com,
	linux-kernel@vger.kernel.org,
	Brendan Gregg <brendan.d.gregg@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	David Ahern <dsahern@gmail.com>, He Kuang <hekuang@huawei.com>,
	Jiri Olsa <jolsa@kernel.org>, Kaixu Xia <xiakaixu@huawei.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 04/12] perf tools: Allow BPF program attach to modules
Date: Fri, 13 Nov 2015 12:40:14 -0300	[thread overview]
Message-ID: <20151113154014.GK7160@kernel.org> (raw)
In-Reply-To: <1447417761-156094-5-git-send-email-wangnan0@huawei.com>

Em Fri, Nov 13, 2015 at 12:29:13PM +0000, Wang Nan escreveu:
> By extending the syntax of BPF object section names, this patch allows
> user to attach BPF programs to symbol in modules. For example:
> 
>  SEC("module=i915\n"
>      "parse_cmds=i915_parse_cmds")
>  int parse_cmds(void *ctx)
>  {
>      return 1;
>  }
> 
> Implementation is very simple: like what 'perf probe' does, for module,
> fill 'uprobe' field in 'struct perf_probe_event'. Other parts would 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: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Link: http://lkml.kernel.org/n/1445915248-175553-1-git-send-email-wangnan0@huawei.com
> ---
>  tools/perf/util/bpf-loader.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
> index 5f5505d..8d78785 100644
> --- a/tools/perf/util/bpf-loader.c
> +++ b/tools/perf/util/bpf-loader.c
> @@ -117,6 +117,14 @@ 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);
> +	return 0;
> +}

check strdup return

> +
>  static struct {
>  	const char *key;
>  	const char *usage;
> @@ -129,6 +137,12 @@ static struct {
>  		"Set uprobe target",
>  		config__exec,
>  	},
> +	{
> +		"module",
> +		"module=<module name>    ",
> +		"Set kprobe module",
> +		config__module,
> +	}

Named initializers, please.

>  };
>  
>  static int
> -- 
> 1.8.3.4

  reply	other threads:[~2015-11-13 15:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13 12:29 [PATCH 00/12] perf tools: bpf: Improve BPF program ability Wang Nan
2015-11-13 12:29 ` [PATCH 01/12] perf probe: Fix memory leaking on faiulre by clearing all probe_trace_events Wang Nan
2015-11-18  6:19   ` [tip:perf/urgent] perf probe: Fix memory leaking on failure " tip-bot for Masami Hiramatsu
2015-11-13 12:29 ` [PATCH 02/12] perf probe: Clear probe_trace_event when add_probe_trace_event() fails Wang Nan
2015-11-13 15:50   ` Arnaldo Carvalho de Melo
2015-11-18  6:19   ` [tip:perf/urgent] " tip-bot for Wang Nan
2015-11-13 12:29 ` [PATCH 03/12] perf tools: Allow BPF program attach to uprobe events Wang Nan
2015-11-13 15:39   ` Arnaldo Carvalho de Melo
2015-11-13 12:29 ` [PATCH 04/12] perf tools: Allow BPF program attach to modules Wang Nan
2015-11-13 15:40   ` Arnaldo Carvalho de Melo [this message]
2015-11-13 12:29 ` [PATCH 05/12] perf tools: Allow BPF program config probing options Wang Nan
2015-11-13 15:46   ` Arnaldo Carvalho de Melo
2015-11-16  9:11     ` Wangnan (F)
2015-11-13 12:29 ` [PATCH 06/12] bpf tools: Load a program with different instances using preprocessor Wang Nan
2015-11-13 12:29 ` [PATCH 07/12] perf tools: Add BPF_PROLOGUE config options for further patches Wang Nan
2015-11-13 12:29 ` [PATCH 08/12] perf tools: Compile dwarf-regs.c if CONFIG_BPF_PROLOGUE is on Wang Nan
2015-11-13 12:29 ` [PATCH 09/12] perf tools: Add prologue for BPF programs for fetching arguments Wang Nan
2015-11-13 12:29 ` [PATCH 10/12] perf tools: Generate prologue for BPF programs Wang Nan
2015-11-13 12:29 ` [PATCH 11/12] perf test: Test BPF prologue Wang Nan
2015-11-13 12:29 ` [PATCH 12/12] perf tools: Use same BPF program if arguments are identical Wang Nan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151113154014.GK7160@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=ast@kernel.org \
    --cc=brendan.d.gregg@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=dsahern@gmail.com \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.com \
    --cc=xiakaixu@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.