Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1611441
| From | Masami Hiramatsu <mhiramat@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v1] tracing/kprobes: expose maxactive for kretprobe in kprobe_events |
| Date | 2017-03-29 01:50 +0200 |
| Message-ID | <tq92a-6KA-19@gated-at.bofh.it> (permalink) |
| References | <tpZPe-8sh-45@gated-at.bofh.it> <tq1ei-1a1-19@gated-at.bofh.it> <tq1nY-1do-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 28 Mar 2017 11:34:07 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 29 Mar 2017 00:23:35 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > > @@ -598,8 +601,10 @@ static int create_trace_kprobe(int argc, char **argv)
> > > {
> > > /*
> > > * Argument syntax:
> > > - * - Add kprobe: p[:[GRP/]EVENT] [MOD:]KSYM[+OFFS]|KADDR [FETCHARGS]
> > > - * - Add kretprobe: r[:[GRP/]EVENT] [MOD:]KSYM[+0] [FETCHARGS]
> > > + * - Add kprobe:
> > > + * p[:[GRP/]EVENT] [MOD:]KSYM[+OFFS]|KADDR [FETCHARGS]
> > > + * - Add kretprobe:
> > > + * r[MAXACTIVE][:[GRP/]EVENT] [MOD:]KSYM[+0] [FETCHARGS]
> > > * Fetch args:
> > > * $retval : fetch return value
> > > * $stack : fetch stack address
> > > @@ -619,6 +624,7 @@ static int create_trace_kprobe(int argc, char **argv)
> > > int i, ret = 0;
> > > bool is_return = false, is_delete = false;
> > > char *symbol = NULL, *event = NULL, *group = NULL;
> > > + int maxactive = 0;
> > > char *arg;
> > > unsigned long offset = 0;
> > > void *addr = NULL;
> > > @@ -637,8 +643,26 @@ static int create_trace_kprobe(int argc, char **argv)
> > > return -EINVAL;
> > > }
> > >
> > > - if (argv[0][1] == ':') {
> > > + if (is_return && isdigit(argv[0][1]) && strchr(&argv[0][1], ':')) {
> >
> > This only supports r[MAXACTIVE:[GRP/]EVENT]. e.g "r100" without event name.
>
> You mean it doesn't support adding MAXACTIVE without the ':event'.
Yeah, sorry for lacking the explanation...
>
> >
> > Thank you,
> >
> > > + event = strchr(&argv[0][1], ':') + 1;
> > > + event[-1] = '\0';
> > > + ret = kstrtouint(&argv[0][1], 0, &maxactive);
> > > + if (ret) {
> > > + pr_info("Failed to parse maxactive.\n");
> > > + return ret;
> > > + }
> > > + /* kretprobes instances are iterated over via a list. The
> > > + * maximum should stay reasonable.
> > > + */
> > > + if (maxactive > 1024) {
>
> Also, can we get rid of magic numbers within the code. There should be a
> const or macro defined as MAX_MAXACTIVE or something, and use that here.
Good catch!
Thanks,
>
> -- Steve
>
>
> > > + pr_info("Maxactive is too big.\n");
> > > + return -EINVAL;
> > > + }
> > > + } else if (argv[0][1] == ':') {
> > > event = &argv[0][2];
> > > + }
> > > +
> > > + if (event) {
> > > if (strchr(event, '/')) {
> > > group = event;
> > > event = strchr(group, '/') + 1;
> > > @@ -718,8 +742,8 @@ static int create_trace_kprobe(int argc, char **argv)
> > > is_return ? 'r' : 'p', addr);
> > > event = buf;
> > > }
> > > - tk = alloc_trace_kprobe(group, event, addr, symbol, offset, argc,
> > > - is_return);
> > > + tk = alloc_trace_kprobe(group, event, addr, symbol, offset, maxactive,
> > > + argc, is_return);
> > > if (IS_ERR(tk)) {
> > > pr_info("Failed to allocate trace_probe.(%d)\n",
> > > (int)PTR_ERR(tk));
> > > --
> > > 2.7.4
> > >
> >
> >
>
--
Masami Hiramatsu <mhiramat@kernel.org>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v1] tracing/kprobes: expose maxactive for kretprobe in kprobe_events Alban Crequy <alban.crequy@gmail.com> - 2017-03-28 16:00 +0200
Re: [PATCH v1] tracing/kprobes: expose maxactive for kretprobe in kprobe_events Steven Rostedt <rostedt@goodmis.org> - 2017-03-28 17:20 +0200
Re: [PATCH v1] tracing/kprobes: expose maxactive for kretprobe in kprobe_events Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-28 17:30 +0200
Re: [PATCH v1] tracing/kprobes: expose maxactive for kretprobe in kprobe_events Steven Rostedt <rostedt@goodmis.org> - 2017-03-28 17:40 +0200
Re: [PATCH v1] tracing/kprobes: expose maxactive for kretprobe in kprobe_events Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-29 01:50 +0200
Re: [PATCH v1] tracing/kprobes: expose maxactive for kretprobe in kprobe_events Alban Crequy <alban@kinvolk.io> - 2017-03-28 18:20 +0200
Re: [PATCH v1] tracing/kprobes: expose maxactive for kretprobe in kprobe_events Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-29 02:00 +0200
csiph-web