Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: "Максим Морсков" <xxxa0c@mail.ru>,
	"Linux Trace Kernel" <linux-trace-kernel@vger.kernel.org>
Subject: Re: tprobe event tracing error
Date: Mon, 26 Feb 2024 12:14:18 -0500	[thread overview]
Message-ID: <20240226121418.5143c6d9@gandalf.local.home> (raw)
In-Reply-To: <20240226234156.c6c647f5c005977327fde62c@kernel.org>

On Mon, 26 Feb 2024 23:41:56 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:

> Hi,
> (Cc: linux-kernel-trace ML for sharing this knowledge)
> 
> On Mon, 26 Feb 2024 16:36:29 +0300
> Максим Морсков <xxxa0c@mail.ru> wrote:
> 
> > 
> > Hello, dear Masami.
> > I am researching Linux event tracing subsystem in part of tprobes,
> > and found interesting behavior in kernel version 6.6:
> >  
> > echo  't:my_fchmodat sys_enter_fchmodat' | 
sudo tee ‘/sys/kernel/tracing/dynamic_events’
> > bash: line 1: echo: write error: Invalid argument  
> 
> Yeah, I understand that you are confused by this behavior, but it is
> actually expected behavior. syscalls:* events looks like trace events
> based on tracepoint, but those are software generated trace event.
> 
> You can find raw_syscalls:* trace events, that is based on the tracepoint,
> and other syscalls:* are based on that raw_syscalls:* trace points.
> (IOW, those are a kind of pre-compiled dynamic events)
> 
> e.g.
> 
> /sys/kernel/tracing # echo "t sys_enter \$arg*" >> dynamic_events 
> /sys/kernel/tracing # cat dynamic_events 
> t:tracepoints/sys_enter sys_enter regs=regs id=id
> 
> /sys/kernel/tracing # echo "t sys_enter_open \$arg*" >> dynamic_events 
> sh: write error: Invalid argument
> /sys/kernel/tracing # cat error_log 
> [  227.981347] trace_fprobe: error: Tracepoint is not found
>   Command: t sys_enter_open $arg*
>              ^
> 
> So, tprobe can not find the hard-coded tracepoints for those dynamically
> generated syscall trace events. But raw_syscall sys_enter/sys_exit are OK.

Ah, that's because "tprobes" are attached to tracepoints and not
trace events. If you want to attach to trace events, you need to use eprobes
(which I need to add documentation for!).

 # echo 'e:my_fchmodat syscalls/sys_enter_fchmodat' > dynamic_events

Works.

-- Steve

  reply	other threads:[~2024-02-26 17:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1708954589.808811792@f182.i.mail.ru>
2024-02-26 14:41 ` tprobe event tracing error Masami Hiramatsu
2024-02-26 17:14   ` Steven Rostedt [this message]
     [not found]     ` <1709130340.286978721@f107.i.mail.ru>
2024-02-28 15:52       ` Steven Rostedt
2024-02-28 15:58         ` Steven Rostedt

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=20240226121418.5143c6d9@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=xxxa0c@mail.ru \
    /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