public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Systemtap probe for Signals
@ 2006-07-04  8:31 Manoj S Pattabhiraman
  2006-07-04  9:28 ` Li Guanglei
  0 siblings, 1 reply; 5+ messages in thread
From: Manoj S Pattabhiraman @ 2006-07-04  8:31 UTC (permalink / raw)
  To: systemtap

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

Hi,

I just started of with trying systemtap by probing on signal handling.
Those probes are now consolidated under signal.stp.

(See attached file: signal.stp)

Please lemme know your suggestions on the same and how to go forward.

Thanks & Regards,    Manoj
-------------------------------------------------------------------
Manoj S Pattabhiraman, e-mail: mpattabh@in.ibm.com

[-- Attachment #2: signal.stp --]
[-- Type: application/octet-stream, Size: 2744 bytes --]

// Signal tapset
// Copyright (C) 2006 IBM Corp.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.

/*   Note : Since there are so many signals sent to processesat any give point, Its better to filter the
 *          the information according to the requirements. for example, filter only for a particular
 *          signal (if sig==2)  or filter only for a particular process ( if pid_name==stap )
*/

/* probe signal.sendsig
 *
 * Fires when a signal is sent to a process.
 * 
 */

 probe signal.sendsig = kernel.function("send_signal")
 {   
	sig=$sig
        sinfo = $info
	sig_pid = $t->pid
	pid_name = kernel_string($t->comm)
	
	if (sinfo == 2)
		si_code ="SIGSTOP or SIGKILL" 
	else if (sinfo > 0) 
		si_code="SI_KERNEL (SIGFPE, SIGSEGV, SIGTRAP, SIGCHLD, SIGPOLL)" 
	else if (sinfo <= 0) 
		si_code="SI_USER or SI_TIMER or SI_ASYNCIO" 	
	
	argstr = sprintf( "Signal : %u - Process name : %s (%d) - Signal Code : %s ", sig,sig_pid,pid_name,si_code)
}	

/* probe signal.wakeup
 *
 * Wake up the process for new active signals.
 *
 */

probe signal.wakeup =
        kernel.function("signal_wake_up")
{
   sig_pid = $t->pid
   pid_name = kernel_string($t->comm)
   state   = $resume
   if (state == 0)     {
                sig_state = "TASK_INTERRUPTIBLE"
         } else
                {
                sig_state = "TASK_INTERRUPTIBLE | TASK_STOPPED | TASK_TRACED"
        }
  argstr = sprintf( "Wakeup Signal to Process %s (%d) - Process State after the signal : %s ",pid_name,sig_pid,sig_state)	

}

/* probe signal.ignored
 *
 *  Fires whenever a signal is ignored by a process.
 *
 */

 probe signal.ignored = kernel.function("sig_ignored")
 {
	sig_pid = $t->pid
	pid_name = kernel_string($t->comm) 
	sig_info = $sig
	argstr = sprintf( "Signal : %d is ignored by the Process : %s (%d) ",sig_info,pid_name,sig_pid)

 } 	

/* probe signal.handle_stopsig
 *
 *  Fires when a stop signal is sent to a process.
 *
 */

 probe signal.handle_stopsig = kernel.function("handle_stop_signal")
 {
        sig_pid = $p->pid
        pid_name = kernel_string($p->comm)
        sig_info = $sig
	argstr = sprintf(" Stop Signal %d is sent to the process %s (%d)",sig_info,pid_name,sig_pid);
}

/* probe signal.forcesig
 *
 *  Forces SIGSEV when there are some issues while handling signals for the process.
 * 
 */

probe signal.forcesig = kernel.function("force_sigsegv")
 {
        sig_pid = $p->pid
        pid_name = kernel_string($p->comm)
        sig_info = $sig
        argstr = sprintf("Signal %d is forced on to the process %s (%d)",sig_info,pid_name,sig_pid);
}


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

* Re: Systemtap probe for Signals
  2006-07-04  8:31 Systemtap probe for Signals Manoj S Pattabhiraman
@ 2006-07-04  9:28 ` Li Guanglei
  0 siblings, 0 replies; 5+ messages in thread
