public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Adrien Kunysz <adrien@kunysz.be>
To: Josh Stone <jistone@redhat.com>
Cc: contemplating zombie <contemplatingzombie@gmail.com>,
	systemtap@sourceware.org
Subject: Re: Puzzling output of stp script
Date: Sun, 25 Dec 2011 20:20:00 -0000	[thread overview]
Message-ID: <20111225110952.GD17069@chouffe> (raw)
In-Reply-To: <4EF6BAEB.7000006@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2035 bytes --]

On Sat, Dec 24, 2011 at 09:55:55PM -0800, Josh Stone wrote:
> On 12/24/2011 10:31 AM, contemplating zombie wrote:
> > Hi,
> > 
> > I am new to systemtap and I was trying out following example script
> > given in the documentation:
> > 
> > probe kernel.function("*@net/socket.c") {
> >       printf ("%s -> %s\n", thread_indent(1), probefunc())
> > }
> > 
> > probe kernel.function("*@net/socket.c").return {
> >       printf ("%s <- %s\n", thread_indent(-1), probefunc())
> > }
> > 
> > I sshed into a remote machine and executed it. What I see is that the
> > stack frames just keep on growing to right and do not return. Won't
> > that cause a stack overflow eventually?
> 
> The reason is that you are probing more functions on entry than you are
> on return.  There's no stack issue; the probes are just imbalanced.
> 
> There are two flavors of entry probe: .call and .inline.  If you don't
> specify, then you get a union of both.  However, .return probes only
> work for the .call flavor, because there is no real return from inlined
> functions.
> 
> So when you need balanced probes for entering and leaving functions, use
> .call and .return.  You could also be clever and represent the .inline
> separately with thread_indent(0).

And that particular example was already fixed a while ago btw:
http://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=commitdiff;h=396afcee5ada2d207b7a6691d4b7ce473e7b2a65

> >      0 sshd(804): -> sock_poll
> >     11 sshd(804): <- sock_poll
> >      0 sshd(804): -> sock_aio_read
> >      2 sshd(804):  -> alloc_sock_iocb
> >      3 sshd(804):  <- alloc_sock_iocb
> >      5 sshd(804):  -> do_sock_read
> >      7 sshd(804):   -> __sock_recvmsg
> >      9 sshd(804):    -> __sock_recvmsg_nosec
> >     15 sshd(804):    <- sock_aio_read
> 
> Notice right here, you got a return from sock_aio_read, jumping back
> over three other "calls".  I'll bet that do_sock_read, __sock_recvmsg,
> and __sock_recvmsg_nosec were all inlined in your kernel.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-12-25 11:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAO_gTC6yXVN-6a-aj6YFy4Z_7wGaMRzbHTWWWdQOyWgD=g0rOQ@mail.gmail.com>
2011-12-24 19:14 ` contemplating zombie
2011-12-24 22:56   ` Adrien Kunysz
2011-12-25  5:56     ` contemplating zombie
2011-12-25 11:07   ` Josh Stone
2011-12-25 20:20     ` Adrien Kunysz [this message]
2011-12-25 23:59       ` Mark Wielaard

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=20111225110952.GD17069@chouffe \
    --to=adrien@kunysz.be \
    --cc=contemplatingzombie@gmail.com \
    --cc=jistone@redhat.com \
    --cc=systemtap@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).