public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Instrumenting context switches
@ 2006-11-30  1:35 Perry Cheng
  2006-11-30  1:41 ` Frank Ch. Eigler
  2006-11-30 18:22 ` Martin Hunt
  0 siblings, 2 replies; 9+ messages in thread
From: Perry Cheng @ 2006-11-30  1:35 UTC (permalink / raw)
  To: systemtap

Using some example code, I tried to instrument context switching by adding 
a probe to the method __switch_to.  Some documentation had suggested that 
certain versions of the systemtap could not handle instrumenting 
context_switch.  In the past I have gotten this to work but now the use of 
_stp_printf seems to cause the machine to freeze hard.  If I leave out the 
printing of switchCount but leave in the increment, things work fine.  Is 
this a known problem or a known historical problem and if so what are the 
workarounds?


probe kernel.function("__switch_to")
{
        doSwitchTo(gettimeofday_us(), $prev_p, $next_p);
}

function doSwitchTo(timeus:long, prev:long, next:long)
%{
        _stp_printf("SWITCHCOUNT = %ld\n", switchCount); 
<------------------------------ BAD LINE
        switchCount++;
}%




Perry

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: Instrumenting context switches
@ 2006-11-30 15:31 Stone, Joshua I
  0 siblings, 0 replies; 9+ messages in thread
From: Stone, Joshua I @ 2006-11-30 15:31 UTC (permalink / raw)
  To: Perry Cheng, systemtap

On Wednesday, November 29, 2006 3:26 PM, Perry Cheng wrote:
> Using some example code, I tried to instrument context switching by
> adding a probe to the method __switch_to.  Some documentation had
> suggested that certain versions of the systemtap could not handle
> instrumenting context_switch.

The problems with resolving the context_switch function have been fixed
for a while, but there's still sometimes issues accessing the parameters
of inline functions.  See bugzilla #1155.
http://sources.redhat.com/bugzilla/show_bug.cgi?id=1155

Using __switch_to is not an option on all platforms -- on IA64 it is a
macro, and on x86_64 it is blacklisted (bz2086).


Josh

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: Instrumenting context switches
@ 2006-11-30 18:10 Stone, Joshua I
  0 siblings, 0 replies; 9+ messages in thread
From: Stone, Joshua I @ 2006-11-30 18:10 UTC (permalink / raw)
  To: Frank Ch. Eigler, Perry Cheng; +Cc: systemtap

On Wednesday, November 29, 2006 4:47 PM, Frank Ch. Eigler wrote:
> It may be that this problem is due to the recent rewrite of
> gettimeofday_us.  That code contains bits like preempt_disable() and
> _enable(), even though the equivalent (interrupt disabling) should
> already be done within probe context.  In particular, I wonder if
> changing the latter to preempt_enable_no_resched() might improve the
> situation.

I'll take a look at whether some of the locking in the time subsystem
can go away, under the assumption that probes are always
interrupt-disabled.  I took a very conservative approach, so I'm sure
some of that is overkill.  However, the preempt_enable vs. _no_resched
shouldn't really cause a problem, because preempt_schedule checks for
irqs_disabled() anyway.

I think this is a red herring for Perry though.  He mentions that simply
taking out his _stp_printf statement makes things work, so the
gettimeofday_us is still being called in the working case.

A wild guess -- the stack is transitioning in __switch_to, so might it
be that _stp_printf is running out-of-bounds somehow?


Josh

^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <OFB78608CD.65116F14-ON85257236.0073959D-85257236.00738AAF@mck.us.ray.com>]
[parent not found: <OFBBDFEA36.CA571100-ON85257237.00006111-85257237.0000676B@mck.us.ray.com>]

end of thread, other threads:[~2006-12-01  0:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-30  1:35 Instrumenting context switches Perry Cheng
2006-11-30  1:41 ` Frank Ch. Eigler
2006-11-30 18:22 ` Martin Hunt
2006-11-30 22:01   ` Perry Cheng
2006-11-30 15:31 Stone, Joshua I
2006-11-30 18:10 Stone, Joshua I
     [not found] <OFB78608CD.65116F14-ON85257236.0073959D-85257236.00738AAF@mck.us.ray.com>
2006-12-01  0:25 ` Dave Sperry
2006-12-01  3:12   ` Perry Cheng
     [not found] <OFBBDFEA36.CA571100-ON85257237.00006111-85257237.0000676B@mck.us.ray.com>
2006-12-01  3:14 ` Dave Sperry

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).