From: Li Guanglei @ 2006-07-04  9:28 UTC (permalink / raw)
  To: Manoj S Pattabhiraman; +Cc: systemtap

Manoj S Pattabhiraman ??:
> Hi,
> 
> I just started of with trying systemtap by probing on signal handling.
> Those probes are now consolidated under signal.stp.
> 
> (See attached file: signal.stp)
> 
> Please lemme know your suggestions on the same and how to go forward.
> 
> Thanks & Regards,    Manoj
> -------------------------------------------------------------------
> Manoj S Pattabhiraman, e-mail: mpattabh@in.ibm.com

There are some signal related probes defined in process.stp, they are:
process.signal_send, process.signal_handle, _process.signal_send.part[1-3]

Should we put all signal related probes(excluding signal related 
syscalls) into a separate stp file, say, signal.stp?

some comments of your stp script:

You defined:
  probe signal.sendsig = kernel.function("send_signal")
But should we include kernel.function("send_group_sigqueue") and 
kernel.function("send_sigqueue") into signal.sendsig?

I don't think "probe signal.ignored" matches what it states in the 
comment. It's used to return the status whether a signal has been 
ignored. There is a similar function named is_ignored.

Thanks.

- Guanglei







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

* Re: Systemtap probe for Signals
  2006-07-26  7:13 ` Li Guanglei
@ 2006-07-28  8:05   ` Li Guanglei
  0 siblings, 0 replies; 5+ messages in thread
From: Li Guanglei @ 2006-07-28  8:05 UTC (permalink / raw)
  To: systemtap; +Cc: Manoj S Pattabhiraman

Hi,

  Beside the probe points in your tapset, I'd like to probe the 
following signal related kernel functions:

  1. do_sigpending
     It is used to suspend signals. Called by sys_rt_sigpending and 
sys_sigpending

  2. handle_signal
     It is called when the kernel want to invoke the signal handlers. 
Called by do_signal.

  3. do_sigaction
     It is called by sys_sigaction, compat_sys_rt_sigaction, 
compat_sys_rt_sigaction, sys_rt_sigaction, sys_signal. It is 
corresponding to the signal() and sigaction() calles from use app.

  4. sigprocmask
     It is called by sys_sigprocmask, sys_rt_sigprocmask.

   And I found you put a point on sig_ignored. But I don't think 
sig_ignored is used to ignore a signal. It is only used to check 
whether or not a signal has been ignored.

   And another comment is about signal.sendsig and 
signal.send_sig_queue. The difference between send_signal and 
send*sigqueue is that send_signal will alloc a sigqueue before adding 
a signal into that queue. But their intention are almost the same: 
sending a signal to a process. I am not sure whether we could combine 
them into one probe or leave it unchanged.

- Guanglei


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

