diff options
author | Dave Brolley <brolley@redhat.com> | 2009-11-09 14:59:45 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-11-09 14:59:45 -0500 |
commit | 52cd76fae6eee285a4d8345ee595f0b8a2907d7b (patch) | |
tree | c25ea6497334a08c1762b25b72565dd4b8a8baf8 | |
parent | 64211010978d0e35c80ec7c119f1986a48f97543 (diff) | |
parent | dd905cf4dd14d5d53d0bc3696acaba04bda57bb5 (diff) | |
download | systemtap-steved-52cd76fae6eee285a4d8345ee595f0b8a2907d7b.tar.gz systemtap-steved-52cd76fae6eee285a4d8345ee595f0b8a2907d7b.tar.xz systemtap-steved-52cd76fae6eee285a4d8345ee595f0b8a2907d7b.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
-rw-r--r-- | dwflpp.cxx | 4 | ||||
-rw-r--r-- | man/stapprobes.irq.3stap | 155 | ||||
-rw-r--r-- | man/stapprobes.irq.3stap.in | 155 | ||||
-rw-r--r-- | runtime/runtime.h | 11 | ||||
-rw-r--r-- | tapset/irq.stp | 172 | ||||
-rw-r--r-- | tapset/nfs.stp | 299 | ||||
-rw-r--r-- | tapsets.cxx | 20 | ||||
-rw-r--r-- | testsuite/buildok/irq.stp | 7 | ||||
-rw-r--r-- | testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp | 31 |
9 files changed, 702 insertions, 152 deletions
@@ -2748,7 +2748,7 @@ dwflpp::get_cfa_ops (Dwarf_Addr pc) if (sess.verbose > 3) clog << "got dwarf cfi bias: 0x" << hex << bias << dec << endl; Dwarf_Frame *frame = NULL; - if (dwarf_cfi_addrframe (cfi, pc - bias, &frame) == 0) + if (dwarf_cfi_addrframe (cfi, pc, &frame) == 0) dwarf_frame_cfa (frame, &cfa_ops, &cfa_nops); else if (sess.verbose > 3) clog << "dwarf_cfi_addrframe failed: " << dwarf_errmsg(-1) << endl; @@ -2764,7 +2764,7 @@ dwflpp::get_cfa_ops (Dwarf_Addr pc) if (sess.verbose > 3) clog << "got eh cfi bias: 0x" << hex << bias << dec << endl; Dwarf_Frame *frame = NULL; - if (dwarf_cfi_addrframe (cfi, pc - bias, &frame) == 0) + if (dwarf_cfi_addrframe (cfi, pc, &frame) == 0) dwarf_frame_cfa (frame, &cfa_ops, &cfa_nops); else if (sess.verbose > 3) clog << "dwarf_cfi_addrframe failed: " << dwarf_errmsg(-1) << endl; diff --git a/man/stapprobes.irq.3stap b/man/stapprobes.irq.3stap new file mode 100644 index 00000000..b5315c86 --- /dev/null +++ b/man/stapprobes.irq.3stap @@ -0,0 +1,155 @@ +.\" -*- nroff -*- +.TH STAPPROBES.SNMP 3stap 2009-05-11 "IBM" +.SH NAME +stapprobes.irq \- Systemtap probes for IRQ, workqueue,etc + +.\" macros +.de SAMPLE +.br +.RS +.nf +.nh +.. +.de ESAMPLE +.hy +.fi +.RE +.. + +.SH DESCRIPTION + +Probe points for probing irq handler execution, softirqs, workqueues,etc + +.P +.TP +.B workqueue.create +probes creation of a new workqueue + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I cpu + cpu for which the worker thread is created. + +.P +.TP +.B workqueue.insert +probes queuing of work on a workqueue. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I work + work_struct* being executed. +.I work_func + pointer to handler func. + +.P +.TP +.B workqueue.execute +probes execution of deferred work. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I work + work_struct* being executed. +.I work_func + pointer to handler func. + +.P +.TP +.B workqueue.destroy +probes destruction of each worker thread of each cpu for a workqueue. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. + +.P +.TP +.B irq_handler.entry +Fires prior to execution of interrupt handler. +.B Arguments: +.I irq + irq number +.I action + struct irqaction* for this interrupt number +.I handler + interrupt handler function +.I flags + flags for this irq. +.I flags_str + A formatted string of flags. +.I dev_name + name of device +.I dev_id + cookie to identify device +.I next_irqaction + pointer to next irqaction for shared interrupts +.I dir + pointer to the /proc/irq/NN/name entry +.I thread_fn + interrupt handler function for threaded interrupts +.I thread + thread pointer for threaded interrupts +.I thread_flags + flags related to thread + +.P +.TP +.B irq_handler.exit +Fires post execution of interrupt handler. +.B Arguments: +.I irq + irq number +.I action + struct irqaction* for this interrupt number +.I ret + return value from interrupt handler that just executed. +.I handler + interrupt handler function +.I flags + flags for this irq. +.I flags_str + A formatted string of flags. +.I dev_name + name of device +.I dev_id + cookie to identify device +.I next_irqaction + pointer to next irqaction for shared interrupts +.I dir +.I thread_fn + interrupt handler function for threaded interrupts +.I thread + thread pointer for threaded interrupts +.I thread_flags + flags related to thread + +.P +.TP +.B softirq.entry +triggered just before executing handler for a pending softirq +.I h + struct softirq* for current pending softirq. +.I vec + softirq_action vector +.I action + pointer to softirq handler just about to execute. + +.P +.TP +.B softirq.exit +triggered just after executing handler for a pending softirq +.I h + struct softirq* for just executed softirq. +.I vec + softirq_action vector +.I action + pointer to softirq handler that just finished execution. + +.SH SEE ALSO +.IR stap (1), +.IR stapprobes (3stap) + diff --git a/man/stapprobes.irq.3stap.in b/man/stapprobes.irq.3stap.in new file mode 100644 index 00000000..84eaab16 --- /dev/null +++ b/man/stapprobes.irq.3stap.in @@ -0,0 +1,155 @@ +.\" -*- nroff -*- +.TH STAPPROBES.SNMP 3stap @DATE@ "IBM" +.SH NAME +stapprobes.irq \- Systemtap probes for IRQ, workqueue,etc + +.\" macros +.de SAMPLE +.br +.RS +.nf +.nh +.. +.de ESAMPLE +.hy +.fi +.RE +.. + +.SH DESCRIPTION + +Probe points for probing irq handler execution, softirqs, workqueues,etc + +.P +.TP +.B workqueue.create +probes creation of a new workqueue + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I cpu + cpu for which the worker thread is created. + +.P +.TP +.B workqueue.insert +probes queuing of work on a workqueue. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I work + work_struct* being executed. +.I work_func + pointer to handler func. + +.P +.TP +.B workqueue.execute +probes execution of deferred work. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I work + work_struct* being executed. +.I work_func + pointer to handler func. + +.P +.TP +.B workqueue.destroy +probes destruction of each worker thread of each cpu for a workqueue. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. + +.P +.TP +.B irq_handler.entry +Fires prior to execution of interrupt handler. +.B Arguments: +.I irq + irq number +.I action + struct irqaction* for this interrupt number +.I handler + interrupt handler function +.I flags + flags for this irq. +.I flags_str + A formatted string of flags. +.I dev_name + name of device +.I dev_id + cookie to identify device +.I next_irqaction + pointer to next irqaction for shared interrupts +.I dir + pointer to the /proc/irq/NN/name entry +.I thread_fn + interrupt handler function for threaded interrupts +.I thread + thread pointer for threaded interrupts +.I thread_flags + flags related to thread + +.P +.TP +.B irq_handler.exit +Fires post execution of interrupt handler. +.B Arguments: +.I irq + irq number +.I action + struct irqaction* for this interrupt number +.I ret + return value from interrupt handler that just executed. +.I handler + interrupt handler function +.I flags + flags for this irq. +.I flags_str + A formatted string of flags. +.I dev_name + name of device +.I dev_id + cookie to identify device +.I next_irqaction + pointer to next irqaction for shared interrupts +.I dir + pointer to the /proc/irq/NN/name entry +.I thread_fn + interrupt handler function for threaded interrupts +.I thread + thread pointer for threaded interrupts +.I thread_flags + flags related to thread + +.P +.TP +.B softirq.entry +triggered just before executing handler for a pending softirq +.I h + struct softirq* for current pending softirq. +.I vec + softirq_action vector +.I action + pointer to softirq handler just about to execute. + +.P +.TP +.B softirq.exit +triggered just after executing handler for a pending softirq +.I h + struct softirq* for just executed softirq. +.I vec + softirq_action vector +.I action + pointer to softirq handler that just finished execution. + +.SH SEE ALSO +.IR stap (1), +.IR stapprobes (3stap) diff --git a/runtime/runtime.h b/runtime/runtime.h index a95627ae..ba583aeb 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -179,6 +179,17 @@ void cleanup_module(void) _stp_transport_close(); } +#define pseudo_atomic_cmpxchg(v, old, new) ({\ + int ret;\ + unsigned long flags;\ + local_irq_save(flags);\ + ret = atomic_read(v);\ + if (likely(ret == old))\ + atomic_set(v, new);\ + local_irq_restore(flags);\ + ret; }) + + MODULE_LICENSE("GPL"); #endif /* _RUNTIME_H_ */ diff --git a/tapset/irq.stp b/tapset/irq.stp new file mode 100644 index 00000000..6a9b9147 --- /dev/null +++ b/tapset/irq.stp @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2009 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. + * + * Version 1.0 prerna@linux.vnet.ibm.com 2009-10-28 + * + * Tracepoint based tapset for IRQs, Workqueues, etc + * + */ +// Probes for workqueues. + +/** + * probe workqueue.create : probes creation of a new workqueue + * @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 + * @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 = $work->func +} + +/** + * probe workqueue.execute : probes execution of deferred work. + * @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 = $work->func +} + +/** + * probe workqueue.destroy : probes destruction of each worker thread of each cpu for a workqueue. + * @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. + * @irq : irq number. + * @action : struct irqaction* for this interrupt num. + * @handler : interrupt handler function. + * @flags : Flags for IRQ handler + * 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. + * @flags_str : symbolic string representation of IRQ flags. + * @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 = $action->handler + flags = $action->flags + flags_str = irqflags_str(flags) + dev_name = $action->name + dev_id = $action->dev_id + next_irqaction = $action->next + dir = $action->dir + thread_fn = $action->thread_fn + thread = $action->thread + thread_flags = $action->thread_flags +} + +/** + * probe irq_handler.exit : Fires just after execution of interrupt handler. + * @irq : interrupt number + * @action : struct irqaction* + * @ret : return value of the handler + * @handler : interrupt handler function that was executed. + * @flags : flags for IRQ handler + * 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. + * @flags_str : symbolic string representation of IRQ flags. + * @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 = $action->handler + flags = $action->flags + flags_str = irqflags_str(flags) + dev_name = $action->name + dev_id = $action->dev_id + next_irqaction = $action->next + dir = $action->dir + thread_fn = $action->thread_fn + thread = $action->thread + thread_flags = $action->thread_flags +} + +// Softirq based probes. +/** + * probe softirq.entry : triggered just before executing handler + * for a pending softirq. + * @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 = $h->action +} + +/** + * probe softirq.exit : triggered just after executing handler for a pending + * softirq. + * @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 = $h->action +} diff --git a/tapset/nfs.stp b/tapset/nfs.stp index 6752747f..6b7d5eeb 100644 --- a/tapset/nfs.stp +++ b/tapset/nfs.stp @@ -2,6 +2,7 @@ // Copyright (C) 2006-2007 IBM Corp. // Copyright (C) 2007 Intel Corporation. // Copyright (C) 2007 Bull S.A.S +// Copyright (c) 2009 Red Hat Inc. // // 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 @@ -13,53 +14,53 @@ #include <linux/nfs_fs.h> %} -/*Get cache_validity flag from struct inode*/ -function __nfsi_cache_valid:long(inode:long) %{ /* pure */ - struct inode * inode = (struct inode *)(long)(THIS->inode); +/* Get cache_validity flag from struct inode */ +function __nfsi_cache_valid:long (inode:long) %{ /* pure */ + struct inode *inode = (struct inode *)(long)(THIS->inode); - if(inode == NULL) + if (inode == NULL) THIS->__retvalue = -1; else { - struct nfs_inode * nfsi = NFS_I(inode); + struct nfs_inode *nfsi = NFS_I(inode); THIS->__retvalue = kread(&(nfsi->cache_validity)); } CATCH_DEREF_FAULT(); %} -/*Get read_cache_jiffies from struct inode*/ -function __nfsi_rcache_time :long (inode:long) %{ /* pure */ - struct inode * inode = (struct inode *)(long)(THIS->inode); +/* Get read_cache_jiffies from struct inode */ +function __nfsi_rcache_time:long (inode:long) %{ /* pure */ + struct inode *inode = (struct inode *)(long)(THIS->inode); - if(inode == NULL) + if (inode == NULL) THIS->__retvalue = -1; else { - struct nfs_inode * nfsi = NFS_I(inode); + struct nfs_inode *nfsi = NFS_I(inode); THIS->__retvalue = kread(&(nfsi->read_cache_jiffies)); } CATCH_DEREF_FAULT(); %} -/*Get attrtimeo from struct inode*/ +/* Get attrtimeo from struct inode */ function __nfsi_attr_time :long (inode:long) %{ /* pure */ - struct inode * inode = (struct inode *)(long)(THIS->inode); + struct inode *inode = (struct inode *)(long)(THIS->inode); - if(inode == NULL) + if (inode == NULL) THIS->__retvalue = -1; else { - struct nfs_inode * nfsi = NFS_I(inode); + struct nfs_inode *nfsi = NFS_I(inode); THIS->__retvalue = kread(&(nfsi->attrtimeo)); } CATCH_DEREF_FAULT(); %} -/*Get ndirty from struct inode*/ +/* Get ndirty from struct inode */ function __nfsi_ndirty:long (inode:long) %{ /* pure */ - struct inode * inode = (struct inode *)(long)(THIS->inode); + struct inode *inode = (struct inode *)(long)(THIS->inode); - if(inode == NULL) + if (inode == NULL) THIS->__retvalue = -1; else { - struct nfs_inode * nfsi = NFS_I(inode); + struct nfs_inode *nfsi = NFS_I(inode); #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22) THIS->__retvalue = kread(&(nfsi->ndirty)); #else @@ -69,24 +70,24 @@ function __nfsi_ndirty:long (inode:long) %{ /* pure */ CATCH_DEREF_FAULT(); %} -/*Get rsize from struct inode*/ +/* Get rsize from struct inode */ function __nfs_server_rsize:long (inode:long) %{ /* pure */ - struct inode * inode = (struct inode *)(long)(THIS->inode); + struct inode *inode = (struct inode *)(long)(THIS->inode); - if(inode == NULL) + if (inode == NULL) THIS->__retvalue = -1; else { - struct nfs_server * nfs_srv = NFS_SERVER(inode); /* FIXME: deref hazard! */ + struct nfs_server *nfs_srv = NFS_SERVER(inode); /* FIXME: deref hazard! */ THIS->__retvalue = kread(&(nfs_srv->rsize)); } CATCH_DEREF_FAULT(); %} -/*Get version from struct inode*/ +/* Get version from struct inode */ function __nfs_version:long (inode:long) %{ /* pure */ - struct inode * inode = (struct inode *)(long)(THIS->inode); + struct inode *inode = (struct inode *)(long)(THIS->inode); - if(inode == NULL) + if (inode == NULL) THIS->__retvalue = -1; else { const struct nfs_rpc_ops *rpc_ops = NFS_PROTO(inode); /* FIXME: deref hazard! */ @@ -95,47 +96,47 @@ function __nfs_version:long (inode:long) %{ /* pure */ CATCH_DEREF_FAULT(); %} -/*Get wsize from struct inode*/ +/* Get wsize from struct inode */ function __nfs_server_wsize:long (inode:long) %{ /* pure */ - struct inode * inode = (struct inode *)(long)(THIS->inode); + struct inode *inode = (struct inode *)(long)(THIS->inode); - if(inode == NULL) + if (inode == NULL) THIS->__retvalue = -1; else { - struct nfs_server * nfs_srv = NFS_SERVER(inode); /* FIXME: deref hazard! */ + struct nfs_server *nfs_srv = NFS_SERVER(inode); /* FIXME: deref hazard! */ THIS->__retvalue = kread(&(nfs_srv->wsize)); } CATCH_DEREF_FAULT(); %} -/*Get rpages from struct inode*/ +/* Get rpages from struct inode */ function __nfs_rpages:long (inode:long) %{ /* pure */ - struct inode * inode = (struct inode *)(long)(THIS->inode); + struct inode *inode = (struct inode *)(long)(THIS->inode); - if(inode == NULL) + if (inode == NULL) THIS->__retvalue = -1; else { - struct nfs_server * nfs_srv = NFS_SERVER(inode); /* FIXME: deref hazard! */ + struct nfs_server *nfs_srv = NFS_SERVER(inode); /* FIXME: deref hazard! */ THIS->__retvalue = kread(&(nfs_srv->rpages)); } CATCH_DEREF_FAULT(); %} -/*Get wpages from struct inode*/ -function __nfs_wpages:long(inode:long) %{ /* pure */ - struct inode * inode = (struct inode *)(long)(THIS->inode); +/* Get wpages from struct inode */ +function __nfs_wpages:long (inode:long) %{ /* pure */ + struct inode *inode = (struct inode *)(long)(THIS->inode); - if(inode == NULL) + if (inode == NULL) THIS->__retvalue = -1; else { - struct nfs_server * nfs_srv = NFS_SERVER(inode); /* FIXME: deref hazard! */ + struct nfs_server *nfs_srv = NFS_SERVER(inode); /* FIXME: deref hazard! */ THIS->__retvalue = kread(&(nfs_srv->wpages)); } CATCH_DEREF_FAULT(); %} -/*Get struct inode from struct page*/ -function __p2i :long(page:long) +/* Get struct inode from struct page */ +function __p2i :long (page:long) { mapping = page? @cast(page, "page", "kernel:nfs")->mapping : 0 if (mapping == 0) @@ -143,7 +144,7 @@ function __p2i :long(page:long) return @cast(mapping, "address_space", "kernel:nfs")->host } -/*Get i_flags from struct page*/ +/* Get i_flags from struct page */ function __p2i_flag : long (page:long) { host = __p2i(page) @@ -152,7 +153,7 @@ function __p2i_flag : long (page:long) return @cast(host, "inode", "kernel:nfs")->i_flags } -/*Get i_state from struct page*/ +/* Get i_state from struct page */ function __p2i_state :long (page:long) { host = __p2i(page) @@ -161,7 +162,7 @@ function __p2i_state :long (page:long) return @cast(host, "inode", "kernel:nfs")->i_state } -/*Get i_size from struct page*/ +/* Get i_size from struct page */ function __p2i_size :long (page:long) { host = __p2i(page) @@ -170,7 +171,7 @@ function __p2i_size :long (page:long) return @cast(host, "inode", "kernel:nfs")->i_size } -/*Get s_flags from struct page*/ +/* Get s_flags from struct page */ function __p2sb_flag:long (page:long) { host = __p2i(page) @@ -181,7 +182,7 @@ function __p2sb_flag:long (page:long) } function __d_loff_t :long (ppos :long) %{ /* pure */ - loff_t * ppos = (loff_t *) ((long)THIS->ppos); + loff_t *ppos = (loff_t *)((long)THIS->ppos); if (ppos == NULL) THIS->__retvalue = -1; @@ -236,12 +237,14 @@ function __file_parentname:string (file:long) * Combination of generic_segment_checks and iov_length functions * @iov: io vector request * @nr_segs: number of segments in the iovec - * @check_flag: whether to check (0 as iov_length, 1 as generic_segment_checks) - * @access_flags: valid when check_flag >0, type of access: VERIFY_READ - 0 or VERIFY_WRITE - 1 + * @check_flag: whether to check (0 as iov_length, 1 as + * generic_segment_checks) + * @access_flags: valid when check_flag >0, type of access: + * VERIFY_READ - 0 or VERIFY_WRITE - 1 * * @return: number of bytes to write/read -*/ -function __iov_length:long(iov:long, nr_segs:long, check_flag:long, access_flags:long) %{ /* pure */ + */ +function __iov_length:long (iov:long, nr_segs:long, check_flag:long, access_flags:long) %{ /* pure */ unsigned long seg; size_t ret = 0; const struct iovec *iov = (const struct iovec *)(long)THIS->iov; @@ -263,7 +266,7 @@ function __iov_length:long(iov:long, nr_segs:long, check_flag:long, access_flags THIS->__retvalue = -EFAULT; return; } - ret-= iov_len; /* This segment is no good */ + ret -= iov_len; /* This segment is no good */ break; } } @@ -301,9 +304,9 @@ probe nfs.fop.return = nfs.fop.llseek.return, { } -/*probe nfs.fop.llseek +/* probe nfs.fop.llseek * - * Fires when do a llseek operation on nfs,it probes + * Fires when do a llseek operation on nfs, it probes * llseek file operation of nfs * * Arguments: @@ -318,7 +321,7 @@ probe nfs.fop.return = nfs.fop.llseek.return, * SEEK_END * The offset is set to the size of the file plus offset bytes. * -*/ + */ probe nfs.fop.llseek = kernel.function ("nfs_file_llseek") !, module("nfs").function("nfs_file_llseek") { @@ -341,15 +344,16 @@ probe nfs.fop.llseek.return = kernel.function ("nfs_file_llseek").return !, name = "nfs.fop.llseek.return" retstr = sprintf("%d", $return) } -/*probe nfs.fop.read + +/* probe nfs.fop.read * - * Fires when do a read operation on nfs,it probes + * Fires when do a read operation on nfs, it probes * read file operation of nfs * * Arguments: * * -*/ + */ probe nfs.fop.read = vfs.do_sync_read { s_id = __file_id($filp) @@ -362,16 +366,15 @@ probe nfs.fop.read.return = vfs.do_sync_read.return name = "nfs.fop.read.return" } -/*probe nfs.fop.write +/* probe nfs.fop.write * - * Fires when do a write operation on nfs,it probes + * Fires when do a write operation on nfs, it probes * write file operation of nfs * * Arguments: * * -*/ - + */ probe nfs.fop.write = vfs.do_sync_write { s_id = __file_id($filp) @@ -384,7 +387,7 @@ probe nfs.fop.write.return = vfs.do_sync_write.return name = "nfs.fop.write.return" } -/*probe nfs.fop.aio_read +/* probe nfs.fop.aio_read * * It probes aio_read file operation of nfs * @@ -403,7 +406,7 @@ probe nfs.fop.write.return = vfs.do_sync_write.return * We need to revalidate the cached attrs for this inode if * * jiffies - read_cache_jiffies > attrtimeo -*/ + */ probe nfs.fop.aio_read = kernel.function ("nfs_file_read") !, module("nfs").function("nfs_file_read") { @@ -416,7 +419,7 @@ probe nfs.fop.aio_read = kernel.function ("nfs_file_read") !, %( kernel_v >= "2.6.19" %? buf = $iov->iov_base - count = __iov_length($iov,$nr_segs,0,-1) + count = __iov_length($iov, $nr_segs, 0, -1) %: buf = $buf count = $count @@ -432,7 +435,7 @@ probe nfs.fop.aio_read = kernel.function ("nfs_file_read") !, name = "nfs.fop.aio_read" - argstr = sprintf("%p,%d, %d",buf,count, pos) + argstr = sprintf("%p, %d, %d", buf, count, pos) size = count units = "bytes" @@ -451,7 +454,7 @@ probe nfs.fop.aio_read.return = kernel.function ("nfs_file_read").return !, } } -/*probe nfs.fop.aio_write +/* probe nfs.fop.aio_write * * It probes aio_write file operation of nfs * @@ -464,7 +467,7 @@ probe nfs.fop.aio_read.return = kernel.function ("nfs_file_read").return !, * parent_name : parent dir name * file_name : file name * -*/ + */ probe nfs.fop.aio_write = kernel.function("nfs_file_write") !, module("nfs").function("nfs_file_write") { @@ -476,7 +479,7 @@ probe nfs.fop.aio_write = kernel.function("nfs_file_write") !, pos = $pos %( kernel_v >= "2.6.19" %? buf = $iov->iov_base - count = __iov_length($iov,$nr_segs,0,-1) + count = __iov_length($iov, $nr_segs, 0, -1) %: buf = $buf count = $count @@ -492,7 +495,7 @@ probe nfs.fop.aio_write = kernel.function("nfs_file_write") !, units = "bytes" } -probe nfs.fop.aio_write.return = kernel.function("nfs_file_write").return !, +probe nfs.fop.aio_write.return = kernel.function("nfs_file_write").return !, module("nfs").function("nfs_file_write").return { name = "nfs.fop.aio_write.return" @@ -504,7 +507,7 @@ probe nfs.fop.aio_write.return = kernel.function("nfs_file_write").return !, } } -/*probe nfs.fop.mmap +/* probe nfs.fop.mmap * * Fires when do an mmap operation on nfs, * it probes mmap operation of nfs @@ -525,7 +528,7 @@ probe nfs.fop.aio_write.return = kernel.function("nfs_file_write").return !, * We need to revalidate the cached attrs for this inode if * * jiffies - read_cache_jiffies > attrtimeo -*/ + */ probe nfs.fop.mmap = kernel.function("nfs_file_mmap") !, module("nfs").function("nfs_file_mmap") { @@ -556,7 +559,7 @@ probe nfs.fop.mmap.return = kernel.function("nfs_file_mmap").return !, retstr = sprintf("%d", $return) } -/*probe nfs.fop.open +/* probe nfs.fop.open * * Fires when do an open operation on nfs, * it probes open file operation of nfs @@ -567,7 +570,7 @@ probe nfs.fop.mmap.return = kernel.function("nfs_file_mmap").return !, * file_name : file name * flag : file flag * i_size : file length in bytes -*/ + */ probe nfs.fop.open = kernel.function("nfs_file_open") !, module("nfs").function("nfs_file_open") { @@ -582,7 +585,7 @@ probe nfs.fop.open = kernel.function("nfs_file_open") !, i_size = $inode->i_size name = "nfs.fop.open" - argstr = sprintf("%d,%d, %s", flag, ino, filename) + argstr = sprintf("%d, %d, %s", flag, ino, filename) } probe nfs.fop.open.return = kernel.function("nfs_file_open").return !, @@ -592,7 +595,7 @@ probe nfs.fop.open.return = kernel.function("nfs_file_open").return !, retstr = sprintf("%d", $return) } -/*probe nfs.fop.flush +/* probe nfs.fop.flush * * Fires when do a flush file operation on nfs, * it probes flush file operation of nfs @@ -602,7 +605,7 @@ probe nfs.fop.open.return = kernel.function("nfs_file_open").return !, * ino : inode number * mode : file mode * ndirty : number of dirty page -*/ + */ probe nfs.fop.flush = kernel.function("nfs_file_flush") !, module("nfs").function("nfs_file_flush") { @@ -615,17 +618,17 @@ probe nfs.fop.flush = kernel.function("nfs_file_flush") !, ndirty = __nfsi_ndirty(__file_inode($file)) name = "nfs.fop.flush" - argstr = sprintf("%d",ino) + argstr = sprintf("%d", ino) } probe nfs.fop.flush.return = kernel.function("nfs_file_flush").return !, module("nfs").function("nfs_file_flush").return { name = "nfs.fop.flush.return" - retstr = sprintf("%d",$return) + retstr = sprintf("%d", $return) } -/*probe nfs.fop.release +/* probe nfs.fop.release * * Fires when do a release page operation on nfs, * it probes release file operation of nfs @@ -634,7 +637,7 @@ probe nfs.fop.flush.return = kernel.function("nfs_file_flush").return !, * dev : device identifier * ino : inode number * mode : file mode -*/ + */ probe nfs.fop.release = kernel.function("nfs_file_release") !, module("nfs").function("nfs_file_release") { @@ -646,7 +649,7 @@ probe nfs.fop.release = kernel.function("nfs_file_release") !, mode = $filp->f_mode name = "nfs.fop.release" - argstr = sprintf("%d" , ino) + argstr = sprintf("%d", ino) } probe nfs.fop.release.return = kernel.function("nfs_file_release").return !, @@ -656,7 +659,7 @@ probe nfs.fop.release.return = kernel.function("nfs_file_release").return !, retstr = sprintf("%d", $return) } -/*probe nfs.fop.fsync +/* probe nfs.fop.fsync * * Fires when do a fsync operation on nfs, * it probes fsync file operation of nfs @@ -665,7 +668,7 @@ probe nfs.fop.release.return = kernel.function("nfs_file_release").return !, * dev : device identifier * ino : inode number * ndirty : number of dirty pages -*/ + */ probe nfs.fop.fsync = kernel.function("nfs_fsync") !, module("nfs").function("nfs_fsync") { @@ -677,7 +680,7 @@ probe nfs.fop.fsync = kernel.function("nfs_fsync") !, ndirty = __nfsi_ndirty(__file_inode($file)) name = "nfs.fop.fsync" - argstr = sprintf("%d",ino) + argstr = sprintf("%d", ino) } probe nfs.fop.fsync.return = kernel.function("nfs_fsync").return !, @@ -687,7 +690,7 @@ probe nfs.fop.fsync.return = kernel.function("nfs_fsync").return !, retstr = sprintf("%d", $return) } -/*probe nfs.fop.lock +/* probe nfs.fop.lock * * Fires when do a file lock operation on nfs, * it probes lock file operation of nfs @@ -701,7 +704,7 @@ probe nfs.fop.fsync.return = kernel.function("nfs_fsync").return !, * fl_flag : lock flags * fl_start : starting offset of locked region * fl_end : ending offset of locked region -*/ + */ probe nfs.fop.lock = kernel.function("nfs_lock") !, module("nfs").function("nfs_lock") { @@ -719,18 +722,17 @@ probe nfs.fop.lock = kernel.function("nfs_lock") !, fl_end = $fl->fl_end name = "nfs.fop.lock" - argstr = sprintf("%d,%d",cmd,i_mode) + argstr = sprintf("%d, %d", cmd, i_mode) } probe nfs.fop.lock.return = kernel.function("nfs_lock").return !, module("nfs").function("nfs_lock").return { name = "nfs.fop.lock.return" - retstr = sprintf("%d",$return) + retstr = sprintf("%d", $return) } - -/*probe nfs.fop.sendfile +/* probe nfs.fop.sendfile * * Fires when do a send file operation on nfs, * it probes sendfile file operation of nfs @@ -747,7 +749,7 @@ probe nfs.fop.lock.return = kernel.function("nfs_lock").return !, * We need to revalidate the cached attrs for this inode if * * jiffies - read_cache_jiffies > attrtimeo -*/ + */ %( kernel_v <= "2.6.18" %? probe nfs.fop.sendfile = kernel.function("nfs_file_sendfile") !, module("nfs").function("nfs_file_sendfile") @@ -766,7 +768,7 @@ probe nfs.fop.sendfile = kernel.function("nfs_file_sendfile") !, attr_time = __nfsi_attr_time(__file_inode($filp)) name = "nfs.fop.sendfile" - argstr = sprintf("%d,%d", count,ppos) + argstr = sprintf("%d, %d", count, ppos) size = count units = "bytes" @@ -785,28 +787,28 @@ probe nfs.fop.sendfile.return = kernel.function("nfs_file_sendfile").return !, } %) -/*probe nfs.fop.check_flags +/* probe nfs.fop.check_flags * * Fires when do a checking flag operation on nfs, * it probes check_flag file operation of nfs * * Arguments: * flag : file flag -*/ + */ probe nfs.fop.check_flags = kernel.function("nfs_check_flags") !, module("nfs").function("nfs_check_flags") { flag = $flags name = "nfs.fop.check_flags" - argstr = sprintf("%d",flag) + argstr = sprintf("%d", flag) } -probe nfs.fop.check_flags.return = kernel.function("nfs_check_flags").return !, +probe nfs.fop.check_flags.return = kernel.function("nfs_check_flags").return !, module("nfs").function("nfs_check_flags").return { name = "nfs.fop.check_flags.return" - retstr = sprintf("%d",$return) + retstr = sprintf("%d", $return) } probe nfs.aop.entries = nfs.aop.readpage, @@ -831,7 +833,7 @@ probe nfs.aop.return = nfs.aop.readpage.return, /* probe nfs.aop.readpage * - * Read the page ,only fies when a previous async + * Read the page, only fies when a previous async * read operation failed * * Arguments: @@ -843,8 +845,8 @@ probe nfs.aop.return = nfs.aop.readpage.return, * sb_flag : super block flags * file : file argument * page_index : offset within mapping, can used a - page identifier and position identifier - in the page frame + * page identifier and position identifier + * in the page frame * rsize : read size (in bytes) * size : number of pages to be read in this execution */ @@ -867,7 +869,7 @@ probe nfs.aop.readpage = kernel.function ("nfs_readpage") !, rsize = __nfs_server_rsize(__inode) name = "nfs.aop.readpage" - argstr = sprintf("%d,%d" , page_index,rsize) + argstr = sprintf("%d, %d", page_index, rsize) size = 1 units = "pages" @@ -885,7 +887,7 @@ probe nfs.aop.readpage.return = kernel.function ("nfs_readpage").return !, /* probe nfs.aop.readpages * - * Fies when in readahead way,read several pages once + * Fies when in readahead way, read several pages once * Arguments: * dev : device identifier * ino : inode number @@ -895,7 +897,7 @@ probe nfs.aop.readpage.return = kernel.function ("nfs_readpage").return !, * rsize : read size (in bytes) * size : number of pages attempted to read in this execution */ -probe nfs.aop.readpages = kernel.function ("nfs_readpages") !, +probe nfs.aop.readpages = kernel.function ("nfs_readpages") !, module("nfs").function ("nfs_readpages") { dev = $mapping->host->i_sb->s_dev @@ -908,7 +910,7 @@ probe nfs.aop.readpages = kernel.function ("nfs_readpages") !, rsize = __nfs_server_rsize($mapping->host) name = "nfs.aop.readpages" - argstr = sprintf("%d" , nr_pages) + argstr = sprintf("%d", nr_pages) size = nr_pages units = "pages" @@ -920,22 +922,22 @@ probe nfs.aop.readpages.return = kernel.function ("nfs_readpages").return !, name = "nfs.aop.readpages.return" retstr = sprintf("%d", $return) - - if($return > 0 ) + if ($return > 0 ) { size = retstr } units = "pages" } -/*probe nfs.aop.set_page_dirty + +/* probe nfs.aop.set_page_dirty * - * __set_page_dirty_nobuffers is used to set a page dirty,but + * __set_page_dirty_nobuffers is used to set a page dirty, but * not all the buffers. * * Arguments: * __page : the address of page * page_flag : page flags -*/ + */ probe nfs.aop.set_page_dirty = kernel.function ("__set_page_dirty_nobuffers") !, module("nfs").function ("__set_page_dirty_nobuffers") @@ -943,12 +945,12 @@ probe nfs.aop.set_page_dirty = /* dev = $mapping->host->i_sb->s_dev devname = __find_bdevname(dev, $mapping->host->i_sb->s_bdev) ino = $mapping->host->i_ino -*/ + */ __page = $page page_flag = $page->flags name = "nfs.aop.set_page_dirty" - argstr = sprintf("%d",page_flag) + argstr = sprintf("%d", page_flag) } probe nfs.aop.set_page_dirty.return = @@ -959,7 +961,7 @@ probe nfs.aop.set_page_dirty.return = retstr = sprintf("%d", $return) } -/*probe nfs.aop.writepage +/* probe nfs.aop.writepage * * Write an mapped page to the server * @@ -967,20 +969,22 @@ probe nfs.aop.set_page_dirty.return = * __page : the address of page * dev : device identifier * ino : inode number - * for_reclaim : a flag of writeback_control, indicates if it's invoked from the page allocator - * for_kupdate : a flag of writeback_control, indicates if it's a kupdate writeback + * for_reclaim : a flag of writeback_control, indicates if it's + * invoked from the page allocator + * for_kupdate : a flag of writeback_control, indicates if it's a + * kupdate writeback * The priority of wb is decided by above two flags * i_flag : file flags * i_size : file length in bytes * i_state : inode state flags * sb_flag : super block flags * page_index : offset within mapping, can used a - page identifier and position identifier - in the page frame + * page identifier and position identifier + * in the page frame * wsize : write size * size : number of pages to be written in this execution -*/ -probe nfs.aop.writepage = kernel.function ("nfs_writepage") !, + */ +probe nfs.aop.writepage = kernel.function ("nfs_writepage") !, module("nfs").function ("nfs_writepage") { __page = $page @@ -1004,33 +1008,36 @@ probe nfs.aop.writepage = kernel.function ("nfs_writepage") !, wsize = __nfs_server_wsize(__inode) name = "nfs.aop.writepage" - argstr = sprintf("%d",page_index) + argstr = sprintf("%d", page_index) size = 1 units = "pages" } -probe nfs.aop.writepage.return = kernel.function ("nfs_writepage").return !, +probe nfs.aop.writepage.return = kernel.function ("nfs_writepage").return !, module("nfs").function ("nfs_writepage").return { name = "nfs.aop.writepage.return" retstr = sprintf("%d", $return) } -/*probe nfs.aop.writepages +/* probe nfs.aop.writepages * Write several dirty pages to the serve *Arguments: * dev : device identifier * ino : inode number - * for_reclaim : a flag of writeback_control, indicates if it's invoked from the page allocator - * for_kupdate : a flag of writeback_control, indicates if it's a kupdate writeback + * for_reclaim : a flag of writeback_control, indicates if it's + * invoked from the page allocator + * for_kupdate : a flag of writeback_control, indicates if it's a + * kupdate writeback * The priority of wb is decided by above two flags * wsize : write size * wpages : write size (in pages) - * nr_to_write : number of pages attempted to be written in this execution + * nr_to_write : number of pages attempted to be written in this + * execution * size : number of pages attempted to be written in this execution -*/ -probe nfs.aop.writepages = kernel.function ("nfs_writepages") !, + */ +probe nfs.aop.writepages = kernel.function ("nfs_writepages") !, module("nfs").function ("nfs_writepages") { dev = $mapping->host->i_sb->s_dev @@ -1044,19 +1051,20 @@ probe nfs.aop.writepages = kernel.function ("nfs_writepages") !, wpages = __nfs_wpages($mapping->host) name = "nfs.aop.writepages" - argstr = sprintf("%d",nr_to_write) + argstr = sprintf("%d", nr_to_write) size = nr_to_write units = "pages" } -probe nfs.aop.writepages.return = kernel.function ("nfs_writepages").return !, +probe nfs.aop.writepages.return = kernel.function ("nfs_writepages").return !, module("nfs").function ("nfs_writepages").return { name = "nfs.aop.writepages.return" retstr = sprintf("%d", $return) } -/*probe nfs.aop.prepare_write + +/* probe nfs.aop.prepare_write * Fires when do write operation on nfs. * Prepare a page for writing * Look for a request corresponding to the page. If there @@ -1072,11 +1080,11 @@ probe nfs.aop.writepages.return = kernel.function ("nfs_writepages").return !, * offset : start address of this write operation * to : end address of this write operation * page_index : offset within mapping, can used a - page identifier and position identifier - in the page frame + * page identifier and position identifier + * in the page frame * size : write bytes -*/ -probe nfs.aop.prepare_write= kernel.function ("nfs_prepare_write") !, + */ +probe nfs.aop.prepare_write = kernel.function ("nfs_prepare_write") !, module("nfs").function ("nfs_prepare_write") { __page = $page @@ -1104,7 +1112,7 @@ probe nfs.aop.prepare_write.return = retstr = sprintf("%d", $return) } -/*probe nfs.aop.commit_write +/* probe nfs.aop.commit_write * Fires when do a write operation on nfs, * often after prepare_write * @@ -1120,11 +1128,11 @@ probe nfs.aop.prepare_write.return = * i_size : file length in bytes * sb_flag : super block flags * page_index : offset within mapping, can used a - page identifier and position identifier - in the page frame + * page identifier and position identifier + * in the page frame * size : write bytes */ -probe nfs.aop.commit_write= kernel.function ("nfs_commit_write") !, +probe nfs.aop.commit_write = kernel.function ("nfs_commit_write") !, module("nfs").function ("nfs_commit_write") { __page = $page @@ -1143,14 +1151,13 @@ probe nfs.aop.commit_write= kernel.function ("nfs_commit_write") !, page_index = $page->index name = "nfs.aop.commit_write" - argstr = sprintf("%d, %d",offset , to) + argstr = sprintf("%d, %d", offset, to) size = to - offset units = "bytes" } - -probe nfs.aop.commit_write.return= +probe nfs.aop.commit_write.return = kernel.function ("nfs_commit_write").return !, module("nfs").function ("nfs_commit_write").return { @@ -1158,7 +1165,7 @@ probe nfs.aop.commit_write.return= retstr = sprintf("%d", $return) } -/*probe nfs.aop.release_page +/* probe nfs.aop.release_page * Fires when do a release operation on nfs, * * @@ -1167,11 +1174,11 @@ probe nfs.aop.commit_write.return= * dev : device identifier * ino : inode number * page_index : offset within mapping, can used a - page identifier and position identifier - in the page frame + * page identifier and position identifier + * in the page frame * size : release pages -*/ -probe nfs.aop.release_page = kernel.function ("nfs_release_page") !, + */ +probe nfs.aop.release_page = kernel.function ("nfs_release_page") !, module("nfs").function ("nfs_release_page") { __page = $page @@ -1189,10 +1196,10 @@ probe nfs.aop.release_page = kernel.function ("nfs_release_page") !, } -probe nfs.aop.release_page.return = kernel.function ("nfs_release_page").return !, +probe nfs.aop.release_page.return = + kernel.function ("nfs_release_page").return !, module("nfs").function ("nfs_release_page").return { name = "nfs.aop.release_page.return" retstr = sprintf("%d", $return) } - diff --git a/tapsets.cxx b/tapsets.cxx index 6566c89f..2a893c95 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -228,7 +228,7 @@ common_probe_entryfn_epilogue (translator_output* o, // Check for excessive skip counts. o->newline() << "if (unlikely (atomic_read (& skipped_count) > MAXSKIPPED)) {"; - o->newline(1) << "if (unlikely (atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; + o->newline(1) << "if (unlikely (pseudo_atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; o->newline() << "_stp_error (\"Skipped too many probes, check MAXSKIPPED or try again with stap -t for more details.\");"; o->newline(-1) << "}"; @@ -2911,6 +2911,16 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex dwarf_type_name(&type_die, type_name)) args.insert("$return:"+type_name); + /* Pretend that we aren't in a .return for a moment, just so we can + * check whether variables are accessible. We don't want any of the + * entry-saving code generated during listing mode. This works + * because the set of $context variables available in a .return + * probe (apart from $return) is the same set as available for the + * corresponding .call probe, since we collect those variables at + * .call time. */ + bool saved_has_return = has_return; + q.has_return = has_return = false; + Dwarf_Die arg; vector<Dwarf_Die> scopes = q.dw.getscopes_die(scope_die); if (dwarf_child (&scopes[0], &arg) == 0) @@ -2937,8 +2947,7 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex /* trick from visit_target_symbol_context */ target_symbol *tsym = new target_symbol; - token *t = new token; - tsym->tok = t; + tsym->tok = q.base_loc->tok; tsym->base_name = "$"; tsym->base_name += arg_name; @@ -2949,6 +2958,9 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex args.insert("$"+string(arg_name)+":"+type_name); } while (dwarf_siblingof (&arg, &arg) == 0); + + /* restore the .return status of the probe */ + q.has_return = has_return = saved_has_return; } @@ -4660,7 +4672,7 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "#endif"; // NB: duplicates common_entryfn_epilogue, but then this is not a probe entry fn epilogue. s.op->newline() << "if (unlikely (atomic_inc_return (& skipped_count) > MAXSKIPPED)) {"; - s.op->newline(1) << "if (unlikely (atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; + s.op->newline(1) << "if (unlikely (pseudo_atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; s.op->newline() << "_stp_error (\"Skipped too many probes, check MAXSKIPPED or try again with stap -t for more details.\");"; s.op->newline(-1) << "}"; s.op->newline(-1) << "}"; diff --git a/testsuite/buildok/irq.stp b/testsuite/buildok/irq.stp new file mode 100644 index 00000000..b1a141dc --- /dev/null +++ b/testsuite/buildok/irq.stp @@ -0,0 +1,7 @@ +#! stap -p4 + +// Tests if all probes in irq tapset are resolvable + +probe workqueue.* {} +probe irq_handler.* {} +probe softirq.* {} diff --git a/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp b/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp new file mode 100644 index 00000000..3bcfd5e1 --- /dev/null +++ b/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp @@ -0,0 +1,31 @@ +#! /usr/bin/env stap +/* + * Copyright (C) 2009 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. + * + * Version 1.0 prerna@linux.vnet.ibm.com 2009-10-28 + * + * Name: + * interrupts-by-dev.stp + * + * Description: + * Script to profile interrupts received by each device per 100 ms. + * + * + */ + +global devices + +probe irq_handler.entry { + devices[dev_name]++; +} + +probe timer.ms(100) { + printf("\t DEVICE \t NUMBER OF INTERRUPTS \n"); + foreach ( devname in devices ) + printf(" %20s : %5d\n",kernel_string(devname),devices[devname]); + delete devices +} |