linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Huan Xie <xiehuan09@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	mingo@redhat.com, chenhuacai@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] trace: Add trace any kernel object
Date: Thu, 21 Oct 2021 09:36:32 +0900	[thread overview]
Message-ID: <20211021093632.a197670625a6595d7082c9f8@kernel.org> (raw)
In-Reply-To: <CAEr6+EDf1hcm2SawO07+69KnBrODmiM05AqeeBwN+4wuyME=6w@mail.gmail.com>

On Thu, 21 Oct 2021 00:04:40 +0800
Huan Xie <xiehuan09@gmail.com> wrote:

> > > > For example:
> > > >
> > > > For the function bio_add_page, we can trace the first argument:
> > > >
> > > > int bio_add_page(struct bio *bio, struct page *page,
> > > >                             unsigned int len, unsigned int offset)
> > > >
> > > >     #cd /sys/kernel/debug/tracing
> > > >     #echo 1 > ./trace_object
> >
> > Hmm, so what happen if there are several events in parallel?
> >
> > > >     #echo 'p bio_add_page arg1=$arg1' > kprobe_events
> > > >     #echo 1 > ./events/kprobes/p_bio_add_page_0/enable
> >
> > what about adding a "objfilter" trigger action to update the object
> > list? e.g.
> >
> > echo objfilter:add:arg1:1 if comm == "sync" >> ./events/kprobes/p_bio_add_page_0/trigger
> >
> > This will "add the value of 'arg1' to objfilter 1 time if the process
> > name is sync".
> 
> Thanks. The trigger seems to work in combination with kprobe/uprobe/eprobe.
> 
> I have been trying to implement this feature in recent days, But my
> code does not look very elegant at the moment :-)

No problem! I can help you to brush up the coding :)

> It seems the result of 'cat  trace' should also need to be filtered,
> Because it will output the functions we don’t want to care about.

It actually depends on what object user wants to trace. e.g. network
packet trace will not be affected by 'cat trace'.
Anyway, we have "options/pause-on-trace" to stop tracing while
reading trace file. So user can choose it stop it or not. :)

> 
> I didn't expect this idea to be a relatively large project. :-)
> 

Because you have an exciting idea :)

Thank you,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

      parent reply	other threads:[~2021-10-21  0:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14  1:44 [PATCH] trace: Add trace any kernel object Jeff Xie
2021-10-14  2:20 ` Steven Rostedt
2021-10-14 17:35   ` Huan Xie
2021-10-14 17:52     ` Steven Rostedt
2021-10-15 13:08   ` Masami Hiramatsu
2021-10-20 16:04     ` Huan Xie
2021-10-20 19:07       ` Steven Rostedt
2021-10-21  0:36       ` Masami Hiramatsu [this message]

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=20211021093632.a197670625a6595d7082c9f8@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=xiehuan09@gmail.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).