mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: "Frédéric Weisbecker" <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Jason Baron <jbaron@redhat.com>,
	Tom Zanussi <tzanussi@gmail.com>,
	linux-kernel@vger.kernel.org, laijs@cn.fujitsu.com,
	rostedt@goodmis.org, peterz@infradead.org, jiayingz@google.com,
	mbligh@google.com, roland@redhat.com, fche@redhat.com
Subject: Re: [RFC] convert ftrace syscall tracer to TRACE_EVENT()
Date: Sat, 9 May 2009 11:24:35 -0400	[thread overview]
Message-ID: <20090509152435.GB4071@Krystal> (raw)
In-Reply-To: <c62985530905090801x1a2c34der364d4636ec667429@mail.gmail.com>

* Frédéric Weisbecker (fweisbec@gmail.com) wrote:
> 2009/5/9 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>:
> > * Ingo Molnar (mingo@elte.hu) wrote:
> >>
> >> * Frédéric Weisbecker <fweisbec@gmail.com> wrote:
> >>
> >> > > I would expect to use copy_string_from_user (for strings) and
> >> > > copy_from_user for structures, because without any strings
> >> > > (especially), the trace information become much less useful.
> >> >
> >> > Yeah, for structures we would just need the copy_from_user.
> >>
> >> There's just a few places (mainly related to VFS APIs) where we
> >> really want to do that, and there we want to do it a bit later, not
> >> at syscall time: we want to do it after the getname(), to output a
> >> stable (and already copied to kernel space) copy of the file name.
> >>
> >> So the right solution there would be to add special, case by case
> >> tracepoints to those few places. We dont need strings for the
> >> majority of the 300+ system calls that exist on Linux.
> >>
> >>       Ingo
> >
> > Hrm, this is an important design decision.. I cover a lot of those sites
> > in my LTTng instrumentation, and this is clearly one way to do it, at
> > the expense of adding tracepoints in many kernel locations when there
> > could be a functionnal equivalent with syscall instrumentation.
> 
> 
> Yeah, these tracepoints defined from DEFINE_SYSCALL are a good way
> to proceed generically.
> For specific cases, we can later add some upper layer, such as described below.
> 
> 
> > The thing we would need to do it from the syscall tracing site is a
> > table to map the system call numbers to their specific types (for the
> > syscalls we care about) and therefore which would also map to a
> > serialisation function to extract the parameters and write the correct
> > content into the trace buffers.
> 
> 
> I would rather see this not using the syscalls as a key but the type
> of a parameter.
> We can find a same specific complex type used by several syscalls.
> 

Agreed.

> If we want even better precision, we can also pair that with syscalls
> mapping for specific post-computing in output time. As an exemple to
> print O_RDONLY instead of the matching number.
> 

Yep.

> 
> >
> > We could also use getname()/putname() in the syscall tracing primitive.
> > Note that architectures like x86 64 needs some tweaks I have in my
> > patchset to correctly ensure that syscall entry/exit are always paired.
> > This is required because we change the thread flag synchronously with
> > thread execution upen activation/deactivation.
> 
> 
> Not sure I understand your point here. The only resulting problem of such
> race would be rare unpaired syscall exit or entry traces... Is it that
> much important?
> 

If we have non-symmetric getname()/putname(), it will cause bogus ref
counting, and will leak memory.

Having non-matching syscall entry/exit is OK as long as tracing has no
side-effect on the rest of the kernel (e.g. only using local variables).
If we start playing with getname/putname for synchronization, we have to
be extra careful, because we start modifying external state.

Mathieu


-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2009-05-09 15:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-08 21:03 Jason Baron
2009-05-09  8:37 ` Ingo Molnar
2009-05-09 12:53   ` Frédéric Weisbecker
2009-05-09 13:33     ` Ingo Molnar
2009-05-09 13:50       ` Mathieu Desnoyers
2009-05-09 14:06         ` Frédéric Weisbecker
2009-05-09 14:15           ` Ingo Molnar
2009-05-09 14:29             ` Mathieu Desnoyers
2009-05-09 15:01               ` Frédéric Weisbecker
2009-05-09 15:24                 ` Mathieu Desnoyers [this message]
2009-05-09 14:47             ` Frédéric Weisbecker
2009-05-09 17:44         ` David Wagner
2009-05-09 14:02       ` Frédéric Weisbecker
2009-05-09 14:07         ` Ingo Molnar
2009-05-09 14:12           ` Frédéric Weisbecker
2009-05-09 15:36   ` Frank Ch. Eigler
2009-05-09 15:57     ` Mathieu Desnoyers
2009-05-09 16:32     ` Mathieu Desnoyers
2009-05-10  6:59   ` Tom Zanussi
2009-05-11 22:16   ` Jason Baron
2009-05-12  2:44   ` Roland McGrath

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=20090509152435.GB4071@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=fche@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=jbaron@redhat.com \
    --cc=jiayingz@google.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@google.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=roland@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tzanussi@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

all inboxes | Powered by JetHome®