From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21983 invoked by alias); 23 Oct 2009 17:36:14 -0000 Received: (qmail 21974 invoked by uid 22791); 23 Oct 2009 17:36:13 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_SUB_OBFU_Q0,SARE_SUB_OBFU_Q1 X-Spam-Check-By: sourceware.org Received: from e28smtp07.in.ibm.com (HELO e28smtp07.in.ibm.com) (59.145.155.7) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 23 Oct 2009 17:36:08 +0000 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp07.in.ibm.com (8.14.3/8.13.1) with ESMTP id n9NHa3Tn014741 for ; Fri, 23 Oct 2009 23:06:03 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n9NHa3Kj2687164 for ; Fri, 23 Oct 2009 23:06:03 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id n9NHa3of003529 for ; Fri, 23 Oct 2009 23:06:03 +0530 Received: from [9.77.199.221] ([9.77.199.221]) by d28av01.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id n9NHa2EX003494 for ; Fri, 23 Oct 2009 23:06:02 +0530 Message-ID: <4AE1E981.9050002@linux.vnet.ibm.com> Date: Fri, 23 Oct 2009 17:36:00 -0000 From: Prerna Saxena User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 MIME-Version: 1.0 To: systemtap@sourceware.org Subject: Tapset for probing IRQs, workqueues, etc Content-Type: multipart/mixed; boundary="------------020504010601010201090802" X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00272.txt.bz2 This is a multi-part message in MIME format. --------------020504010601010201090802 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 474 Hi, Attached is a tracepoint based tapset for probing IRQ handlers, softirqs, and workqueue operations. Of these, softirqs and irq handler based probes cannot have kprobe equivalents, 'cos of the kprobe blacklist. And the position of tracepoints for workqueues makes it difficult to define a kprobe fallback for most of these probes. Looking fwd to feedback to improve it.. -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India --------------020504010601010201090802 Content-Type: text/plain; name="irq-patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="irq-patch" Content-length: 7198 Index: stap-git-Oct-01/tapset/irq.stp =================================================================== --- /dev/null +++ stap-git-Oct-01/tapset/irq.stp @@ -0,0 +1,160 @@ +/* + * Tracepoint based tapset for IRQs, Workqueues, etc + * + */ +// Probes for workqueues. + +/* probe workqueue.create : probes creation of a new workqueue + * Variables : + * wq_thread : task_struct of the workqueue thread. + * cpu : cpu for which the worker thread is created. + */ +probe workqueue.create = kernel.trace("workqueue_creation") +{ + wq_thread = $wq_thread + cpu = $cpu +} + +/* probe workqueue.insert : probes queuing of work on a workqueue + * Variables : + * wq_thread : task_struct of the workqueue thread. + * work : work_struct* being queued. + * work_func : pointer to handler func. + */ +probe workqueue.insert = kernel.trace("workqueue_insertion") +{ + wq_thread = $wq_thread + work = $work + work_func = @cast(work, "work_struct", "kernel")->func +} + +/* probe workqueue.execute : probes execution of deferred work. + * Variables : + * wq_thread : task_struct of the workqueue thread. + * work : work_struct* being executed. + * work_func : pointer to handler func. + */ +probe workqueue.execute = kernel.trace("workqueue_execution") +{ + wq_thread = $wq_thread + work = $work + work_func = @cast(work, "work_struct", "kernel")->func +} + +/* probe workqueue.destroy : probes destruction of each worker thread of each cpu for a workqueue. + * Variables : + * wq_thread : task_struct of the workqueue thread. + */ +probe workqueue.destroy = kernel.trace("workqueue_destruction") +{ + wq_thread = $wq_thread +} + +// Probes for IRQ handlers. + +/* probe irq_handler.entry : Fires prior to execution of interrupt handler. + * variables : + * irq : irq number. + * action : struct irqaction* for this interrupt num. + * handler : interrupt handler function. + * flags : + * IRQF_DISABLED [0x00000020] : keep irqs disabled when calling action handler. + * IRQF_SAMPLE_RANDOM [0x00000040] : irq is used to feed the random generator + * IRQF_SHARED [0x00000080] : allow sharing the irq among several devices + * IRQF_PROBE_SHARED [0x00000100] : set by callers when they expect sharing mismatches to occur + * IRQF_TIMER [0x00000200] : Flag to mark this interrupt as timer interrupt + * IRQF_PERCPU [0x00000400] : Interrupt is per cpu. + * IRQF_NOBALANCING [0x00000800] : Flag to exclude this interrupt from irq balancing + * IRQF_IRQPOLL [0x00001000] : Interrupt is used for polling. + * IRQF_ONESHOT [0x00002000] : Interrupt is not reenabled after the hardirq handler finished. + * dev_name: name of device. + * dev_id : Cookie to identify device. + * next_irqaction : pointer to next irqaction for shared interrupts. + * dir : pointer to the proc/irq/NN/name entry + * thread_fn: interupt handler function for threaded interrupts. + * thread : thread pointer for threaded interrupts. + * thread_flags: Flags related to thread. + */ +probe irq_handler.entry = kernel.trace("irq_handler_entry") +{ + irq = $irq + action = $action + handler = @cast($action, "irqaction", "kernel")->handler + flags = @cast($action, "irqaction", "kernel")->flags + dev_name = @cast($action, "irqaction", "kernel")->name + dev_id = @cast($action, "irqaction", "kernel")->dev_id + next_irqaction = @cast($action, "irqaction", "kernel")->next + dir = @cast($action, "irqaction", "kernel")->dir + thread_fn = @cast($action, "irqaction", "kernel")->thread_fn + thread = @cast($action, "irqaction", "kernel")->thread + thread_flags = @cast($action, "irqaction", "kernel")->thread_flags +} + +/* probe irq_handler.exit : Fires just after execution of interrupt handler. + * variables : + * irq : interrupt number + * action : struct irqaction* + * ret : return value of the handler + * handler : interrupt handler function that was executed. + * flags : + * IRQF_DISABLED [0x00000020] : keep irqs disabled when calling action handler. + * IRQF_SAMPLE_RANDOM [0x00000040] : irq is used to feed the random generator + * IRQF_SHARED [0x00000080] : allow sharing the irq among several devices + * IRQF_PROBE_SHARED [0x00000100] : set by callers when they expect sharing mismatches to occur + * IRQF_TIMER [0x00000200] : Flag to mark this interrupt as timer interrupt + * IRQF_PERCPU [0x00000400] : Interrupt is per cpu. + * IRQF_NOBALANCING [0x00000800] : Flag to exclude this interrupt from irq balancing + * IRQF_IRQPOLL [0x00001000] : Interrupt is used for polling. + * IRQF_ONESHOT [0x00002000] : Interrupt is not reenabled after the hardirq handler finished. + * dev_name: name of device. + * dev_id : Cookie to identify device. + * next_irqaction : pointer to next irqaction for shared interrupts. + * dir : pointer to the proc/irq/NN/name entry + * thread_fn: interupt handler function for threaded interrupts. + * thread : thread pointer for threaded interrupts. + * thread_flags: Flags related to thread. + */ +probe irq_handler.exit = kernel.trace("irq_handler_exit") +{ + irq = $irq + action = $action + ret = $ret + handler = @cast($action, "irqaction", "kernel")->handler + flags = @cast($action, "irqaction", "kernel")->flags + dev_name = @cast($action, "irqaction", "kernel")->name + dev_id = @cast($action, "irqaction", "kernel")->dev_id + next_irqaction = @cast($action, "irqaction", "kernel")->next + dir = @cast($action, "irqaction", "kernel")->dir + thread_fn = @cast($action, "irqaction", "kernel")->thread_fn + thread = @cast($action, "irqaction", "kernel")->thread + thread_flags = @cast($action, "irqaction", "kernel")->thread_flags +} + +// Softirq based probes. +/* probe softirq.entry : triggered just before executing handler for a pending + * softirq + * variables : + * h : struct softirq_action* for current pending softirq. + * vec : softirq_action vector. + * action : pointer to softirq handler just about to execute. + */ +probe softirq.entry = kernel.trace("softirq_entry") +{ + h = $h + vec = $vec + action = @cast($h, "softirq_action", "kernel")->action +} + +/* probe softirq.exit : triggered just after executing handler for a pending + * softirq. + * variables : + * h : struct softirq_action* for just executed softirq. + * vec : softirq_action vector. + * action : pointer to softirq handler that just finished execution. + */ +probe softirq.exit = kernel.trace("softirq_exit") +{ + h = $h + vec = $vec + action = @cast($h, "softirq_action", "kernel")->action +} Index: stap-git-Oct-01/tapset/aux_syscalls.stp =================================================================== --- stap-git-Oct-01.orig/tapset/aux_syscalls.stp +++ stap-git-Oct-01/tapset/aux_syscalls.stp @@ -1831,3 +1831,24 @@ function _struct_sigaction32_u:string(ua } #endif %} + +%{ +#include +static const _stp_val_array const _stp_irq_list[] = { + V(IRQF_DISABLED), + V(IRQF_SAMPLE_RANDOM), + V(IRQF_SHARED), + V(IRQF_PROBE_SHARED), + V(IRQF_TIMER), + V(IRQF_PERCPU), + V(IRQF_NOBALANCING), + V(IRQF_IRQPOLL), + V(IRQF_ONESHOT), + {0, NULL} +}; +%} + +function _irqflags_str:string(f:long) +%{ /* pure */ + _stp_lookup_or_str(_stp_irq_list, THIS->f, THIS->__retvalue, MAXSTRINGLEN); +%} --------------020504010601010201090802--