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: Instrumenting context switches


The following even simpler program also dies and rules out gettimeofday or 
accessing a global variable as possible causes. The crash happens on both 
an intel-686 and AMD-686 both running a modified version of 2.6.16.  I 
don't know the details of the modifications but they are generally used to 
support real-time features and include the hrt and rt-prio patches.  The 
src is at ftp://linuxpatch.ncsa.uiuc.edu/rt-linux/rhel4u2/R1-iFix1.

If I replace __switch_to with context_switch or finish_task_switch, the 
failure still occurs.  However, if I switch to set_task_comm, then things 
seem ok.

probe kernel.function("__switch_to")
{
        foobar()
}

function foobar()
%{
        _stp_printf("foobar\n");
%}

Perry


systemtap-owner@sourceware.org wrote on 11/30/2006 10:31:10 AM:

> On Wed, 2006-11-29 at 18:25 -0500, Perry Cheng wrote:
> 
> > 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++;
> > }%
> 
> Obviously the code fragment above is not exactly what you are using to
> reproduce the bug. (You can't use keywords as parameter names,
> uninitialized switchCount, "}%", etc).  I tried the following and did
> not see any problems.  Can you give more details (arch, OS, etc) on how
> to reproduce?
> 
> %{
>    long switchCount = 1000000;
> %}
> 
> function doSwitchTo (t:long, p:long, n:long) %{
>    _stp_printf("SWITCHCOUNT = %ld\n", switchCount); 
>    switchCount++;
> %}
> 
> probe kernel.function("__switch_to")
> {
>         doSwitchTo(gettimeofday_us(), $prev_p, $next_p);
> }
> 
> 
> 


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