Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 1 | /* |
| 2 | * trace task wakeup timings |
| 3 | * |
| 4 | * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com> |
| 5 | * Copyright (C) 2008 Ingo Molnar <mingo@redhat.com> |
| 6 | * |
| 7 | * Based on code from the latency_tracer, that is: |
| 8 | * |
| 9 | * Copyright (C) 2004-2006 Ingo Molnar |
Nadia Yvette Chambers | 6d49e35 | 2012-12-06 10:39:54 +0100 | [diff] [blame] | 10 | * Copyright (C) 2004 Nadia Yvette Chambers |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 11 | */ |
| 12 | #include <linux/module.h> |
| 13 | #include <linux/fs.h> |
| 14 | #include <linux/debugfs.h> |
| 15 | #include <linux/kallsyms.h> |
| 16 | #include <linux/uaccess.h> |
| 17 | #include <linux/ftrace.h> |
Clark Williams | 8bd75c7 | 2013-02-07 09:47:07 -0600 | [diff] [blame] | 18 | #include <linux/sched/rt.h> |
Steven Rostedt | ad8d75f | 2009-04-14 19:39:12 -0400 | [diff] [blame] | 19 | #include <trace/events/sched.h> |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 20 | #include "trace.h" |
| 21 | |
| 22 | static struct trace_array *wakeup_trace; |
| 23 | static int __read_mostly tracer_enabled; |
| 24 | |
| 25 | static struct task_struct *wakeup_task; |
| 26 | static int wakeup_cpu; |
Steven Rostedt | 478142c3 | 2009-09-09 10:36:01 -0400 | [diff] [blame] | 27 | static int wakeup_current_cpu; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 28 | static unsigned wakeup_prio = -1; |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 29 | static int wakeup_rt; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 30 | |
Thomas Gleixner | 445c895 | 2009-12-02 19:49:50 +0100 | [diff] [blame] | 31 | static arch_spinlock_t wakeup_lock = |
Thomas Gleixner | edc35bd | 2009-12-03 12:38:57 +0100 | [diff] [blame] | 32 | (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 33 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 34 | static void wakeup_reset(struct trace_array *tr); |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 35 | static void __wakeup_reset(struct trace_array *tr); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 36 | static int wakeup_graph_entry(struct ftrace_graph_ent *trace); |
| 37 | static void wakeup_graph_return(struct ftrace_graph_ret *trace); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 38 | |
Steven Rostedt (Red Hat) | 613f04a | 2013-03-14 15:03:53 -0400 | [diff] [blame] | 39 | static int save_flags; |
Steven Rostedt | e9d25fe | 2009-03-04 22:15:30 -0500 | [diff] [blame] | 40 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 41 | #define TRACE_DISPLAY_GRAPH 1 |
| 42 | |
| 43 | static struct tracer_opt trace_opts[] = { |
| 44 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 45 | /* display latency trace as call graph */ |
| 46 | { TRACER_OPT(display-graph, TRACE_DISPLAY_GRAPH) }, |
| 47 | #endif |
| 48 | { } /* Empty entry */ |
| 49 | }; |
| 50 | |
| 51 | static struct tracer_flags tracer_flags = { |
| 52 | .val = 0, |
| 53 | .opts = trace_opts, |
| 54 | }; |
| 55 | |
| 56 | #define is_graph() (tracer_flags.val & TRACE_DISPLAY_GRAPH) |
| 57 | |
Steven Rostedt | 606576c | 2008-10-06 19:06:12 -0400 | [diff] [blame] | 58 | #ifdef CONFIG_FUNCTION_TRACER |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 59 | |
| 60 | /* |
| 61 | * Prologue for the wakeup function tracers. |
| 62 | * |
| 63 | * Returns 1 if it is OK to continue, and preemption |
| 64 | * is disabled and data->disabled is incremented. |
| 65 | * 0 if the trace is to be ignored, and preemption |
| 66 | * is not disabled and data->disabled is |
| 67 | * kept the same. |
| 68 | * |
| 69 | * Note, this function is also used outside this ifdef but |
| 70 | * inside the #ifdef of the function graph tracer below. |
| 71 | * This is OK, since the function graph tracer is |
| 72 | * dependent on the function tracer. |
| 73 | */ |
| 74 | static int |
| 75 | func_prolog_preempt_disable(struct trace_array *tr, |
| 76 | struct trace_array_cpu **data, |
| 77 | int *pc) |
| 78 | { |
| 79 | long disabled; |
| 80 | int cpu; |
| 81 | |
| 82 | if (likely(!wakeup_task)) |
| 83 | return 0; |
| 84 | |
| 85 | *pc = preempt_count(); |
| 86 | preempt_disable_notrace(); |
| 87 | |
| 88 | cpu = raw_smp_processor_id(); |
| 89 | if (cpu != wakeup_current_cpu) |
| 90 | goto out_enable; |
| 91 | |
Steven Rostedt (Red Hat) | 12883ef | 2013-03-05 09:24:35 -0500 | [diff] [blame^] | 92 | *data = per_cpu_ptr(tr->trace_buffer.data, cpu); |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 93 | disabled = atomic_inc_return(&(*data)->disabled); |
| 94 | if (unlikely(disabled != 1)) |
| 95 | goto out; |
| 96 | |
| 97 | return 1; |
| 98 | |
| 99 | out: |
| 100 | atomic_dec(&(*data)->disabled); |
| 101 | |
| 102 | out_enable: |
| 103 | preempt_enable_notrace(); |
| 104 | return 0; |
| 105 | } |
| 106 | |
Steven Rostedt | 7e18d8e | 2008-05-22 00:22:19 -0400 | [diff] [blame] | 107 | /* |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 108 | * wakeup uses its own tracer function to keep the overhead down: |
Steven Rostedt | 7e18d8e | 2008-05-22 00:22:19 -0400 | [diff] [blame] | 109 | */ |
| 110 | static void |
Steven Rostedt | a1e2e31 | 2011-08-09 12:50:46 -0400 | [diff] [blame] | 111 | wakeup_tracer_call(unsigned long ip, unsigned long parent_ip, |
| 112 | struct ftrace_ops *op, struct pt_regs *pt_regs) |
Steven Rostedt | 7e18d8e | 2008-05-22 00:22:19 -0400 | [diff] [blame] | 113 | { |
| 114 | struct trace_array *tr = wakeup_trace; |
| 115 | struct trace_array_cpu *data; |
| 116 | unsigned long flags; |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 117 | int pc; |
Steven Rostedt | 7e18d8e | 2008-05-22 00:22:19 -0400 | [diff] [blame] | 118 | |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 119 | if (!func_prolog_preempt_disable(tr, &data, &pc)) |
Steven Rostedt | 7e18d8e | 2008-05-22 00:22:19 -0400 | [diff] [blame] | 120 | return; |
| 121 | |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 122 | local_irq_save(flags); |
Arnaldo Carvalho de Melo | 7be4215 | 2009-02-05 01:13:37 -0500 | [diff] [blame] | 123 | trace_function(tr, ip, parent_ip, flags, pc); |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 124 | local_irq_restore(flags); |
Steven Rostedt | 7e18d8e | 2008-05-22 00:22:19 -0400 | [diff] [blame] | 125 | |
Steven Rostedt | 7e18d8e | 2008-05-22 00:22:19 -0400 | [diff] [blame] | 126 | atomic_dec(&data->disabled); |
Steven Rostedt | 5168ae5 | 2010-06-03 09:36:50 -0400 | [diff] [blame] | 127 | preempt_enable_notrace(); |
Steven Rostedt | 7e18d8e | 2008-05-22 00:22:19 -0400 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | static struct ftrace_ops trace_ops __read_mostly = |
| 131 | { |
| 132 | .func = wakeup_tracer_call, |
Steven Rostedt | 4740974 | 2012-07-20 11:04:44 -0400 | [diff] [blame] | 133 | .flags = FTRACE_OPS_FL_GLOBAL | FTRACE_OPS_FL_RECURSION_SAFE, |
Steven Rostedt | 7e18d8e | 2008-05-22 00:22:19 -0400 | [diff] [blame] | 134 | }; |
Steven Rostedt | 7e40798 | 2010-10-19 10:56:19 -0400 | [diff] [blame] | 135 | #endif /* CONFIG_FUNCTION_TRACER */ |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 136 | |
| 137 | static int start_func_tracer(int graph) |
| 138 | { |
| 139 | int ret; |
| 140 | |
| 141 | if (!graph) |
| 142 | ret = register_ftrace_function(&trace_ops); |
| 143 | else |
| 144 | ret = register_ftrace_graph(&wakeup_graph_return, |
| 145 | &wakeup_graph_entry); |
| 146 | |
| 147 | if (!ret && tracing_is_enabled()) |
| 148 | tracer_enabled = 1; |
| 149 | else |
| 150 | tracer_enabled = 0; |
| 151 | |
| 152 | return ret; |
| 153 | } |
| 154 | |
| 155 | static void stop_func_tracer(int graph) |
| 156 | { |
| 157 | tracer_enabled = 0; |
| 158 | |
| 159 | if (!graph) |
| 160 | unregister_ftrace_function(&trace_ops); |
| 161 | else |
| 162 | unregister_ftrace_graph(); |
| 163 | } |
| 164 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 165 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 166 | static int wakeup_set_flag(u32 old_flags, u32 bit, int set) |
| 167 | { |
| 168 | |
| 169 | if (!(bit & TRACE_DISPLAY_GRAPH)) |
| 170 | return -EINVAL; |
| 171 | |
| 172 | if (!(is_graph() ^ set)) |
| 173 | return 0; |
| 174 | |
| 175 | stop_func_tracer(!set); |
| 176 | |
| 177 | wakeup_reset(wakeup_trace); |
| 178 | tracing_max_latency = 0; |
| 179 | |
| 180 | return start_func_tracer(set); |
| 181 | } |
| 182 | |
| 183 | static int wakeup_graph_entry(struct ftrace_graph_ent *trace) |
| 184 | { |
| 185 | struct trace_array *tr = wakeup_trace; |
| 186 | struct trace_array_cpu *data; |
| 187 | unsigned long flags; |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 188 | int pc, ret = 0; |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 189 | |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 190 | if (!func_prolog_preempt_disable(tr, &data, &pc)) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 191 | return 0; |
| 192 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 193 | local_save_flags(flags); |
| 194 | ret = __trace_graph_entry(tr, trace, flags, pc); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 195 | atomic_dec(&data->disabled); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 196 | preempt_enable_notrace(); |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 197 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 198 | return ret; |
| 199 | } |
| 200 | |
| 201 | static void wakeup_graph_return(struct ftrace_graph_ret *trace) |
| 202 | { |
| 203 | struct trace_array *tr = wakeup_trace; |
| 204 | struct trace_array_cpu *data; |
| 205 | unsigned long flags; |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 206 | int pc; |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 207 | |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 208 | if (!func_prolog_preempt_disable(tr, &data, &pc)) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 209 | return; |
| 210 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 211 | local_save_flags(flags); |
| 212 | __trace_graph_return(tr, trace, flags, pc); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 213 | atomic_dec(&data->disabled); |
| 214 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 215 | preempt_enable_notrace(); |
| 216 | return; |
| 217 | } |
| 218 | |
| 219 | static void wakeup_trace_open(struct trace_iterator *iter) |
| 220 | { |
| 221 | if (is_graph()) |
| 222 | graph_trace_open(iter); |
| 223 | } |
| 224 | |
| 225 | static void wakeup_trace_close(struct trace_iterator *iter) |
| 226 | { |
| 227 | if (iter->private) |
| 228 | graph_trace_close(iter); |
| 229 | } |
| 230 | |
Jiri Olsa | 321e68b | 2011-06-03 16:58:47 +0200 | [diff] [blame] | 231 | #define GRAPH_TRACER_FLAGS (TRACE_GRAPH_PRINT_PROC | \ |
| 232 | TRACE_GRAPH_PRINT_ABS_TIME | \ |
| 233 | TRACE_GRAPH_PRINT_DURATION) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 234 | |
| 235 | static enum print_line_t wakeup_print_line(struct trace_iterator *iter) |
| 236 | { |
| 237 | /* |
| 238 | * In graph mode call the graph tracer output function, |
| 239 | * otherwise go with the TRACE_FN event handler |
| 240 | */ |
| 241 | if (is_graph()) |
| 242 | return print_graph_function_flags(iter, GRAPH_TRACER_FLAGS); |
| 243 | |
| 244 | return TRACE_TYPE_UNHANDLED; |
| 245 | } |
| 246 | |
| 247 | static void wakeup_print_header(struct seq_file *s) |
| 248 | { |
| 249 | if (is_graph()) |
| 250 | print_graph_headers_flags(s, GRAPH_TRACER_FLAGS); |
| 251 | else |
| 252 | trace_default_header(s); |
| 253 | } |
| 254 | |
| 255 | static void |
| 256 | __trace_function(struct trace_array *tr, |
| 257 | unsigned long ip, unsigned long parent_ip, |
| 258 | unsigned long flags, int pc) |
| 259 | { |
| 260 | if (is_graph()) |
| 261 | trace_graph_function(tr, ip, parent_ip, flags, pc); |
| 262 | else |
| 263 | trace_function(tr, ip, parent_ip, flags, pc); |
| 264 | } |
| 265 | #else |
| 266 | #define __trace_function trace_function |
| 267 | |
| 268 | static int wakeup_set_flag(u32 old_flags, u32 bit, int set) |
| 269 | { |
| 270 | return -EINVAL; |
| 271 | } |
| 272 | |
| 273 | static int wakeup_graph_entry(struct ftrace_graph_ent *trace) |
| 274 | { |
| 275 | return -1; |
| 276 | } |
| 277 | |
| 278 | static enum print_line_t wakeup_print_line(struct trace_iterator *iter) |
| 279 | { |
| 280 | return TRACE_TYPE_UNHANDLED; |
| 281 | } |
| 282 | |
| 283 | static void wakeup_graph_return(struct ftrace_graph_ret *trace) { } |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 284 | static void wakeup_trace_open(struct trace_iterator *iter) { } |
| 285 | static void wakeup_trace_close(struct trace_iterator *iter) { } |
Jiri Olsa | 7e9a49e | 2011-11-07 16:08:49 +0100 | [diff] [blame] | 286 | |
| 287 | #ifdef CONFIG_FUNCTION_TRACER |
| 288 | static void wakeup_print_header(struct seq_file *s) |
| 289 | { |
| 290 | trace_default_header(s); |
| 291 | } |
| 292 | #else |
| 293 | static void wakeup_print_header(struct seq_file *s) |
| 294 | { |
| 295 | trace_latency_header(s); |
| 296 | } |
| 297 | #endif /* CONFIG_FUNCTION_TRACER */ |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 298 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
| 299 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 300 | /* |
| 301 | * Should this new latency be reported/recorded? |
| 302 | */ |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 303 | static int report_latency(cycle_t delta) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 304 | { |
| 305 | if (tracing_thresh) { |
| 306 | if (delta < tracing_thresh) |
| 307 | return 0; |
| 308 | } else { |
| 309 | if (delta <= tracing_max_latency) |
| 310 | return 0; |
| 311 | } |
| 312 | return 1; |
| 313 | } |
| 314 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 315 | static void |
| 316 | probe_wakeup_migrate_task(void *ignore, struct task_struct *task, int cpu) |
Steven Rostedt | 478142c3 | 2009-09-09 10:36:01 -0400 | [diff] [blame] | 317 | { |
| 318 | if (task != wakeup_task) |
| 319 | return; |
| 320 | |
| 321 | wakeup_current_cpu = cpu; |
| 322 | } |
| 323 | |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 324 | static void notrace |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 325 | probe_wakeup_sched_switch(void *ignore, |
| 326 | struct task_struct *prev, struct task_struct *next) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 327 | { |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 328 | struct trace_array_cpu *data; |
| 329 | cycle_t T0, T1, delta; |
| 330 | unsigned long flags; |
| 331 | long disabled; |
| 332 | int cpu; |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 333 | int pc; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 334 | |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 335 | tracing_record_cmdline(prev); |
| 336 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 337 | if (unlikely(!tracer_enabled)) |
| 338 | return; |
| 339 | |
| 340 | /* |
| 341 | * When we start a new trace, we set wakeup_task to NULL |
| 342 | * and then set tracer_enabled = 1. We want to make sure |
| 343 | * that another CPU does not see the tracer_enabled = 1 |
| 344 | * and the wakeup_task with an older task, that might |
| 345 | * actually be the same as next. |
| 346 | */ |
| 347 | smp_rmb(); |
| 348 | |
| 349 | if (next != wakeup_task) |
| 350 | return; |
| 351 | |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 352 | pc = preempt_count(); |
| 353 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 354 | /* disable local data, not wakeup_cpu data */ |
| 355 | cpu = raw_smp_processor_id(); |
Steven Rostedt (Red Hat) | 12883ef | 2013-03-05 09:24:35 -0500 | [diff] [blame^] | 356 | disabled = atomic_inc_return(&per_cpu_ptr(wakeup_trace->trace_buffer.data, cpu)->disabled); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 357 | if (likely(disabled != 1)) |
| 358 | goto out; |
| 359 | |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 360 | local_irq_save(flags); |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 361 | arch_spin_lock(&wakeup_lock); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 362 | |
| 363 | /* We could race with grabbing wakeup_lock */ |
| 364 | if (unlikely(!tracer_enabled || next != wakeup_task)) |
| 365 | goto out_unlock; |
| 366 | |
Steven Rostedt | 9be2441 | 2009-03-26 10:25:24 -0400 | [diff] [blame] | 367 | /* The task we are waiting for is waking up */ |
Steven Rostedt (Red Hat) | 12883ef | 2013-03-05 09:24:35 -0500 | [diff] [blame^] | 368 | data = per_cpu_ptr(wakeup_trace->trace_buffer.data, wakeup_cpu); |
Steven Rostedt | 9be2441 | 2009-03-26 10:25:24 -0400 | [diff] [blame] | 369 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 370 | __trace_function(wakeup_trace, CALLER_ADDR0, CALLER_ADDR1, flags, pc); |
Arnaldo Carvalho de Melo | 7be4215 | 2009-02-05 01:13:37 -0500 | [diff] [blame] | 371 | tracing_sched_switch_trace(wakeup_trace, prev, next, flags, pc); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 372 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 373 | T0 = data->preempt_timestamp; |
Ingo Molnar | 750ed1a | 2008-05-12 21:20:46 +0200 | [diff] [blame] | 374 | T1 = ftrace_now(cpu); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 375 | delta = T1-T0; |
| 376 | |
| 377 | if (!report_latency(delta)) |
| 378 | goto out_unlock; |
| 379 | |
Carsten Emde | b5130b1 | 2009-09-13 01:43:07 +0200 | [diff] [blame] | 380 | if (likely(!is_tracing_stopped())) { |
| 381 | tracing_max_latency = delta; |
| 382 | update_max_tr(wakeup_trace, wakeup_task, wakeup_cpu); |
| 383 | } |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 384 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 385 | out_unlock: |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 386 | __wakeup_reset(wakeup_trace); |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 387 | arch_spin_unlock(&wakeup_lock); |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 388 | local_irq_restore(flags); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 389 | out: |
Steven Rostedt (Red Hat) | 12883ef | 2013-03-05 09:24:35 -0500 | [diff] [blame^] | 390 | atomic_dec(&per_cpu_ptr(wakeup_trace->trace_buffer.data, cpu)->disabled); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 391 | } |
| 392 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 393 | static void __wakeup_reset(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 394 | { |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 395 | wakeup_cpu = -1; |
| 396 | wakeup_prio = -1; |
| 397 | |
| 398 | if (wakeup_task) |
| 399 | put_task_struct(wakeup_task); |
| 400 | |
| 401 | wakeup_task = NULL; |
| 402 | } |
| 403 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 404 | static void wakeup_reset(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 405 | { |
| 406 | unsigned long flags; |
| 407 | |
Steven Rostedt (Red Hat) | 12883ef | 2013-03-05 09:24:35 -0500 | [diff] [blame^] | 408 | tracing_reset_online_cpus(&tr->trace_buffer); |
Steven Rostedt | 2f26ebd | 2009-09-01 11:06:29 -0400 | [diff] [blame] | 409 | |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 410 | local_irq_save(flags); |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 411 | arch_spin_lock(&wakeup_lock); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 412 | __wakeup_reset(tr); |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 413 | arch_spin_unlock(&wakeup_lock); |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 414 | local_irq_restore(flags); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 415 | } |
| 416 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 417 | static void |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 418 | probe_wakeup(void *ignore, struct task_struct *p, int success) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 419 | { |
Steven Rostedt | f8ec106 | 2009-01-21 17:17:04 -0500 | [diff] [blame] | 420 | struct trace_array_cpu *data; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 421 | int cpu = smp_processor_id(); |
| 422 | unsigned long flags; |
| 423 | long disabled; |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 424 | int pc; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 425 | |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 426 | if (likely(!tracer_enabled)) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 427 | return; |
| 428 | |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 429 | tracing_record_cmdline(p); |
| 430 | tracing_record_cmdline(current); |
| 431 | |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 432 | if ((wakeup_rt && !rt_task(p)) || |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 433 | p->prio >= wakeup_prio || |
| 434 | p->prio >= current->prio) |
| 435 | return; |
| 436 | |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 437 | pc = preempt_count(); |
Steven Rostedt (Red Hat) | 12883ef | 2013-03-05 09:24:35 -0500 | [diff] [blame^] | 438 | disabled = atomic_inc_return(&per_cpu_ptr(wakeup_trace->trace_buffer.data, cpu)->disabled); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 439 | if (unlikely(disabled != 1)) |
| 440 | goto out; |
| 441 | |
| 442 | /* interrupts should be off from try_to_wake_up */ |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 443 | arch_spin_lock(&wakeup_lock); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 444 | |
| 445 | /* check for races. */ |
| 446 | if (!tracer_enabled || p->prio >= wakeup_prio) |
| 447 | goto out_locked; |
| 448 | |
| 449 | /* reset the trace */ |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 450 | __wakeup_reset(wakeup_trace); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 451 | |
| 452 | wakeup_cpu = task_cpu(p); |
Steven Rostedt | 478142c3 | 2009-09-09 10:36:01 -0400 | [diff] [blame] | 453 | wakeup_current_cpu = wakeup_cpu; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 454 | wakeup_prio = p->prio; |
| 455 | |
| 456 | wakeup_task = p; |
| 457 | get_task_struct(wakeup_task); |
| 458 | |
| 459 | local_save_flags(flags); |
| 460 | |
Steven Rostedt (Red Hat) | 12883ef | 2013-03-05 09:24:35 -0500 | [diff] [blame^] | 461 | data = per_cpu_ptr(wakeup_trace->trace_buffer.data, wakeup_cpu); |
Steven Rostedt | f8ec106 | 2009-01-21 17:17:04 -0500 | [diff] [blame] | 462 | data->preempt_timestamp = ftrace_now(cpu); |
Arnaldo Carvalho de Melo | 7be4215 | 2009-02-05 01:13:37 -0500 | [diff] [blame] | 463 | tracing_sched_wakeup_trace(wakeup_trace, p, current, flags, pc); |
Steven Rostedt | 301fd74 | 2009-04-03 11:12:23 -0400 | [diff] [blame] | 464 | |
| 465 | /* |
| 466 | * We must be careful in using CALLER_ADDR2. But since wake_up |
| 467 | * is not called by an assembly function (where as schedule is) |
| 468 | * it should be safe to use it here. |
| 469 | */ |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 470 | __trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, flags, pc); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 471 | |
| 472 | out_locked: |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 473 | arch_spin_unlock(&wakeup_lock); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 474 | out: |
Steven Rostedt (Red Hat) | 12883ef | 2013-03-05 09:24:35 -0500 | [diff] [blame^] | 475 | atomic_dec(&per_cpu_ptr(wakeup_trace->trace_buffer.data, cpu)->disabled); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 476 | } |
| 477 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 478 | static void start_wakeup_tracer(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 479 | { |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 480 | int ret; |
| 481 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 482 | ret = register_trace_sched_wakeup(probe_wakeup, NULL); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 483 | if (ret) { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 484 | pr_info("wakeup trace: Couldn't activate tracepoint" |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 485 | " probe to kernel_sched_wakeup\n"); |
| 486 | return; |
| 487 | } |
| 488 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 489 | ret = register_trace_sched_wakeup_new(probe_wakeup, NULL); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 490 | if (ret) { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 491 | pr_info("wakeup trace: Couldn't activate tracepoint" |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 492 | " probe to kernel_sched_wakeup_new\n"); |
| 493 | goto fail_deprobe; |
| 494 | } |
| 495 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 496 | ret = register_trace_sched_switch(probe_wakeup_sched_switch, NULL); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 497 | if (ret) { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 498 | pr_info("sched trace: Couldn't activate tracepoint" |
Wenji Huang | 73d8b8b | 2009-02-17 01:10:02 -0500 | [diff] [blame] | 499 | " probe to kernel_sched_switch\n"); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 500 | goto fail_deprobe_wake_new; |
| 501 | } |
| 502 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 503 | ret = register_trace_sched_migrate_task(probe_wakeup_migrate_task, NULL); |
Steven Rostedt | 478142c3 | 2009-09-09 10:36:01 -0400 | [diff] [blame] | 504 | if (ret) { |
| 505 | pr_info("wakeup trace: Couldn't activate tracepoint" |
| 506 | " probe to kernel_sched_migrate_task\n"); |
| 507 | return; |
| 508 | } |
| 509 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 510 | wakeup_reset(tr); |
| 511 | |
| 512 | /* |
| 513 | * Don't let the tracer_enabled = 1 show up before |
| 514 | * the wakeup_task is reset. This may be overkill since |
| 515 | * wakeup_reset does a spin_unlock after setting the |
| 516 | * wakeup_task to NULL, but I want to be safe. |
| 517 | * This is a slow path anyway. |
| 518 | */ |
| 519 | smp_wmb(); |
| 520 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 521 | if (start_func_tracer(is_graph())) |
| 522 | printk(KERN_ERR "failed to start wakeup tracer\n"); |
Steven Rostedt | ad59124 | 2008-07-10 20:58:13 -0400 | [diff] [blame] | 523 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 524 | return; |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 525 | fail_deprobe_wake_new: |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 526 | unregister_trace_sched_wakeup_new(probe_wakeup, NULL); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 527 | fail_deprobe: |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 528 | unregister_trace_sched_wakeup(probe_wakeup, NULL); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 529 | } |
| 530 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 531 | static void stop_wakeup_tracer(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 532 | { |
| 533 | tracer_enabled = 0; |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 534 | stop_func_tracer(is_graph()); |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 535 | unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL); |
| 536 | unregister_trace_sched_wakeup_new(probe_wakeup, NULL); |
| 537 | unregister_trace_sched_wakeup(probe_wakeup, NULL); |
| 538 | unregister_trace_sched_migrate_task(probe_wakeup_migrate_task, NULL); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 539 | } |
| 540 | |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 541 | static int __wakeup_tracer_init(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 542 | { |
Steven Rostedt (Red Hat) | 613f04a | 2013-03-14 15:03:53 -0400 | [diff] [blame] | 543 | save_flags = trace_flags; |
| 544 | |
| 545 | /* non overwrite screws up the latency tracers */ |
Steven Rostedt | 2b6080f | 2012-05-11 13:29:49 -0400 | [diff] [blame] | 546 | set_tracer_flag(tr, TRACE_ITER_OVERWRITE, 1); |
| 547 | set_tracer_flag(tr, TRACE_ITER_LATENCY_FMT, 1); |
Steven Rostedt | e9d25fe | 2009-03-04 22:15:30 -0500 | [diff] [blame] | 548 | |
Steven Rostedt | 745b162 | 2009-01-15 23:40:11 -0500 | [diff] [blame] | 549 | tracing_max_latency = 0; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 550 | wakeup_trace = tr; |
Steven Rostedt | c76f069 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 551 | start_wakeup_tracer(tr); |
Frederic Weisbecker | 1c80025 | 2008-11-16 05:57:26 +0100 | [diff] [blame] | 552 | return 0; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 553 | } |
| 554 | |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 555 | static int wakeup_tracer_init(struct trace_array *tr) |
| 556 | { |
| 557 | wakeup_rt = 0; |
| 558 | return __wakeup_tracer_init(tr); |
| 559 | } |
| 560 | |
| 561 | static int wakeup_rt_tracer_init(struct trace_array *tr) |
| 562 | { |
| 563 | wakeup_rt = 1; |
| 564 | return __wakeup_tracer_init(tr); |
| 565 | } |
| 566 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 567 | static void wakeup_tracer_reset(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 568 | { |
Steven Rostedt (Red Hat) | 613f04a | 2013-03-14 15:03:53 -0400 | [diff] [blame] | 569 | int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT; |
| 570 | int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE; |
| 571 | |
Steven Rostedt | c76f069 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 572 | stop_wakeup_tracer(tr); |
| 573 | /* make sure we put back any tasks we are tracing */ |
| 574 | wakeup_reset(tr); |
Steven Rostedt | e9d25fe | 2009-03-04 22:15:30 -0500 | [diff] [blame] | 575 | |
Steven Rostedt | 2b6080f | 2012-05-11 13:29:49 -0400 | [diff] [blame] | 576 | set_tracer_flag(tr, TRACE_ITER_LATENCY_FMT, lat_flag); |
| 577 | set_tracer_flag(tr, TRACE_ITER_OVERWRITE, overwrite_flag); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 578 | } |
| 579 | |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 580 | static void wakeup_tracer_start(struct trace_array *tr) |
| 581 | { |
| 582 | wakeup_reset(tr); |
| 583 | tracer_enabled = 1; |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | static void wakeup_tracer_stop(struct trace_array *tr) |
| 587 | { |
| 588 | tracer_enabled = 0; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 589 | } |
| 590 | |
| 591 | static struct tracer wakeup_tracer __read_mostly = |
| 592 | { |
| 593 | .name = "wakeup", |
| 594 | .init = wakeup_tracer_init, |
| 595 | .reset = wakeup_tracer_reset, |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 596 | .start = wakeup_tracer_start, |
| 597 | .stop = wakeup_tracer_stop, |
Hiraku Toyooka | f43c738 | 2012-10-02 17:27:10 +0900 | [diff] [blame] | 598 | .print_max = true, |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 599 | .print_header = wakeup_print_header, |
| 600 | .print_line = wakeup_print_line, |
| 601 | .flags = &tracer_flags, |
| 602 | .set_flag = wakeup_set_flag, |
Steven Rostedt (Red Hat) | 613f04a | 2013-03-14 15:03:53 -0400 | [diff] [blame] | 603 | .flag_changed = trace_keep_overwrite, |
Steven Rostedt | 60a1177 | 2008-05-12 21:20:44 +0200 | [diff] [blame] | 604 | #ifdef CONFIG_FTRACE_SELFTEST |
| 605 | .selftest = trace_selftest_startup_wakeup, |
| 606 | #endif |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 607 | .open = wakeup_trace_open, |
| 608 | .close = wakeup_trace_close, |
Hiraku Toyooka | f43c738 | 2012-10-02 17:27:10 +0900 | [diff] [blame] | 609 | .use_max_tr = true, |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 610 | }; |
| 611 | |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 612 | static struct tracer wakeup_rt_tracer __read_mostly = |
| 613 | { |
| 614 | .name = "wakeup_rt", |
| 615 | .init = wakeup_rt_tracer_init, |
| 616 | .reset = wakeup_tracer_reset, |
| 617 | .start = wakeup_tracer_start, |
| 618 | .stop = wakeup_tracer_stop, |
Frederic Weisbecker | 6eaaa5d | 2009-02-11 02:25:00 +0100 | [diff] [blame] | 619 | .wait_pipe = poll_wait_pipe, |
Hiraku Toyooka | f43c738 | 2012-10-02 17:27:10 +0900 | [diff] [blame] | 620 | .print_max = true, |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 621 | .print_header = wakeup_print_header, |
| 622 | .print_line = wakeup_print_line, |
| 623 | .flags = &tracer_flags, |
| 624 | .set_flag = wakeup_set_flag, |
Steven Rostedt (Red Hat) | 613f04a | 2013-03-14 15:03:53 -0400 | [diff] [blame] | 625 | .flag_changed = trace_keep_overwrite, |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 626 | #ifdef CONFIG_FTRACE_SELFTEST |
| 627 | .selftest = trace_selftest_startup_wakeup, |
| 628 | #endif |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 629 | .open = wakeup_trace_open, |
| 630 | .close = wakeup_trace_close, |
Hiraku Toyooka | f43c738 | 2012-10-02 17:27:10 +0900 | [diff] [blame] | 631 | .use_max_tr = true, |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 632 | }; |
| 633 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 634 | __init static int init_wakeup_tracer(void) |
| 635 | { |
| 636 | int ret; |
| 637 | |
| 638 | ret = register_tracer(&wakeup_tracer); |
| 639 | if (ret) |
| 640 | return ret; |
| 641 | |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 642 | ret = register_tracer(&wakeup_rt_tracer); |
| 643 | if (ret) |
| 644 | return ret; |
| 645 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 646 | return 0; |
| 647 | } |
Steven Rostedt | 6f41567 | 2012-10-05 12:13:07 -0400 | [diff] [blame] | 648 | core_initcall(init_wakeup_tracer); |