Re: [PATCH v5 4/9] tracing/probes: Add tracepoint support on fprobe_event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 23 Apr 2023 09:41:54 +0200
Jiri Olsa <olsajiri@xxxxxxxxx> wrote:

> On Thu, Apr 20, 2023 at 08:26:10PM +0900, Masami Hiramatsu (Google) wrote:
> > From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
> > 
> > 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.
----

> 
> > +	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@xxxxxxxxxx>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux