This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: measuring accept queueing time (revisited)


On 11/30/2012 02:35 PM, Eric Wong wrote:
> /* XXX: This doesn't seem to work, so I'm probing skb_recv_diagram instead */
> probe kernel.function("unix_accept").return {
> 	if ($return != 0)
> 		next
> 	sk = $newsock->sk
> 	/* state: 3 == SS_CONNECTED, but this shows 1 (SS_UNCONNECTED) ... */
> 	/* printf("accept %d %lx %lx\n", $newsock->state, $newsock, sk); */

This is probably an instance of one common confusion -- in .return
probes, all instances of $var, $var->member, etc. are captured when the
function is *entered* (except for $return, of course).  The context in
which the return trampoline actually runs is just not amenable to
decoding DWARF from the function we just left.

So it makes twisted sense to see SS_UNCONNECTED from the entry of
unix_accept, but you want to see the SS_CONNECTED when it returns.

One way to cheat this is to go ahead and grab the implicit entry value
for $newsock, and then use a dynamic @cast to get the member you really
want at return time.  Something like:
  @cast($newsock, "struct socket")->state

You probably need the same for $newsock->sk too.

We had an old bug arguing about whether delaying member access should be
standard, which I can't find now.  Suffice to say we never agreed to
change this behavior, so here we are.  PR14437 would give a mechanism to
be explicit about it though, like @entry($newsock)->state.
  http://sourceware.org/bugzilla/show_bug.cgi?id=14437


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]