Debian Codegraph @

tapset/linux/irq.stp

raw
1 /*
2 * Copyright (C) 2009 IBM Corp.
3 * This file is part of systemtap, and is free software. You can
4 * redistribute it and/or modify it under the terms of the GNU General
5 * Public License (GPL); either version 2, or (at your option) any
6 * later version.
7 *
8 * Version 1.0 [email protected] 2009-10-28
9 *
10 * Tracepoint based tapset for IRQs, Workqueues, etc
11 *
12 */
13 // Probes for workqueues.
14
15 /**
16 * probe workqueue.create - Creating a new workqueue
17 * @wq_thread: task_struct of the workqueue thread
18 * @cpu: cpu for which the worker thread is created
19 */
20 probe workqueue.create = kernel.trace("workqueue_creation") ?
21 {
22 wq_thread = $wq_thread
23 cpu = $cpu
24 }
25
26 /**
27 * probe workqueue.insert - Queuing work on a workqueue
28 * @wq_thread: task_struct of the workqueue thread
29 * @work: work_struct* being queued
30 * @work_func: pointer to handler function
31 */
32 probe workqueue.insert = kernel.trace("workqueue_insertion") ?
33 {
34 wq_thread = $wq_thread
35 work = $work
36 work_func = $work->func
37 }
38
39 /**
40 * probe workqueue.execute - Executing deferred work
41 * @wq_thread: task_struct of the workqueue thread
42 * @work: work_struct* being executed
43 * @work_func: pointer to handler function
44 */
45 probe workqueue.execute = kernel.trace("workqueue_execution") ?
46 {
47 wq_thread = $wq_thread
48 work = $work
49 work_func = $work->func
50 }
51
52 /**
53 * probe workqueue.destroy - Destroying workqueue
54 * @wq_thread: task_struct of the workqueue thread
55 */
56 probe workqueue.destroy = kernel.trace("workqueue_destruction") ?
57 {
58 wq_thread = $wq_thread
59 }
60
61 // Probes for IRQ handlers.
62
63 /**
64 * probe irq_handler.entry - Execution of interrupt handler starting
65 * @irq: irq number
66 * @action: struct irqaction* for this interrupt num
67 * @handler: interrupt handler function
68 * @flags: Flags for IRQ handler
69 * @flags_str: symbolic string representation of IRQ flags
70 * @dev_name: name of device
71 * @dev_id: Cookie to identify device
72 * @next_irqaction: pointer to next irqaction for shared interrupts
73 * @dir: pointer to the proc/irq/NN/name entry
74 * @thread_fn: interrupt handler function for threaded interrupts
75 * @thread: thread pointer for threaded interrupts
76 * @thread_flags: Flags related to thread
77 */
78 probe irq_handler.entry = kernel.trace("irq_handler_entry") ?
79 {
80 irq = $irq
81 // the tracepoint doesn't have the struct definition, so we must @cast
82 action = & @cast($action, "irqaction", "kernel<linux/interrupt.h>")
83 handler = action->handler
84 flags = action->flags
85 flags_str = irqflags_str(flags)
86 dev_name = action->name
87 dev_id = action->dev_id
88 next_irqaction = action->next
89 dir = action->dir
90 thread_fn = action->thread_fn
91 thread = action->thread
92 thread_flags = action->thread_flags
93 }
94
95 /**
96 * probe irq_handler.exit - Execution of interrupt handler completed
97 * @irq: interrupt number
98 * @action: struct irqaction*
99 * @ret: return value of the handler
100 * @handler: interrupt handler function that was executed
101 * @flags: flags for IRQ handler
102 * @flags_str: symbolic string representation of IRQ flags
103 * @dev_name: name of device
104 * @dev_id: Cookie to identify device
105 * @next_irqaction: pointer to next irqaction for shared interrupts
106 * @dir: pointer to the proc/irq/NN/name entry
107 * @thread_fn: interrupt handler function for threaded interrupts
108 * @thread: thread pointer for threaded interrupts
109 * @thread_flags: Flags related to thread
110 */
111 probe irq_handler.exit = kernel.trace("irq_handler_exit") ?
112 {
113 irq = $irq
114 // the tracepoint doesn't have the struct definition, so we must @cast
115 action = & @cast($action, "irqaction", "kernel<linux/interrupt.h>")
116 ret = $ret
117 handler = action->handler
118 flags = action->flags
119 flags_str = irqflags_str(flags)
120 dev_name = action->name
121 dev_id = action->dev_id
122 next_irqaction = action->next
123 dir = action->dir
124 thread_fn = action->thread_fn
125 thread = action->thread
126 thread_flags = action->thread_flags
127 }
128
129 // Softirq based probes.
130 /**
131 * probe softirq.entry - Execution of handler for a pending softirq starting
132 * @h: struct softirq_action* for current pending softirq
133 * @vec: softirq_action vector
134 * @action: pointer to softirq handler just about to execute
135 * @vec_nr: softirq vector number
136 */
137 probe softirq.entry = kernel.trace("irq_softirq_entry") !,
138 kernel.trace("softirq_entry") ?
139 {
140 # kernels < 2.6.37
141 h = @choose_defined($h, 0)
142 vec = @choose_defined($vec, 0)
143 action = (@defined($h) ? @cast($h,"softirq_action","kernel<linux/interrupt.h>")->action : 0)
144 # kernels >= 2.6.37
145 vec_nr = @choose_defined($vec_nr, 0)
146 }
147
148 /**
149 * probe softirq.exit - Execution of handler for a pending softirq completed
150 * @h: struct softirq_action* for just executed softirq
151 * @vec: softirq_action vector
152 * @action: pointer to softirq handler that just finished execution
153 * @vec_nr: softirq vector number
154 */
155 probe softirq.exit = kernel.trace("irq_softirq_exit") !,
156 kernel.trace("softirq_exit") ?
157 {
158 # kernels < 2.6.37
159 h = @choose_defined($h, 0)
160 vec = @choose_defined($vec, 0)
161 action = (@defined($h) ? @cast($h,"softirq_action","kernel<linux/interrupt.h>")->action : 0)
162 # kernels >= 2.6.37
163 vec_nr = @choose_defined($vec_nr, 0)
164 }