All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Jiri Olsa <olsajiri@gmail.com>,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Florent Revest <revest@chromium.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Will Deacon <will@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	bpf@vger.kernel.org
Subject: Re: [PATCH v5 4/9] tracing/probes: Add tracepoint support on fprobe_event
Date: Mon, 24 Apr 2023 09:38:35 +0200	[thread overview]
Message-ID: <ZEYx+2WWixBkDbTn@krava> (raw)
In-Reply-To: <20230423223740.9f1186a08b3b316b5a0156e7@kernel.org>

On Sun, Apr 23, 2023 at 10:37:40PM +0900, Masami Hiramatsu wrote:
> On Sun, 23 Apr 2023 09:41:54 +0200
> Jiri Olsa <olsajiri@gmail.com> wrote:
> 
> > On Thu, Apr 20, 2023 at 08:26:10PM +0900, Masami Hiramatsu (Google) wrote:
> > > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > > 
> > > Allow fprobe_event to trace raw tracepoints so that user can trace
> > > tracepoints which don't have traceevent wrappers. This new event is
> > > always available if fprobe event is enabled since the tracepoint is
> > > disabled, trace-event and dynamic event is also not available.
> > 
> > I thought of ftrace tracepoints wrappers as standard in distros,
> > could you specify which config options that involves?
> 
> Ah, sorry, I'm completely confused you.
> 
> ----
> This new event is always available if fprobe event is enabled. If the
> tracepoint is disabled, trace-event and dynamic event including
> fprobe is also not available.
> ----

so this basically adds another way of attaching to tracepoint through ftrace
dynamic_events file interface.. but we can already attach to tracepoints
through ftrace via /sys/kernel/debug/tracing/events/* right?

I'm trying to find out what's the config for which this new way of attaching
tracepoints is useful

thanks,
jirka

> 
> > 
> > > +	if (trace_fprobe_is_tracepoint(tf)) {
> > > +		struct tracepoint *tpoint = tf->tpoint;
> > > +		unsigned long ip = (unsigned long)tpoint->probestub;
> > > +		/*
> > > +		 * Here, we do 2 steps to enable fprobe on a tracepoint.
> > > +		 * At first, put __probestub_##TP function on the tracepoint
> > > +		 * and put a fprobe on the stub function.
> > > +		 */
> > > +		ret = tracepoint_probe_register_prio_may_exist(tpoint,
> > > +					tpoint->probestub, NULL, 0);
> > > +		if (ret < 0)
> > > +			return ret;
> > > +		return register_fprobe_ips(&tf->fp, &ip, 1);
> > 
> > nice idea
> 
> Thanks!
> 
> 
> > 
> > jirka
> > 
> > > +	}
> > > +
> > >  	/* TODO: handle filter, nofilter or symbol list */
> > >  	return register_fprobe(&tf->fp, tf->symbol, NULL);
> > >  }
> > > @@ -699,6 +723,12 @@ static void __unregister_trace_fprobe(struct trace_fprobe *tf)
> > >  	if (trace_fprobe_is_registered(tf)) {
> > >  		unregister_fprobe(&tf->fp);
> > >  		memset(&tf->fp, 0, sizeof(tf->fp));
> > > +		if (trace_fprobe_is_tracepoint(tf)) {
> > > +			tracepoint_probe_unregister(tf->tpoint,
> > > +					tf->tpoint->probestub, NULL);
> > > +			tf->tpoint = NULL;
> > > +			tf->mod = NULL;
> > > +		}
> > >  	}
> > >  }
> > 
> > SNIP
> 
> 
> -- 
> Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2023-04-24  7:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 11:25 [PATCH v5 0/9] tracing: Add fprobe events Masami Hiramatsu (Google)
2023-04-20 11:25 ` [PATCH v5 1/9] fprobe: Pass return address to the handlers Masami Hiramatsu (Google)
2023-04-20 11:25 ` [PATCH v5 2/9] tracing/probes: Add fprobe events for tracing function entry and exit Masami Hiramatsu (Google)
2023-04-20 18:49   ` Alexei Starovoitov
2023-04-20 23:41     ` Masami Hiramatsu
2023-04-20 23:46       ` Alexei Starovoitov
2023-04-21  5:38         ` Masami Hiramatsu
2023-04-21 16:31           ` Alexei Starovoitov
2023-04-24  4:24             ` Masami Hiramatsu
2023-04-20 11:26 ` [PATCH v5 3/9] selftests/ftrace: Add fprobe related testcases Masami Hiramatsu (Google)
2023-04-20 11:26 ` [PATCH v5 4/9] tracing/probes: Add tracepoint support on fprobe_event Masami Hiramatsu (Google)
2023-04-21  0:18   ` kernel test robot
2023-04-23  7:41   ` Jiri Olsa
2023-04-23 13:37     ` Masami Hiramatsu
2023-04-24  7:38       ` Jiri Olsa [this message]
2023-04-20 11:26 ` [PATCH v5 5/9] tracing/probes: Move event parameter fetching code to common parser Masami Hiramatsu (Google)
2023-04-20 11:26 ` [PATCH v5 6/9] tracing/probes: Support function parameters if BTF is available Masami Hiramatsu (Google)
2023-04-20 19:08   ` Alan Maguire
2023-04-21  0:56     ` Masami Hiramatsu
2023-04-21  1:01       ` Alexei Starovoitov
2023-04-20 11:26 ` [PATCH v5 7/9] tracing/probes: Add $$args meta argument for all function args Masami Hiramatsu (Google)
2023-04-20 11:26 ` [PATCH v5 8/9] selftests/ftrace: Add tracepoint probe test case Masami Hiramatsu (Google)
2023-04-20 11:26 ` [PATCH v5 9/9] selftests/ftrace: Add BTF arguments test cases Masami Hiramatsu (Google)

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=ZEYx+2WWixBkDbTn@krava \
    --to=olsajiri@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.lau@linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=revest@chromium.org \
    --cc=rostedt@goodmis.org \
    --cc=will@kernel.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 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.