From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Randy Dunlap <rdunlap@xenotime.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
Christoph Hellwig <hch@infradead.org>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Oleg Nesterov <oleg@redhat.com>, Mark Wielaard <mjw@redhat.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Naren A Devaiah <naren.devaiah@in.ibm.com>,
Jim Keniston <jkenisto@linux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
"Frank Ch. Eigler" <fche@redhat.com>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCHv9 2.6.35-rc4-tip 11/13] perf: perf interface for uprobes
Date: Mon, 12 Jul 2010 13:03:06 -0300 [thread overview]
Message-ID: <20100712160306.GE25238@ghostprotocols.net> (raw)
In-Reply-To: <20100712103422.27491.84056.sendpatchset@localhost6.localdomain6>
Before some more comments: this is getting really nice! Kudos!
Em Mon, Jul 12, 2010 at 04:04:22PM +0530, Srikar Dronamraju escreveu:
<SNIP>
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index 09cf546..ef7c2d5 100644
<SNIP>
> @@ -403,6 +426,115 @@ static bool check_event_name(const char *name)
> return true;
> }
>
> +/*
> + * uprobe_events only accepts address:
> + * Convert function and any offset to address
> + */
> +static int convert_name_to_addr(struct perf_probe_event *pev)
> +{
> + struct perf_probe_point *pp = &pev->point;
> + struct perf_session *session;
> + struct thread *thread;
> + struct symbol *sym;
> + struct map *map;
> + char *name;
> + int ret = -EINVAL;
> + unsigned long long vaddr;
> +
> + /* check if user has specifed a virtual address */
> + vaddr = strtoul(pp->function, NULL, 0);
> + session = perf_session__new(NULL, O_WRONLY, false, false);
At first creating a session here looks too much, lets see below...
> + if (!session) {
> + pr_warning("Cannot initialize perf session.\n");
> + return -ENOMEM;
> + }
> +
> + symbol_conf.try_vmlinux_path = false;
> + if (!vaddr)
> + symbol_conf.sort_by_name = true;
> + if (symbol__init() < 0) {
> + pr_warning("Cannot initialize symbols.\n");
> + goto free_session;
> + }
Configuring the symbol lib on a library function is a no-go, this
function (symbol__init()) should be marked with the equivalent of
"module_init()" on tools that need the symbol library, i.e. be called
from the cmd_{top,report,probe,etc} level.
> + event__synthesize_thread(pev->upid, event__process, session);
> + thread = perf_session__findnew(session, pev->upid);
> + if (!thread) {
> + pr_warning("Cannot initialize perf session.\n");
> + goto free_session;
> + }
Got it, you want to read an existing thread, get it into the
perf_session threads rb_tree to then use what was parsed from /proc.
I think you should change event__synthesize_thread somehow to achieve
taht same goal instead of going in such a roundabout way, unless you
need the session for some other need.
Probably we could change it to create a thread instance that then would
be used to synthesize the MMAP and COMM events... but then for the
existing use case we would be creating such events just to trow those
objects away right after synthesizing the PERF_RECORD_{MMAP,COMM}
events... perhaps duplicate them after all :-\
If I don't come with something for this quickly we can go on using what
you coded and later refactor it to remove the fat.
<SNIP>
> @@ -712,16 +858,17 @@ bool perf_probe_event_need_dwarf(struct perf_probe_event *pev)
> return false;
> }
>
> -/* Parse kprobe_events event into struct probe_point */
> -int parse_kprobe_trace_command(const char *cmd, struct kprobe_trace_event *tev)
> +/* Parse probe_events (uprobe_events) event into struct probe_point */
> +static int parse_probe_trace_command(const char *cmd,
> + struct probe_trace_event *tev)
> {
> - struct kprobe_trace_point *tp = &tev->point;
> + struct probe_trace_point *tp = &tev->point;
> char pr;
> char *p;
> int ret, i, argc;
> char **argv;
>
> - pr_debug("Parsing kprobe_events: %s\n", cmd);
> + pr_debug("Parsing probe_events: %s\n", cmd);
I suggest you put these s/kprobe/probe/g parts in a separate patch for
easing review :)
<SNIP>
- Arnaldo
next prev parent reply other threads:[~2010-07-12 16:03 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-12 10:32 [PATCHv9 2.6.35-rc4-tip 0/13] Uprobes Patches: Srikar Dronamraju
2010-07-12 10:32 ` [PATCHv9 2.6.35-rc4-tip 1/13] mm: Move replace_page() / write_protect_page() to mm/memory.c Srikar Dronamraju
2010-07-12 10:32 ` [PATCHv9 2.6.35-rc4-tip 2/13] uprobes: Breakpoint insertion/removal in user space applications Srikar Dronamraju
2010-07-20 4:28 ` Christoph Hellwig
2010-07-20 7:22 ` Srikar Dronamraju
2010-08-04 12:05 ` Peter Zijlstra
2010-08-04 12:48 ` Srikar Dronamraju
2010-08-04 13:02 ` Peter Zijlstra
2010-07-12 10:32 ` [PATCHv9 2.6.35-rc4-tip 3/13] uprobes: Slot allocation for Execution out of line(XOL) Srikar Dronamraju
2010-07-12 10:32 ` [PATCHv9 2.6.35-rc4-tip 4/13] uprobes: x86 specific functions for user space breakpointing Srikar Dronamraju
2010-07-12 10:33 ` [PATCHv9 2.6.35-rc4-tip 5/13] uprobes: Uprobes (un)registration and exception handling Srikar Dronamraju
2010-07-12 10:33 ` [PATCHv9 2.6.35-rc4-tip 6/13] uprobes: X86 support for Uprobes Srikar Dronamraju
2010-07-12 10:33 ` [PATCHv9 2.6.35-rc4-tip 7/13] uprobes: Uprobes Documentation Srikar Dronamraju
2010-07-12 10:33 ` [PATCHv9 2.6.35-rc4-tip 8/13] trace: Extract out common code for kprobes/uprobes traceevents Srikar Dronamraju
2010-07-12 10:34 ` [PATCHv9 2.6.35-rc4-tip 9/13] trace: uprobes trace_event interface Srikar Dronamraju
2010-07-12 10:34 ` [PATCHv9 2.6.35-rc4-tip 10/13] perf: Re-Add make_absolute_path Srikar Dronamraju
2010-07-12 14:00 ` Arnaldo Carvalho de Melo
2010-07-12 14:30 ` Steven Rostedt
2010-07-12 16:12 ` Arnaldo Carvalho de Melo
2010-07-14 2:49 ` Steven Rostedt
2010-07-14 16:23 ` Arnaldo Carvalho de Melo
2010-07-14 20:45 ` Ingo Molnar
2010-07-14 20:50 ` Mathieu Desnoyers
2010-07-12 15:33 ` Srikar Dronamraju
2010-07-12 16:26 ` Arnaldo Carvalho de Melo
2010-07-12 17:26 ` Srikar Dronamraju
2010-07-12 10:34 ` [PATCHv9 2.6.35-rc4-tip 11/13] perf: perf interface for uprobes Srikar Dronamraju
2010-07-12 16:03 ` Arnaldo Carvalho de Melo [this message]
2010-07-12 17:32 ` Srikar Dronamraju
2010-07-12 10:34 ` [PATCHv9 2.6.35-rc4-tip 12/13] [RFC] perf: Show Potential probe points Srikar Dronamraju
2010-07-12 14:41 ` Arnaldo Carvalho de Melo
2010-07-12 15:55 ` Srikar Dronamraju
2010-07-12 10:34 ` [PATCHv9 2.6.35-rc4-tip 13/13] [RFC] perf: show functions in a file without using pid Srikar Dronamraju
2010-07-20 4:19 ` [PATCHv9 2.6.35-rc4-tip 0/13] Uprobes Patches: Christoph Hellwig
2010-07-20 6:38 ` Srikar Dronamraju
2010-07-20 21:03 ` Arnaldo Carvalho de Melo
2010-07-21 2:42 ` Srikar Dronamraju
2010-07-21 13:08 ` Steven Rostedt
2010-07-21 13:21 ` Srikar Dronamraju
2010-07-21 13:26 ` Christoph Hellwig
2010-07-21 14:10 ` Steven Rostedt
2010-07-21 14:22 ` Arnaldo Carvalho de Melo
2010-07-21 15:50 ` Steven Rostedt
2010-07-21 13:19 ` Srikar Dronamraju
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=20100712160306.GE25238@ghostprotocols.net \
--to=acme@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=ananth@in.ibm.com \
--cc=fche@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hch@infradead.org \
--cc=jkenisto@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@elte.hu \
--cc=mjw@redhat.com \
--cc=naren.devaiah@in.ibm.com \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rdunlap@xenotime.net \
--cc=rostedt@goodmis.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=torvalds@linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).