linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Francis Laniel <flaniel@linux.microsoft.com>,
	linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-trace-kernel@vger.kernel.org,
	Song Liu <songliubraving@fb.com>,
	bpf@vger.kernel.org
Subject: Re: [RFC PATCH v1 1/1] tracing/kprobe: Add multi-probe support for 'perf_kprobe' PMU
Date: Sun, 20 Aug 2023 22:34:40 +0200	[thread overview]
Message-ID: <ZOJ44P40bsSpUmYA@krava> (raw)
In-Reply-To: <20230819101105.b0c104ae4494a7d1f2eea742@kernel.org>

On Sat, Aug 19, 2023 at 10:11:05AM +0900, Masami Hiramatsu wrote:

SNIP

> > > > > > +	func_addr = kallsyms_lookup_name(func);
> > > > > > +	for (i = 0; i < array.size; i++) {
> > > > > > +		struct trace_kprobe *tk_same_name;
> > > > > > +		unsigned long address;
> > > > > > +
> > > > > > +		address = array.addrs[i];
> > > > > > +		/* Skip the function address as we already registered it. */
> > > > > > +		if (address == func_addr)
> > > > > > +			continue;
> > > > > > +
> > > > > > +		/*
> > > > > > +		 * alloc_trace_kprobe() first considers symbol name, so we set
> > > > > > +		 * this to NULL to allocate this kprobe on the given address.
> > > > > > +		 */
> > > > > > +		tk_same_name = alloc_trace_kprobe(KPROBE_EVENT_SYSTEM, event,
> > > > > > +						  (void *)address, NULL, offs,
> > > > > > +						  0 /* maxactive */,
> > > > > > +						  0 /* nargs */, is_return);
> > > > > > +
> > > > > > +		if (IS_ERR(tk_same_name)) {
> > > > > > +			ret = -ENOMEM;
> > > > > > +			goto error_free;
> > > > > > +		}
> > > > > > +
> > > > > > +		init_trace_event_call(tk_same_name);
> > > > > > +
> > > > > > +		if (traceprobe_set_print_fmt(&tk_same_name->tp, ptype) < 0) {
> > > > > > +			ret = -ENOMEM;

also are we leaking tk_same_name in here?


> > > > > > +			goto error_free;
> > > > > > +		}
> > > > > > +
> > > > > > +		ret = append_trace_kprobe(tk_same_name, tk);
> > > > > > +		if (ret)

and here?

jirka

> > > > > > +			goto error_free;
> > > > > > +	}
> > > > > > +
> > > > > > +end:
> > > > > > +	kfree(array.addrs);
> > > > > > 
> > > > > >  	return trace_probe_event_call(&tk->tp);
> > > > > > 
> > > > > > +error_free:
> > > > > > +	kfree(array.addrs);
> > > > > > 
> > > > > >  error:
> > > > > >  	free_trace_kprobe(tk);
> > > > > >  	return ERR_PTR(ret);
> > > > 
> > > > ---
> > > > [1]: https://github.com/torvalds/linux/blob/
> > > > 57012c57536f8814dec92e74197ee96c3498d24e/tools/perf/util/probe-event.c#L29
> > > > 89- L2993
> > 
> > 
> > 
> > 
> 
> 
> -- 
> Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 

  parent reply	other threads:[~2023-08-20 20:39 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230816163517.112518-1-flaniel@linux.microsoft.com>
2023-08-16 16:35 ` [RFC PATCH v1 1/1] tracing/kprobe: Add multi-probe support for 'perf_kprobe' PMU Francis Laniel
2023-08-16 18:42   ` Steven Rostedt
2023-08-17 10:59     ` Francis Laniel
2023-08-17 15:13       ` Steven Rostedt
2023-08-18  9:01         ` Francis Laniel
2023-08-18 12:37         ` Masami Hiramatsu
2023-08-18 15:41           ` Steven Rostedt
2023-08-18 18:13             ` Francis Laniel
2023-08-18 18:20               ` Steven Rostedt
2023-08-19  1:15                 ` Masami Hiramatsu
2023-08-19 15:22                   ` Song Liu
2023-08-20  9:32                     ` Masami Hiramatsu
2023-08-20 10:02                       ` Song Liu
2023-08-20 13:16                         ` Masami Hiramatsu
2023-08-21  6:09                           ` Song Liu
2023-08-21 10:01                             ` Masami Hiramatsu
2023-08-21 14:45                               ` Steven Rostedt
2023-08-21 18:07                                 ` Kees Cook
2023-08-21 14:29                         ` Steven Rostedt
2023-08-21 15:19                           ` Masami Hiramatsu
2023-08-21 15:28                             ` Steven Rostedt
2023-08-17  7:50   ` Masami Hiramatsu
2023-08-17 11:06     ` Francis Laniel
2023-08-18 13:05       ` Masami Hiramatsu
2023-08-18 18:12         ` Francis Laniel
2023-08-19  1:11           ` Masami Hiramatsu
2023-08-20 20:23             ` Jiri Olsa
2023-08-21 12:22               ` Francis Laniel
2023-08-20 20:34             ` Jiri Olsa [this message]
2023-08-21 12:24               ` Francis Laniel
2023-08-22 13:13                 ` Jiri Olsa
2023-08-21 12:55             ` Francis Laniel
2023-08-23  0:36               ` Masami Hiramatsu
2023-08-23  9:54                 ` Francis Laniel
2023-08-23 13:45                   ` Masami Hiramatsu

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=ZOJ44P40bsSpUmYA@krava \
    --to=olsajiri@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=flaniel@linux.microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=songliubraving@fb.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 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).