* Re: Systemtap probe for Signals
       [not found] <OF5B05ABF6.75FEE7A3-ON652571A1.003C3F54-652571A1.003C19A3@in.ibm.com>
  2006-07-04 13:01 ` Li Guanglei
@ 2006-07-26  7:13 ` Li Guanglei
  2006-07-28  8:05   ` Li Guanglei
  1 sibling, 1 reply; 5+ messages in thread
From: Li Guanglei @ 2006-07-26  7:13 UTC (permalink / raw)
  To: Manoj S Pattabhiraman, systemtap

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

Hi,
   I help Manoj to forward his mail since he had trouble of posting 
onto SystemTap mailinglist.

--->>
Hi,

Find below the updated tapset for signal subsystem. Please lemme know 
your suggestions on the same.



Thanks & Regards,    Manoj
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Manoj S Pattabhiraman, ADTools, Linux on zSeries, Ph : +91 80 51776449 
T/L  92 46951, e-mail: mpattabh@in.ibm.com


Manoj S Pattabhiraman ??:
> 
>  > Hi,
>  >
>  > I just started of with trying systemtap by probing on signal handling.
>  > Those probes are now consolidated under signal.stp.
>  >
>  > (See attached file: signal.stp)
>  >
>  > Please lemme know your suggestions on the same and how to go forward.
>  >
>  > Thanks & Regards,    Manoj
>  > -------------------------------------------------------------------
>  > Manoj S Pattabhiraman, e-mail: mpattabh@in.ibm.com
> 
>  > There are some signal related probes defined in process.stp, they are:
>  > process.signal_send, process.signal_handle, 
> _process.signal_send.part[1-3]
>  >
>  > Should we put all signal related probes(excluding signal related
>  > syscalls) into a separate stp file, say, signal.stp?
>        
>  I wish it would be better to have a separate stp file for signal 
> subsystem.        
>  
>  > some comments of your stp script:
>  
>  > You defined:
>  >   probe signal.sendsig = kernel.function("send_signal")
>  > But should we include kernel.function("send_group_sigqueue") and
>  > kernel.function("send_sigqueue") into signal.sendsig?
> 
> Looking at these functions, will let you know.
> 
>  > I don't think "probe signal.ignored" matches what it states in the
>  > comment. It's used to return the status whether a signal has been
>  > ignored. There is a similar function named is_ignored.
> 
> Accepted. I would rather add a return probe point for the above 
> mentioned function. Is that fine.
> 
> Thanks
> 
> Manoj


[-- Attachment #2: signal.stp --]
[-- Type: text/plain, Size: 5059 bytes --]

// Signal tapset
// Copyright (C) 2006 IBM Corp.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
//
//   Note : Since there are so many signals sent to processes at any give point, Its better to filter the
//          the information according to the requirements. for example, filter only for a particular
//          signal (if sig==2)  or filter only for a particular process ( if pid_name==stap )
//

/* probe signal.sendsig
 *
 * Fires when a signal is sent to a process.
 * 
 */

 probe signal.sendsig = kernel.function("send_signal")
 {   
	sig=$sig
 	sig_name = _signal_name($sig)
	sinfo = $info
	sig_pid = $t->pid
	pid_name = kernel_string($t->comm)
	
	if (sinfo == 2)
		si_code ="SIGSTOP or SIGKILL" 
	else if (sinfo > 0) 
		si_code="SI_KERNEL (SIGFPE, SIGSEGV, SIGTRAP, SIGCHLD, SIGPOLL)" 
	else if (sinfo <= 0) 
		si_code="SI_USER or SI_TIMER or SI_ASYNCIO" 	
	
	argstr = sprintf( "Signal : %s - Process name : %s (%d) - Signal Code : %s ", sig_name,sig_pid,pid_name,si_code)
}	

/* probe signal.wakeup
 *
 * Wake up the process for new active signals.
 *
 */

probe signal.wakeup =
        kernel.function("signal_wake_up")
{
   sig_pid = $t->pid
   pid_name = kernel_string($t->comm)
   state   = $resume
   if (state == 0)     {
                sig_state = "TASK_INTERRUPTIBLE"
         } else
                {
                sig_state = "TASK_INTERRUPTIBLE | TASK_STOPPED | TASK_TRACED"
        }
  argstr = sprintf( "Wakeup Signal to Process %s (%d) - Process State after the signal : %s ",pid_name,sig_pid,sig_state)	
}

/* probe signal.ignored
 *
 *  Fires whenever a signal is ignored by a process.
 *
 */

probe signal.ignored = kernel.function("sig_ignored")
 {
	sig_pid = $t->pid
	pid_name = kernel_string($t->comm) 
	sig_info = $sig
	sig_name = _signal_name($sig)
	argstr = sprintf( "Signal : %s is ignored by the Process : %s (%d) ",sig_name,pid_name,sig_pid)
 } 	

probe signal.ignored.return = kernel.function("sig_ignored").return 
{
        name = "sig_ignored"
        retstr = returnstr(1)
}

/* probe signal.handle_stopsig
 *
 *  Fires when a stop signal is sent to a process.
 *
 */

 probe signal.handle_stopsig = kernel.function("handle_stop_signal")
 {
        sig_pid = $p->pid
        pid_name = kernel_string($p->comm)
        sig_info = $sig
	sig_name = _signal_name($sig)
	argstr = sprintf(" Handle_Stop_Signal : %s is sent to the process %s (%d)",sig_name,pid_name,sig_pid);
}

/* probe signal.forcesig
 *
 *  Forces SIGSEV when there are some issues while handling signals for the process.
 * 
 */

probe signal.forcesig = kernel.function("force_sigsegv")
 {
        sig_pid = $p->pid
        pid_name = kernel_string($p->comm)
        sig_info = $sig
	sig_name = _signal_name($sig)
        argstr = sprintf("Signal < %d > is forced on to the process %s (%d)",sig_name,pid_name,sig_pid);
}

probe signal.forcesig.return = kernel.function("force_sigsegv").return
{
        name = "force_sigsegv"
        retstr = returnstr(1)
}

/* probe signal.syskill
 *
 *  To kill a process, Pass the pid and signal to kill the process.
 *
 */

probe signal.syskill = kernel.function("sys_kill")
 {
        sig_pid = $pid
        sig_info = $sig
        argstr = sprintf("Process %d has recieved a Signal %s ",sig_pid,sig_name);
}

probe signal.syskill.return = kernel.function("sys_kill").return
{
        name = "sys_kill"
        retstr = returnstr(1)
}

/* probe signal.sys_tgkill
 *
 *  Sends a signal to one specific thread.
 *
 */

probe signal.systgkill = kernel.function("sys_tgkill")
 {
	sig_tgid = $tgid
        sig_pid = $pid
        sig_info = $sig
	sig_name = _signal_name($sig)
        argstr = sprintf(" Signal %s is sent to Process ID : %d under the Thread Group ID : %d",sig_name,sig_pid,sig_tgid);
}

probe signal.systgkill.return = kernel.function("sys_tgkill").return
{
        name = "sys_tgkill"
        retstr = returnstr(1)
}


/* probe signal.sys_tkill
 *
 *  Sends a signal to one specific task.
 *
 */

probe signal.systkill = kernel.function("sys_tkill")
 {
        sig_pid = $pid
        sig_info = $sig
	sig_name = _signal_name($sig)
        argstr = sprintf("Signal %s is sent to Process ID : %d ",sig_name,sig_pid);
}

probe signal.systkill.return = kernel.function("sys_tkill").return
{
        name = "sys_tkill"
        retstr = returnstr(1)
}

/* probe signal.send_sig_queue
 * 
 * Queue signal to a process.
 * 
 */
probe signal.send_sig_queue =
        kernel.function("send_sigqueue"),
        kernel.function("send_group_sigqueue")
{
    sig_info = $sig
    sig_name = _signal_name($sig)	
    sig_pid = $p->pid
    pid_name = kernel_string($p->comm)
    user_id = $q->uid
    nos_process = $q->processes
    nos_pending_sig = $q->sigpending			
}

probe signal.send_sig_queue.return = 
	kernel.function("send_sigqueue").return,
	kernel.function("send_group_sigqueue").return
{
        retstr = returnstr(1)
}



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

* Re: Systemtap probe for Signals
       [not found] <OF5B05ABF6.75FEE7A3-ON652571A1.003C3F54-652571A1.003C19A3@in.ibm.com>
@ 2006-07-04 13:01 ` Li Guanglei
  2006-07-26  7:13 ` Li Guanglei
  1 sibling, 0 replies; 5+ messages in thread
From: Li Guanglei @ 2006-07-04 13:01 UTC (permalink / raw)
  To: Manoj S Pattabhiraman; +Cc: systemtap

Manoj S Pattabhiraman ??:
> 
>  I wish it would be better to have a separate stp file for signal 
> subsystem.        
So do I.

>  > I don't think "probe signal.ignored" [...]
> Accepted. I would rather add a return probe point for the above 
> mentioned function. Is that fine.
Yes, a return probe is necessary
> 
> Thanks
> 
> Manoj

- Guanglei

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

end of thread, other threads:[~2006-07-28  8:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-04  8:31 Systemtap probe for Signals Manoj S Pattabhiraman
2006-07-04  9:28 ` Li Guanglei
     [not found] <OF5B05ABF6.75FEE7A3-ON652571A1.003C3F54-652571A1.003C19A3@in.ibm.com>
2006-07-04 13:01 ` Li Guanglei
2006-07-26  7:13 ` Li Guanglei
2006-07-28  8:05   ` Li Guanglei

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