public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Help required with a script
@ 2009-01-12 16:49 beginner966
  2009-01-12 19:09 ` Frank Ch. Eigler
  0 siblings, 1 reply; 3+ messages in thread
From: beginner966 @ 2009-01-12 16:49 UTC (permalink / raw)
  To: systemtap


Hello,
This is the script which I had written to gather information on migration of
task to other CPU. I also wanted to report the appropriate errors, so I had
used 4 kernel.statement probes. But the problem is that all 4
kernel.statement probes get executed simultaneously, which should not happen
according to the original code. Please help in tracing the problem. Thanks.
Uname -r for the kernel is : 2.6.26.5-rt9


#! /usr/bin/env stap

probe kernel.function("__migrate_task")
{
        printf("\n__migrate_task called for process: \npid : %d\nSource CPU
: %d\tDestination CPU : %d",$p->pid,$src_cpu,$dest_cpu);
              printf("\nState: %d",task_state(task_current()))
              print_stack(backtrace())
}

/*
 *  6293:          if (unlikely(cpu_is_offline(dest_cpu)))
 *  6294:                 return ret; 
 */

probe kernel.statement("*@kernel/sched.c:6294")
{
                printf("\nError: Process failed to migrate. Destination CPU
(CPU %d) is offline.\n\n",$dest_cpu);
}

/*
 * 6307:    if (task_cpu(p) != src_cpu)
 * 6308:                goto done;
 */

probe kernel.statement("*@kernel/sched.c:6308")
{
                printf("\nTask already migrated to CPU %d\n\n",$dest_cpu);
}

/*
 * 6310:    if (!cpu_isset(dest_cpu, p->cpus_allowed))
 * 6311:               goto fail;
 */

probe kernel.statement("*@kernel/sched.c:6311")
{
                printf("\nError: Process failed to migrate to CPU %d. CPU
affinity of current task has changed.",$dest_cpu);
}

/*
 *  6317: set_task_cpu(p, dest_cpu);
 */

probe kernel.statement("*@kernel/sched.c:6317")
{
                printf("\nSuccess: Task successfully migrated\n\n");
}
-- 
View this message in context: http://www.nabble.com/Help-required-with-a-script-tp21418350p21418350.html
Sent from the Sourceware - systemtap mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Help required with a script
  2009-01-12 16:49 Help required with a script beginner966
@ 2009-01-12 19:09 ` Frank Ch. Eigler
  2009-01-12 19:33   ` beginner966
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Ch. Eigler @ 2009-01-12 19:09 UTC (permalink / raw)
  To: beginner966; +Cc: systemtap

beginner966 <nitin966@gmail.com> writes:

> [...]  This is the script which I had written to gather information
> on migration of task to other CPU. I also wanted to report the
> appropriate errors, so I had used 4 kernel.statement probes. But the
> problem is that all 4 kernel.statement probes get executed
> simultaneously, which should not happen according to the original
> code. [...]

I suspect we're getting hurt by the statement placement heuristics
that allow a slight fuzz in line numbers if there is no exact match in
the debugging info.  Could you run again with --vp 02 to see what PC
values the various .statement probes end up mapping to?


- FChE

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Help required with a script
  2009-01-12 19:09 ` Frank Ch. Eigler
@ 2009-01-12 19:33   ` beginner966
  0 siblings, 0 replies; 3+ messages in thread
From: beginner966 @ 2009-01-12 19:33 UTC (permalink / raw)
  To: systemtap


Hi Frank,
Rightly said by you. They do not map to their actual line numbers.


kernel.statement("__migrate_task@kernel/sched.c:6302") /* pc=_stext+0x1995f
*/ /* <- kernel.statement("*@kernel/sched.c:6294") */
printf("\\nError: Process failed to migrate. Destination CPU (CPU %d) is
offline.\\n\\n", _dwarf_tvar_get_dest_cpu_2())
kernel.statement("__migrate_task@kernel/sched.c:6310") /* pc=_stext+0x1997f
*/ /* <- kernel.statement("*@kernel/sched.c:6308") */
printf("\\nTask already migrated to CPU %d\\n\\n",
_dwarf_tvar_get_dest_cpu_4())
kernel.statement("__migrate_task@kernel/sched.c:6313") /* pc=_stext+0x1998b
*/ /* <- kernel.statement("*@kernel/sched.c:6311") */
printf("\\nError: Process failed to migrate to CPU %d. CPU affinity of
current task has changed.", _dwarf_tvar_get_dest_cpu_4())
kernel.statement("__migrate_task@kernel/sched.c:6317") /* pc=_stext+0x1999e
*/ /* <- kernel.statement("*@kernel/sched.c:6317") */
printf("\\nSuccess: Task successfully migrated\\n\\n")


And I found something interesting out of it that, when I try to put a
.statement on a line number, which has a jump/return statement, then it
doesn't map properly in my case. It maps to some line number ahead of the
one actually mentioned.
What could be the issue ?
Frank Ch. Eigler wrote:
> 
> beginner966 <nitin966@gmail.com> writes:
> 
>> [...]  This is the script which I had written to gather information
>> on migration of task to other CPU. I also wanted to report the
>> appropriate errors, so I had used 4 kernel.statement probes. But the
>> problem is that all 4 kernel.statement probes get executed
>> simultaneously, which should not happen according to the original
>> code. [...]
> 
> I suspect we're getting hurt by the statement placement heuristics
> that allow a slight fuzz in line numbers if there is no exact match in
> the debugging info.  Could you run again with --vp 02 to see what PC
> values the various .statement probes end up mapping to?
> 
> 
> - FChE
> 
> 
Quoted from: 
http://www.nabble.com/Help-required-with-a-script-tp21418350p21421478.html


Frank Ch. Eigler wrote:
> 
> beginner966 <nitin966@gmail.com> writes:
> 
>> [...]  This is the script which I had written to gather information
>> on migration of task to other CPU. I also wanted to report the
>> appropriate errors, so I had used 4 kernel.statement probes. But the
>> problem is that all 4 kernel.statement probes get executed
>> simultaneously, which should not happen according to the original
>> code. [...]
> 
> I suspect we're getting hurt by the statement placement heuristics
> that allow a slight fuzz in line numbers if there is no exact match in
> the debugging info.  Could you run again with --vp 02 to see what PC
> values the various .statement probes end up mapping to?
> 
> 
> - FChE
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-required-with-a-script-tp21418350p21421954.html
Sent from the Sourceware - systemtap mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-12 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-12 16:49 Help required with a script beginner966
2009-01-12 19:09 ` Frank Ch. Eigler
2009-01-12 19:33   ` beginner966

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