LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: rostedt@goodmis.org, linux-trace-devel@vger.kernel.org,
	mhiramat@kernel.org, linux-kernel@vger.kernel.org,
	tom.zanussi@linux.intel.com
Subject: Re: [RFC] [RFC] trace: Add kprobe on tracepoint
Date: Sat, 7 Aug 2021 10:28:46 +0900	[thread overview]
Message-ID: <20210807102846.4d4f88b157deb26b9345fab5@kernel.org> (raw)
In-Reply-To: <20210806174928.847848-1-tz.stoyanov@gmail.com>

Hi Tzvetomir,

On Fri,  6 Aug 2021 20:49:28 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> From: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> 
> The /sys/kernel/debug/tracing/kprobe_events interface is extended with a
> new type of user defined dynamic event, that is attached to an existing
> tracepoint. The user can specify custom format string of the new event,
> select what tracepoint arguments will be printed and how to print them.
> 
> The format is similar to the existing kprobe_events interface:
>  e:GNAME/ENAME SYSTEM/EVENT [FETCHARGS]	- Set an event probe
>  -e:GNAME/ENAME				- Delete an event probe
> 
> Where:
>  GNAME	- Group name, mandatory
>  ENAME	- Name of the new event in GNAME, mandatory
>  SYSTEM	- Name of the system, where the tracepoint is defined, mandatory
>  EVENT	- Name of the tracepoint event in SYSTEM, mandatory
>  FETCHARGS - Arguments:
>   <name>=$<field>[:TYPE] - Fetch given filed of the tracepoint and print it as
> 		    given TYPE with given name. Supported types are
>                     (u8/u16/u32/u64/s8/s16/s32/s64), basic type
>                     (x8/x16/x32/x64), hexadecimal types
> 		    "string", "ustring" and bitfield.
> 
> Example, attach event probe on openat system call and print name of the
> file that will be opened:
>  echo "e:esys/eopen syscalls.sys_enter_openat file=\$filename:string" >> kprobe_events
> A new dynamic event is created in events/esys/eopen/ directory. It
> can be deleted with:
>  echo "-e:esys/eopen" >> kprobe_events

Hmm, sorry, I rather like to use synthetic event with trigger action,
since this is not a kprobe.
Can you change your idea to use trigger action with synthetic event?

For example, if we have a "trace" action in the trigger action,

echo "eopen char filename[]" >> synthetic_events
echo "trace:eopen,filename.ustring" >> events/syscalls/sys_enter_openat/trigger

A new action is,
  trace:SYNTH_EVENT,PARAM(s) [if FILTER]
and
  .ustring/.string modifier for the PARAMS.

I think this matches the current dynamic event model, and can extend
programmability of the ftrace, and keeps dynamic events simple.

Thank you,


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  parent reply	other threads:[~2021-08-07  1:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 17:49 Tzvetomir Stoyanov (VMware)
2021-08-06 22:31 ` Steven Rostedt
2021-08-07  1:28 ` Masami Hiramatsu [this message]
2021-08-07  3:54   ` Steven Rostedt
2021-08-08  3:15     ` 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=20210807102846.4d4f88b157deb26b9345fab5@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tom.zanussi@linux.intel.com \
    --cc=tz.stoyanov@gmail.com \
    --subject='Re: [RFC] [RFC] trace: Add kprobe on tracepoint' \
    /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

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).