Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 2 | /* |
| 3 | * trace task wakeup timings |
| 4 | * |
| 5 | * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com> |
| 6 | * Copyright (C) 2008 Ingo Molnar <mingo@redhat.com> |
| 7 | * |
| 8 | * Based on code from the latency_tracer, that is: |
| 9 | * |
| 10 | * Copyright (C) 2004-2006 Ingo Molnar |
Nadia Yvette Chambers | 6d49e35 | 2012-12-06 10:39:54 +0100 | [diff] [blame] | 11 | * Copyright (C) 2004 Nadia Yvette Chambers |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 12 | */ |
| 13 | #include <linux/module.h> |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 14 | #include <linux/kallsyms.h> |
| 15 | #include <linux/uaccess.h> |
| 16 | #include <linux/ftrace.h> |
Clark Williams | 8bd75c7 | 2013-02-07 09:47:07 -0600 | [diff] [blame] | 17 | #include <linux/sched/rt.h> |
Dario Faggioli | 2d3d891 | 2013-11-07 14:43:44 +0100 | [diff] [blame] | 18 | #include <linux/sched/deadline.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; |
Austin Kim | bfbf8d1 | 2021-06-29 15:05:48 +0100 | [diff] [blame] | 29 | static bool wakeup_rt; |
| 30 | static bool wakeup_dl; |
| 31 | static bool tracing_dl; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 32 | |
Thomas Gleixner | 445c895 | 2009-12-02 19:49:50 +0100 | [diff] [blame] | 33 | static arch_spinlock_t wakeup_lock = |
Thomas Gleixner | edc35bd | 2009-12-03 12:38:57 +0100 | [diff] [blame] | 34 | (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 35 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 36 | static void wakeup_reset(struct trace_array *tr); |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 37 | static void __wakeup_reset(struct trace_array *tr); |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 38 | static int start_func_tracer(struct trace_array *tr, int graph); |
| 39 | static void stop_func_tracer(struct trace_array *tr, int graph); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 40 | |
Steven Rostedt (Red Hat) | 613f04a | 2013-03-14 15:03:53 -0400 | [diff] [blame] | 41 | static int save_flags; |
Steven Rostedt | e9d25fe | 2009-03-04 22:15:30 -0500 | [diff] [blame] | 42 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 43 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 44 | # define is_graph(tr) ((tr)->trace_flags & TRACE_ITER_DISPLAY_GRAPH) |
Steven Rostedt (Red Hat) | 0390558 | 2015-09-28 15:37:49 -0400 | [diff] [blame] | 45 | #else |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 46 | # define is_graph(tr) false |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 47 | #endif |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 48 | |
Steven Rostedt | 606576c | 2008-10-06 19:06:12 -0400 | [diff] [blame] | 49 | #ifdef CONFIG_FUNCTION_TRACER |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 50 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 51 | static bool function_enabled; |
| 52 | |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 53 | /* |
| 54 | * Prologue for the wakeup function tracers. |
| 55 | * |
| 56 | * Returns 1 if it is OK to continue, and preemption |
| 57 | * is disabled and data->disabled is incremented. |
| 58 | * 0 if the trace is to be ignored, and preemption |
| 59 | * is not disabled and data->disabled is |
| 60 | * kept the same. |
| 61 | * |
| 62 | * Note, this function is also used outside this ifdef but |
| 63 | * inside the #ifdef of the function graph tracer below. |
| 64 | * This is OK, since the function graph tracer is |
| 65 | * dependent on the function tracer. |
| 66 | */ |
| 67 | static int |
| 68 | func_prolog_preempt_disable(struct trace_array *tr, |
| 69 | struct trace_array_cpu **data, |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 70 | unsigned int *trace_ctx) |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 71 | { |
| 72 | long disabled; |
| 73 | int cpu; |
| 74 | |
| 75 | if (likely(!wakeup_task)) |
| 76 | return 0; |
| 77 | |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 78 | *trace_ctx = tracing_gen_ctx(); |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 79 | preempt_disable_notrace(); |
| 80 | |
| 81 | cpu = raw_smp_processor_id(); |
| 82 | if (cpu != wakeup_current_cpu) |
| 83 | goto out_enable; |
| 84 | |
Steven Rostedt (VMware) | 1c5eb44 | 2020-01-09 18:53:48 -0500 | [diff] [blame] | 85 | *data = per_cpu_ptr(tr->array_buffer.data, cpu); |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 86 | disabled = atomic_inc_return(&(*data)->disabled); |
| 87 | if (unlikely(disabled != 1)) |
| 88 | goto out; |
| 89 | |
| 90 | return 1; |
| 91 | |
| 92 | out: |
| 93 | atomic_dec(&(*data)->disabled); |
| 94 | |
| 95 | out_enable: |
| 96 | preempt_enable_notrace(); |
| 97 | return 0; |
| 98 | } |
| 99 | |
Steven Rostedt (Red Hat) | 729358d | 2015-09-29 10:15:10 -0400 | [diff] [blame] | 100 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
Steven Rostedt (Red Hat) | 328df47 | 2013-03-14 12:10:40 -0400 | [diff] [blame] | 101 | |
Steven Rostedt (Red Hat) | 0390558 | 2015-09-28 15:37:49 -0400 | [diff] [blame] | 102 | static int wakeup_display_graph(struct trace_array *tr, int set) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 103 | { |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 104 | if (!(is_graph(tr) ^ set)) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 105 | return 0; |
| 106 | |
Steven Rostedt (Red Hat) | 4104d32 | 2014-01-10 17:01:58 -0500 | [diff] [blame] | 107 | stop_func_tracer(tr, !set); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 108 | |
| 109 | wakeup_reset(wakeup_trace); |
Steven Rostedt (Red Hat) | 6d9b3fa | 2014-01-14 11:28:38 -0500 | [diff] [blame] | 110 | tr->max_latency = 0; |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 111 | |
Steven Rostedt (Red Hat) | 4104d32 | 2014-01-10 17:01:58 -0500 | [diff] [blame] | 112 | return start_func_tracer(tr, set); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | static int wakeup_graph_entry(struct ftrace_graph_ent *trace) |
| 116 | { |
| 117 | struct trace_array *tr = wakeup_trace; |
| 118 | struct trace_array_cpu *data; |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 119 | unsigned int trace_ctx; |
| 120 | int ret = 0; |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 121 | |
Steven Rostedt (Red Hat) | 1a41442 | 2016-12-08 19:28:28 -0500 | [diff] [blame] | 122 | if (ftrace_graph_ignore_func(trace)) |
| 123 | return 0; |
| 124 | /* |
| 125 | * Do not trace a function if it's filtered by set_graph_notrace. |
| 126 | * Make the index of ret stack negative to indicate that it should |
| 127 | * ignore further functions. But it needs its own ret stack entry |
| 128 | * to recover the original index in order to continue tracing after |
| 129 | * returning from the function. |
| 130 | */ |
| 131 | if (ftrace_graph_notrace_addr(trace->func)) |
| 132 | return 1; |
| 133 | |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 134 | if (!func_prolog_preempt_disable(tr, &data, &trace_ctx)) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 135 | return 0; |
| 136 | |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 137 | ret = __trace_graph_entry(tr, trace, trace_ctx); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 138 | atomic_dec(&data->disabled); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 139 | preempt_enable_notrace(); |
Steven Rostedt | 542181d | 2010-10-05 16:38:49 -0400 | [diff] [blame] | 140 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 141 | return ret; |
| 142 | } |
| 143 | |
| 144 | static void wakeup_graph_return(struct ftrace_graph_ret *trace) |
| 145 | { |
| 146 | struct trace_array *tr = wakeup_trace; |
| 147 | struct trace_array_cpu *data; |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 148 | unsigned int trace_ctx; |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 149 | |
Steven Rostedt (VMware) | 5cf99a0f | 2018-11-29 08:50:27 -0500 | [diff] [blame] | 150 | ftrace_graph_addr_finish(trace); |
| 151 | |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 152 | if (!func_prolog_preempt_disable(tr, &data, &trace_ctx)) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 153 | return; |
| 154 | |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 155 | __trace_graph_return(tr, trace, trace_ctx); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 156 | atomic_dec(&data->disabled); |
| 157 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 158 | preempt_enable_notrace(); |
| 159 | return; |
| 160 | } |
| 161 | |
Steven Rostedt (VMware) | 688f708 | 2018-11-15 14:06:47 -0500 | [diff] [blame] | 162 | static struct fgraph_ops fgraph_wakeup_ops = { |
| 163 | .entryfunc = &wakeup_graph_entry, |
| 164 | .retfunc = &wakeup_graph_return, |
| 165 | }; |
| 166 | |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 167 | static void wakeup_trace_open(struct trace_iterator *iter) |
| 168 | { |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 169 | if (is_graph(iter->tr)) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 170 | graph_trace_open(iter); |
| 171 | } |
| 172 | |
| 173 | static void wakeup_trace_close(struct trace_iterator *iter) |
| 174 | { |
| 175 | if (iter->private) |
| 176 | graph_trace_close(iter); |
| 177 | } |
| 178 | |
Jiri Olsa | 321e68b | 2011-06-03 16:58:47 +0200 | [diff] [blame] | 179 | #define GRAPH_TRACER_FLAGS (TRACE_GRAPH_PRINT_PROC | \ |
Changbin Du | 97f0a3b | 2019-01-01 23:46:11 +0800 | [diff] [blame] | 180 | TRACE_GRAPH_PRINT_CPU | \ |
Changbin Du | 9acd8de | 2019-01-01 23:46:10 +0800 | [diff] [blame] | 181 | TRACE_GRAPH_PRINT_REL_TIME | \ |
Changbin Du | 97f0a3b | 2019-01-01 23:46:11 +0800 | [diff] [blame] | 182 | TRACE_GRAPH_PRINT_DURATION | \ |
| 183 | TRACE_GRAPH_PRINT_OVERHEAD | \ |
| 184 | TRACE_GRAPH_PRINT_IRQS) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 185 | |
| 186 | static enum print_line_t wakeup_print_line(struct trace_iterator *iter) |
| 187 | { |
| 188 | /* |
| 189 | * In graph mode call the graph tracer output function, |
| 190 | * otherwise go with the TRACE_FN event handler |
| 191 | */ |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 192 | if (is_graph(iter->tr)) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 193 | return print_graph_function_flags(iter, GRAPH_TRACER_FLAGS); |
| 194 | |
| 195 | return TRACE_TYPE_UNHANDLED; |
| 196 | } |
| 197 | |
| 198 | static void wakeup_print_header(struct seq_file *s) |
| 199 | { |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 200 | if (is_graph(wakeup_trace)) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 201 | print_graph_headers_flags(s, GRAPH_TRACER_FLAGS); |
| 202 | else |
| 203 | trace_default_header(s); |
| 204 | } |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 205 | #endif /* else CONFIG_FUNCTION_GRAPH_TRACER */ |
| 206 | |
| 207 | /* |
| 208 | * wakeup uses its own tracer function to keep the overhead down: |
| 209 | */ |
| 210 | static void |
| 211 | wakeup_tracer_call(unsigned long ip, unsigned long parent_ip, |
Steven Rostedt (VMware) | d19ad07 | 2020-10-28 17:42:17 -0400 | [diff] [blame] | 212 | struct ftrace_ops *op, struct ftrace_regs *fregs) |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 213 | { |
| 214 | struct trace_array *tr = wakeup_trace; |
| 215 | struct trace_array_cpu *data; |
| 216 | unsigned long flags; |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 217 | unsigned int trace_ctx; |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 218 | |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 219 | if (!func_prolog_preempt_disable(tr, &data, &trace_ctx)) |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 220 | return; |
| 221 | |
| 222 | local_irq_save(flags); |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 223 | trace_function(tr, ip, parent_ip, trace_ctx); |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 224 | local_irq_restore(flags); |
| 225 | |
| 226 | atomic_dec(&data->disabled); |
| 227 | preempt_enable_notrace(); |
| 228 | } |
| 229 | |
| 230 | static int register_wakeup_function(struct trace_array *tr, int graph, int set) |
| 231 | { |
| 232 | int ret; |
| 233 | |
| 234 | /* 'set' is set if TRACE_ITER_FUNCTION is about to be set */ |
| 235 | if (function_enabled || (!set && !(tr->trace_flags & TRACE_ITER_FUNCTION))) |
| 236 | return 0; |
| 237 | |
| 238 | if (graph) |
Steven Rostedt (VMware) | 688f708 | 2018-11-15 14:06:47 -0500 | [diff] [blame] | 239 | ret = register_ftrace_graph(&fgraph_wakeup_ops); |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 240 | else |
| 241 | ret = register_ftrace_function(tr->ops); |
| 242 | |
| 243 | if (!ret) |
| 244 | function_enabled = true; |
| 245 | |
| 246 | return ret; |
| 247 | } |
| 248 | |
| 249 | static void unregister_wakeup_function(struct trace_array *tr, int graph) |
| 250 | { |
| 251 | if (!function_enabled) |
| 252 | return; |
| 253 | |
| 254 | if (graph) |
Steven Rostedt (VMware) | 688f708 | 2018-11-15 14:06:47 -0500 | [diff] [blame] | 255 | unregister_ftrace_graph(&fgraph_wakeup_ops); |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 256 | else |
| 257 | unregister_ftrace_function(tr->ops); |
| 258 | |
| 259 | function_enabled = false; |
| 260 | } |
| 261 | |
| 262 | static int wakeup_function_set(struct trace_array *tr, u32 mask, int set) |
| 263 | { |
| 264 | if (!(mask & TRACE_ITER_FUNCTION)) |
| 265 | return 0; |
| 266 | |
| 267 | if (set) |
| 268 | register_wakeup_function(tr, is_graph(tr), 1); |
| 269 | else |
| 270 | unregister_wakeup_function(tr, is_graph(tr)); |
| 271 | return 1; |
| 272 | } |
| 273 | #else /* CONFIG_FUNCTION_TRACER */ |
| 274 | static int register_wakeup_function(struct trace_array *tr, int graph, int set) |
| 275 | { |
| 276 | return 0; |
| 277 | } |
| 278 | static void unregister_wakeup_function(struct trace_array *tr, int graph) { } |
| 279 | static int wakeup_function_set(struct trace_array *tr, u32 mask, int set) |
| 280 | { |
| 281 | return 0; |
| 282 | } |
| 283 | #endif /* else CONFIG_FUNCTION_TRACER */ |
| 284 | |
| 285 | #ifndef CONFIG_FUNCTION_GRAPH_TRACER |
| 286 | static enum print_line_t wakeup_print_line(struct trace_iterator *iter) |
| 287 | { |
| 288 | return TRACE_TYPE_UNHANDLED; |
| 289 | } |
| 290 | |
| 291 | static void wakeup_trace_open(struct trace_iterator *iter) { } |
| 292 | static void wakeup_trace_close(struct trace_iterator *iter) { } |
| 293 | |
| 294 | static void wakeup_print_header(struct seq_file *s) |
| 295 | { |
| 296 | trace_default_header(s); |
| 297 | } |
| 298 | #endif /* !CONFIG_FUNCTION_GRAPH_TRACER */ |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 299 | |
| 300 | static void |
| 301 | __trace_function(struct trace_array *tr, |
| 302 | unsigned long ip, unsigned long parent_ip, |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 303 | unsigned int trace_ctx) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 304 | { |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 305 | if (is_graph(tr)) |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 306 | trace_graph_function(tr, ip, parent_ip, trace_ctx); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 307 | else |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 308 | trace_function(tr, ip, parent_ip, trace_ctx); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 309 | } |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 310 | |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 311 | static int wakeup_flag_changed(struct trace_array *tr, u32 mask, int set) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 312 | { |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 313 | struct tracer *tracer = tr->current_trace; |
| 314 | |
| 315 | if (wakeup_function_set(tr, mask, set)) |
| 316 | return 0; |
| 317 | |
| 318 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 319 | if (mask & TRACE_ITER_DISPLAY_GRAPH) |
| 320 | return wakeup_display_graph(tr, set); |
| 321 | #endif |
| 322 | |
| 323 | return trace_keep_overwrite(tracer, mask, set); |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 324 | } |
| 325 | |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 326 | static int start_func_tracer(struct trace_array *tr, int graph) |
| 327 | { |
| 328 | int ret; |
Jiri Olsa | 7e9a49e | 2011-11-07 16:08:49 +0100 | [diff] [blame] | 329 | |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 330 | ret = register_wakeup_function(tr, graph, 0); |
| 331 | |
| 332 | if (!ret && tracing_is_enabled()) |
| 333 | tracer_enabled = 1; |
| 334 | else |
| 335 | tracer_enabled = 0; |
| 336 | |
| 337 | return ret; |
Steven Rostedt (Red Hat) | 8179e8a | 2015-09-29 10:24:56 -0400 | [diff] [blame] | 338 | } |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 339 | |
| 340 | static void stop_func_tracer(struct trace_array *tr, int graph) |
Jiri Olsa | 7e9a49e | 2011-11-07 16:08:49 +0100 | [diff] [blame] | 341 | { |
Steven Rostedt (VMware) | 317e04ca | 2018-11-28 10:26:27 -0500 | [diff] [blame] | 342 | tracer_enabled = 0; |
| 343 | |
| 344 | unregister_wakeup_function(tr, graph); |
Jiri Olsa | 7e9a49e | 2011-11-07 16:08:49 +0100 | [diff] [blame] | 345 | } |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 346 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 347 | /* |
| 348 | * Should this new latency be reported/recorded? |
| 349 | */ |
Thomas Gleixner | a5a1d1c | 2016-12-21 20:32:01 +0100 | [diff] [blame] | 350 | static bool report_latency(struct trace_array *tr, u64 delta) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 351 | { |
| 352 | if (tracing_thresh) { |
| 353 | if (delta < tracing_thresh) |
Yaowei Bai | 26ab2ef | 2015-09-29 22:43:29 +0800 | [diff] [blame] | 354 | return false; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 355 | } else { |
Steven Rostedt (Red Hat) | 6d9b3fa | 2014-01-14 11:28:38 -0500 | [diff] [blame] | 356 | if (delta <= tr->max_latency) |
Yaowei Bai | 26ab2ef | 2015-09-29 22:43:29 +0800 | [diff] [blame] | 357 | return false; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 358 | } |
Yaowei Bai | 26ab2ef | 2015-09-29 22:43:29 +0800 | [diff] [blame] | 359 | return true; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 360 | } |
| 361 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 362 | static void |
| 363 | probe_wakeup_migrate_task(void *ignore, struct task_struct *task, int cpu) |
Steven Rostedt | 478142c3 | 2009-09-09 10:36:01 -0400 | [diff] [blame] | 364 | { |
| 365 | if (task != wakeup_task) |
| 366 | return; |
| 367 | |
| 368 | wakeup_current_cpu = cpu; |
| 369 | } |
| 370 | |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 371 | static void |
| 372 | tracing_sched_switch_trace(struct trace_array *tr, |
| 373 | struct task_struct *prev, |
| 374 | struct task_struct *next, |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 375 | unsigned int trace_ctx) |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 376 | { |
Steven Rostedt (Red Hat) | 2425bcb | 2015-05-05 11:45:27 -0400 | [diff] [blame] | 377 | struct trace_event_call *call = &event_context_switch; |
Steven Rostedt (VMware) | 1329249 | 2019-12-13 13:58:57 -0500 | [diff] [blame] | 378 | struct trace_buffer *buffer = tr->array_buffer.buffer; |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 379 | struct ring_buffer_event *event; |
| 380 | struct ctx_switch_entry *entry; |
| 381 | |
| 382 | event = trace_buffer_lock_reserve(buffer, TRACE_CTX, |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 383 | sizeof(*entry), trace_ctx); |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 384 | if (!event) |
| 385 | return; |
| 386 | entry = ring_buffer_event_data(event); |
| 387 | entry->prev_pid = prev->pid; |
| 388 | entry->prev_prio = prev->prio; |
Peter Zijlstra | 1d48b08 | 2017-09-29 13:50:16 +0200 | [diff] [blame] | 389 | entry->prev_state = task_state_index(prev); |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 390 | entry->next_pid = next->pid; |
| 391 | entry->next_prio = next->prio; |
Peter Zijlstra | 1d48b08 | 2017-09-29 13:50:16 +0200 | [diff] [blame] | 392 | entry->next_state = task_state_index(next); |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 393 | entry->next_cpu = task_cpu(next); |
| 394 | |
| 395 | if (!call_filter_check_discard(call, entry, buffer, event)) |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 396 | trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | static void |
| 400 | tracing_sched_wakeup_trace(struct trace_array *tr, |
| 401 | struct task_struct *wakee, |
| 402 | struct task_struct *curr, |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 403 | unsigned int trace_ctx) |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 404 | { |
Steven Rostedt (Red Hat) | 2425bcb | 2015-05-05 11:45:27 -0400 | [diff] [blame] | 405 | struct trace_event_call *call = &event_wakeup; |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 406 | struct ring_buffer_event *event; |
| 407 | struct ctx_switch_entry *entry; |
Steven Rostedt (VMware) | 1329249 | 2019-12-13 13:58:57 -0500 | [diff] [blame] | 408 | struct trace_buffer *buffer = tr->array_buffer.buffer; |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 409 | |
| 410 | event = trace_buffer_lock_reserve(buffer, TRACE_WAKE, |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 411 | sizeof(*entry), trace_ctx); |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 412 | if (!event) |
| 413 | return; |
| 414 | entry = ring_buffer_event_data(event); |
| 415 | entry->prev_pid = curr->pid; |
| 416 | entry->prev_prio = curr->prio; |
Peter Zijlstra | 1d48b08 | 2017-09-29 13:50:16 +0200 | [diff] [blame] | 417 | entry->prev_state = task_state_index(curr); |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 418 | entry->next_pid = wakee->pid; |
| 419 | entry->next_prio = wakee->prio; |
Peter Zijlstra | 1d48b08 | 2017-09-29 13:50:16 +0200 | [diff] [blame] | 420 | entry->next_state = task_state_index(wakee); |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 421 | entry->next_cpu = task_cpu(wakee); |
| 422 | |
| 423 | if (!call_filter_check_discard(call, entry, buffer, event)) |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 424 | trace_buffer_unlock_commit(tr, buffer, event, trace_ctx); |
Steven Rostedt (Red Hat) | 243f761 | 2014-10-30 20:44:53 -0400 | [diff] [blame] | 425 | } |
| 426 | |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 427 | static void notrace |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 428 | probe_wakeup_sched_switch(void *ignore, bool preempt, |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 429 | struct task_struct *prev, struct task_struct *next) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 430 | { |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 431 | struct trace_array_cpu *data; |
Thomas Gleixner | a5a1d1c | 2016-12-21 20:32:01 +0100 | [diff] [blame] | 432 | u64 T0, T1, delta; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 433 | unsigned long flags; |
| 434 | long disabled; |
| 435 | int cpu; |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 436 | unsigned int trace_ctx; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 437 | |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 438 | tracing_record_cmdline(prev); |
| 439 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 440 | if (unlikely(!tracer_enabled)) |
| 441 | return; |
| 442 | |
| 443 | /* |
| 444 | * When we start a new trace, we set wakeup_task to NULL |
| 445 | * and then set tracer_enabled = 1. We want to make sure |
| 446 | * that another CPU does not see the tracer_enabled = 1 |
| 447 | * and the wakeup_task with an older task, that might |
| 448 | * actually be the same as next. |
| 449 | */ |
| 450 | smp_rmb(); |
| 451 | |
| 452 | if (next != wakeup_task) |
| 453 | return; |
| 454 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 455 | /* disable local data, not wakeup_cpu data */ |
| 456 | cpu = raw_smp_processor_id(); |
Steven Rostedt (VMware) | 1c5eb44 | 2020-01-09 18:53:48 -0500 | [diff] [blame] | 457 | disabled = atomic_inc_return(&per_cpu_ptr(wakeup_trace->array_buffer.data, cpu)->disabled); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 458 | if (likely(disabled != 1)) |
| 459 | goto out; |
| 460 | |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 461 | local_irq_save(flags); |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 462 | trace_ctx = tracing_gen_ctx_flags(flags); |
| 463 | |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 464 | arch_spin_lock(&wakeup_lock); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 465 | |
| 466 | /* We could race with grabbing wakeup_lock */ |
| 467 | if (unlikely(!tracer_enabled || next != wakeup_task)) |
| 468 | goto out_unlock; |
| 469 | |
Steven Rostedt | 9be2441 | 2009-03-26 10:25:24 -0400 | [diff] [blame] | 470 | /* The task we are waiting for is waking up */ |
Steven Rostedt (VMware) | 1c5eb44 | 2020-01-09 18:53:48 -0500 | [diff] [blame] | 471 | data = per_cpu_ptr(wakeup_trace->array_buffer.data, wakeup_cpu); |
Steven Rostedt | 9be2441 | 2009-03-26 10:25:24 -0400 | [diff] [blame] | 472 | |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 473 | __trace_function(wakeup_trace, CALLER_ADDR0, CALLER_ADDR1, trace_ctx); |
| 474 | tracing_sched_switch_trace(wakeup_trace, prev, next, trace_ctx); |
| 475 | __trace_stack(wakeup_trace, trace_ctx, 0); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 476 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 477 | T0 = data->preempt_timestamp; |
Ingo Molnar | 750ed1a | 2008-05-12 21:20:46 +0200 | [diff] [blame] | 478 | T1 = ftrace_now(cpu); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 479 | delta = T1-T0; |
| 480 | |
Steven Rostedt (Red Hat) | 6d9b3fa | 2014-01-14 11:28:38 -0500 | [diff] [blame] | 481 | if (!report_latency(wakeup_trace, delta)) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 482 | goto out_unlock; |
| 483 | |
Carsten Emde | b5130b1 | 2009-09-13 01:43:07 +0200 | [diff] [blame] | 484 | if (likely(!is_tracing_stopped())) { |
Steven Rostedt (Red Hat) | 6d9b3fa | 2014-01-14 11:28:38 -0500 | [diff] [blame] | 485 | wakeup_trace->max_latency = delta; |
Tom Zanussi | a35873a | 2019-02-13 17:42:45 -0600 | [diff] [blame] | 486 | update_max_tr(wakeup_trace, wakeup_task, wakeup_cpu, NULL); |
Carsten Emde | b5130b1 | 2009-09-13 01:43:07 +0200 | [diff] [blame] | 487 | } |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 488 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 489 | out_unlock: |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 490 | __wakeup_reset(wakeup_trace); |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 491 | arch_spin_unlock(&wakeup_lock); |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 492 | local_irq_restore(flags); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 493 | out: |
Steven Rostedt (VMware) | 1c5eb44 | 2020-01-09 18:53:48 -0500 | [diff] [blame] | 494 | atomic_dec(&per_cpu_ptr(wakeup_trace->array_buffer.data, cpu)->disabled); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 495 | } |
| 496 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 497 | static void __wakeup_reset(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 498 | { |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 499 | wakeup_cpu = -1; |
| 500 | wakeup_prio = -1; |
Austin Kim | bfbf8d1 | 2021-06-29 15:05:48 +0100 | [diff] [blame] | 501 | tracing_dl = false; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 502 | |
| 503 | if (wakeup_task) |
| 504 | put_task_struct(wakeup_task); |
| 505 | |
| 506 | wakeup_task = NULL; |
| 507 | } |
| 508 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 509 | static void wakeup_reset(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 510 | { |
| 511 | unsigned long flags; |
| 512 | |
Steven Rostedt (VMware) | 1c5eb44 | 2020-01-09 18:53:48 -0500 | [diff] [blame] | 513 | tracing_reset_online_cpus(&tr->array_buffer); |
Steven Rostedt | 2f26ebd | 2009-09-01 11:06:29 -0400 | [diff] [blame] | 514 | |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 515 | local_irq_save(flags); |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 516 | arch_spin_lock(&wakeup_lock); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 517 | __wakeup_reset(tr); |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 518 | arch_spin_unlock(&wakeup_lock); |
Steven Rostedt | e59494f | 2008-07-16 00:13:45 -0400 | [diff] [blame] | 519 | local_irq_restore(flags); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 520 | } |
| 521 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 522 | static void |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 523 | probe_wakeup(void *ignore, struct task_struct *p) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 524 | { |
Steven Rostedt | f8ec106 | 2009-01-21 17:17:04 -0500 | [diff] [blame] | 525 | struct trace_array_cpu *data; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 526 | int cpu = smp_processor_id(); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 527 | long disabled; |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 528 | unsigned int trace_ctx; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 529 | |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 530 | if (likely(!tracer_enabled)) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 531 | return; |
| 532 | |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 533 | tracing_record_cmdline(p); |
| 534 | tracing_record_cmdline(current); |
| 535 | |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 536 | /* |
| 537 | * Semantic is like this: |
| 538 | * - wakeup tracer handles all tasks in the system, independently |
| 539 | * from their scheduling class; |
| 540 | * - wakeup_rt tracer handles tasks belonging to sched_dl and |
| 541 | * sched_rt class; |
| 542 | * - wakeup_dl handles tasks belonging to sched_dl class only. |
| 543 | */ |
| 544 | if (tracing_dl || (wakeup_dl && !dl_task(p)) || |
| 545 | (wakeup_rt && !dl_task(p) && !rt_task(p)) || |
| 546 | (!dl_task(p) && (p->prio >= wakeup_prio || p->prio >= current->prio))) |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 547 | return; |
| 548 | |
Steven Rostedt (VMware) | 1c5eb44 | 2020-01-09 18:53:48 -0500 | [diff] [blame] | 549 | disabled = atomic_inc_return(&per_cpu_ptr(wakeup_trace->array_buffer.data, cpu)->disabled); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 550 | if (unlikely(disabled != 1)) |
| 551 | goto out; |
| 552 | |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 553 | trace_ctx = tracing_gen_ctx(); |
| 554 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 555 | /* interrupts should be off from try_to_wake_up */ |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 556 | arch_spin_lock(&wakeup_lock); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 557 | |
| 558 | /* check for races. */ |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 559 | if (!tracer_enabled || tracing_dl || |
| 560 | (!dl_task(p) && p->prio >= wakeup_prio)) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 561 | goto out_locked; |
| 562 | |
| 563 | /* reset the trace */ |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 564 | __wakeup_reset(wakeup_trace); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 565 | |
| 566 | wakeup_cpu = task_cpu(p); |
Steven Rostedt | 478142c3 | 2009-09-09 10:36:01 -0400 | [diff] [blame] | 567 | wakeup_current_cpu = wakeup_cpu; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 568 | wakeup_prio = p->prio; |
| 569 | |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 570 | /* |
| 571 | * Once you start tracing a -deadline task, don't bother tracing |
| 572 | * another task until the first one wakes up. |
| 573 | */ |
| 574 | if (dl_task(p)) |
Austin Kim | bfbf8d1 | 2021-06-29 15:05:48 +0100 | [diff] [blame] | 575 | tracing_dl = true; |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 576 | else |
Austin Kim | bfbf8d1 | 2021-06-29 15:05:48 +0100 | [diff] [blame] | 577 | tracing_dl = false; |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 578 | |
Matthew Wilcox (Oracle) | 7b3c92b | 2019-07-04 15:13:23 -0700 | [diff] [blame] | 579 | wakeup_task = get_task_struct(p); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 580 | |
Steven Rostedt (VMware) | 1c5eb44 | 2020-01-09 18:53:48 -0500 | [diff] [blame] | 581 | data = per_cpu_ptr(wakeup_trace->array_buffer.data, wakeup_cpu); |
Steven Rostedt | f8ec106 | 2009-01-21 17:17:04 -0500 | [diff] [blame] | 582 | data->preempt_timestamp = ftrace_now(cpu); |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 583 | tracing_sched_wakeup_trace(wakeup_trace, p, current, trace_ctx); |
| 584 | __trace_stack(wakeup_trace, trace_ctx, 0); |
Steven Rostedt | 301fd74 | 2009-04-03 11:12:23 -0400 | [diff] [blame] | 585 | |
| 586 | /* |
| 587 | * We must be careful in using CALLER_ADDR2. But since wake_up |
| 588 | * is not called by an assembly function (where as schedule is) |
| 589 | * it should be safe to use it here. |
| 590 | */ |
Sebastian Andrzej Siewior | 36590c50 | 2021-01-25 20:45:08 +0100 | [diff] [blame] | 591 | __trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, trace_ctx); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 592 | |
| 593 | out_locked: |
Thomas Gleixner | 0199c4e | 2009-12-02 20:01:25 +0100 | [diff] [blame] | 594 | arch_spin_unlock(&wakeup_lock); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 595 | out: |
Steven Rostedt (VMware) | 1c5eb44 | 2020-01-09 18:53:48 -0500 | [diff] [blame] | 596 | atomic_dec(&per_cpu_ptr(wakeup_trace->array_buffer.data, cpu)->disabled); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 597 | } |
| 598 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 599 | static void start_wakeup_tracer(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 600 | { |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 601 | int ret; |
| 602 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 603 | ret = register_trace_sched_wakeup(probe_wakeup, NULL); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 604 | if (ret) { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 605 | pr_info("wakeup trace: Couldn't activate tracepoint" |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 606 | " probe to kernel_sched_wakeup\n"); |
| 607 | return; |
| 608 | } |
| 609 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 610 | ret = register_trace_sched_wakeup_new(probe_wakeup, NULL); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 611 | if (ret) { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 612 | pr_info("wakeup trace: Couldn't activate tracepoint" |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 613 | " probe to kernel_sched_wakeup_new\n"); |
| 614 | goto fail_deprobe; |
| 615 | } |
| 616 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 617 | ret = register_trace_sched_switch(probe_wakeup_sched_switch, NULL); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 618 | if (ret) { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 619 | pr_info("sched trace: Couldn't activate tracepoint" |
Wenji Huang | 73d8b8b | 2009-02-17 01:10:02 -0500 | [diff] [blame] | 620 | " probe to kernel_sched_switch\n"); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 621 | goto fail_deprobe_wake_new; |
| 622 | } |
| 623 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 624 | ret = register_trace_sched_migrate_task(probe_wakeup_migrate_task, NULL); |
Steven Rostedt | 478142c3 | 2009-09-09 10:36:01 -0400 | [diff] [blame] | 625 | if (ret) { |
| 626 | pr_info("wakeup trace: Couldn't activate tracepoint" |
| 627 | " probe to kernel_sched_migrate_task\n"); |
Kaitao Cheng | 50f9ad6 | 2019-12-31 05:35:30 -0800 | [diff] [blame] | 628 | goto fail_deprobe_sched_switch; |
Steven Rostedt | 478142c3 | 2009-09-09 10:36:01 -0400 | [diff] [blame] | 629 | } |
| 630 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 631 | wakeup_reset(tr); |
| 632 | |
| 633 | /* |
| 634 | * Don't let the tracer_enabled = 1 show up before |
| 635 | * the wakeup_task is reset. This may be overkill since |
| 636 | * wakeup_reset does a spin_unlock after setting the |
| 637 | * wakeup_task to NULL, but I want to be safe. |
| 638 | * This is a slow path anyway. |
| 639 | */ |
| 640 | smp_wmb(); |
| 641 | |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 642 | if (start_func_tracer(tr, is_graph(tr))) |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 643 | printk(KERN_ERR "failed to start wakeup tracer\n"); |
Steven Rostedt | ad59124 | 2008-07-10 20:58:13 -0400 | [diff] [blame] | 644 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 645 | return; |
Kaitao Cheng | 50f9ad6 | 2019-12-31 05:35:30 -0800 | [diff] [blame] | 646 | fail_deprobe_sched_switch: |
| 647 | unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 648 | fail_deprobe_wake_new: |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 649 | unregister_trace_sched_wakeup_new(probe_wakeup, NULL); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 650 | fail_deprobe: |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 651 | unregister_trace_sched_wakeup(probe_wakeup, NULL); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 652 | } |
| 653 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 654 | static void stop_wakeup_tracer(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 655 | { |
| 656 | tracer_enabled = 0; |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 657 | stop_func_tracer(tr, is_graph(tr)); |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 658 | unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL); |
| 659 | unregister_trace_sched_wakeup_new(probe_wakeup, NULL); |
| 660 | unregister_trace_sched_wakeup(probe_wakeup, NULL); |
| 661 | unregister_trace_sched_migrate_task(probe_wakeup_migrate_task, NULL); |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 662 | } |
| 663 | |
Steven Rostedt (Red Hat) | 65daaca7 | 2014-01-14 07:06:29 -0500 | [diff] [blame] | 664 | static bool wakeup_busy; |
| 665 | |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 666 | static int __wakeup_tracer_init(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 667 | { |
Steven Rostedt (Red Hat) | 983f938 | 2015-09-30 09:42:05 -0400 | [diff] [blame] | 668 | save_flags = tr->trace_flags; |
Steven Rostedt (Red Hat) | 613f04a | 2013-03-14 15:03:53 -0400 | [diff] [blame] | 669 | |
| 670 | /* non overwrite screws up the latency tracers */ |
Steven Rostedt | 2b6080f | 2012-05-11 13:29:49 -0400 | [diff] [blame] | 671 | set_tracer_flag(tr, TRACE_ITER_OVERWRITE, 1); |
| 672 | set_tracer_flag(tr, TRACE_ITER_LATENCY_FMT, 1); |
Steven Rostedt | e9d25fe | 2009-03-04 22:15:30 -0500 | [diff] [blame] | 673 | |
Steven Rostedt (Red Hat) | 6d9b3fa | 2014-01-14 11:28:38 -0500 | [diff] [blame] | 674 | tr->max_latency = 0; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 675 | wakeup_trace = tr; |
Steven Rostedt (Red Hat) | 4104d32 | 2014-01-10 17:01:58 -0500 | [diff] [blame] | 676 | ftrace_init_array_ops(tr, wakeup_tracer_call); |
Steven Rostedt | c76f069 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 677 | start_wakeup_tracer(tr); |
Steven Rostedt (Red Hat) | 65daaca7 | 2014-01-14 07:06:29 -0500 | [diff] [blame] | 678 | |
| 679 | wakeup_busy = true; |
Frederic Weisbecker | 1c80025 | 2008-11-16 05:57:26 +0100 | [diff] [blame] | 680 | return 0; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 681 | } |
| 682 | |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 683 | static int wakeup_tracer_init(struct trace_array *tr) |
| 684 | { |
Steven Rostedt (Red Hat) | 65daaca7 | 2014-01-14 07:06:29 -0500 | [diff] [blame] | 685 | if (wakeup_busy) |
| 686 | return -EBUSY; |
| 687 | |
Austin Kim | bfbf8d1 | 2021-06-29 15:05:48 +0100 | [diff] [blame] | 688 | wakeup_dl = false; |
| 689 | wakeup_rt = false; |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 690 | return __wakeup_tracer_init(tr); |
| 691 | } |
| 692 | |
| 693 | static int wakeup_rt_tracer_init(struct trace_array *tr) |
| 694 | { |
Steven Rostedt (Red Hat) | 65daaca7 | 2014-01-14 07:06:29 -0500 | [diff] [blame] | 695 | if (wakeup_busy) |
| 696 | return -EBUSY; |
| 697 | |
Austin Kim | bfbf8d1 | 2021-06-29 15:05:48 +0100 | [diff] [blame] | 698 | wakeup_dl = false; |
| 699 | wakeup_rt = true; |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 700 | return __wakeup_tracer_init(tr); |
| 701 | } |
| 702 | |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 703 | static int wakeup_dl_tracer_init(struct trace_array *tr) |
| 704 | { |
Steven Rostedt (Red Hat) | 65daaca7 | 2014-01-14 07:06:29 -0500 | [diff] [blame] | 705 | if (wakeup_busy) |
| 706 | return -EBUSY; |
| 707 | |
Austin Kim | bfbf8d1 | 2021-06-29 15:05:48 +0100 | [diff] [blame] | 708 | wakeup_dl = true; |
| 709 | wakeup_rt = false; |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 710 | return __wakeup_tracer_init(tr); |
| 711 | } |
| 712 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 713 | static void wakeup_tracer_reset(struct trace_array *tr) |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 714 | { |
Steven Rostedt (Red Hat) | 613f04a | 2013-03-14 15:03:53 -0400 | [diff] [blame] | 715 | int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT; |
| 716 | int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE; |
| 717 | |
Steven Rostedt | c76f069 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 718 | stop_wakeup_tracer(tr); |
| 719 | /* make sure we put back any tasks we are tracing */ |
| 720 | wakeup_reset(tr); |
Steven Rostedt | e9d25fe | 2009-03-04 22:15:30 -0500 | [diff] [blame] | 721 | |
Steven Rostedt | 2b6080f | 2012-05-11 13:29:49 -0400 | [diff] [blame] | 722 | set_tracer_flag(tr, TRACE_ITER_LATENCY_FMT, lat_flag); |
| 723 | set_tracer_flag(tr, TRACE_ITER_OVERWRITE, overwrite_flag); |
Steven Rostedt (Red Hat) | 4104d32 | 2014-01-10 17:01:58 -0500 | [diff] [blame] | 724 | ftrace_reset_array_ops(tr); |
Steven Rostedt (Red Hat) | 65daaca7 | 2014-01-14 07:06:29 -0500 | [diff] [blame] | 725 | wakeup_busy = false; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 726 | } |
| 727 | |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 728 | static void wakeup_tracer_start(struct trace_array *tr) |
| 729 | { |
| 730 | wakeup_reset(tr); |
| 731 | tracer_enabled = 1; |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | static void wakeup_tracer_stop(struct trace_array *tr) |
| 735 | { |
| 736 | tracer_enabled = 0; |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | static struct tracer wakeup_tracer __read_mostly = |
| 740 | { |
| 741 | .name = "wakeup", |
| 742 | .init = wakeup_tracer_init, |
| 743 | .reset = wakeup_tracer_reset, |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 744 | .start = wakeup_tracer_start, |
| 745 | .stop = wakeup_tracer_stop, |
Hiraku Toyooka | f43c738 | 2012-10-02 17:27:10 +0900 | [diff] [blame] | 746 | .print_max = true, |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 747 | .print_header = wakeup_print_header, |
| 748 | .print_line = wakeup_print_line, |
Steven Rostedt (Red Hat) | 328df47 | 2013-03-14 12:10:40 -0400 | [diff] [blame] | 749 | .flag_changed = wakeup_flag_changed, |
Steven Rostedt | 60a1177 | 2008-05-12 21:20:44 +0200 | [diff] [blame] | 750 | #ifdef CONFIG_FTRACE_SELFTEST |
| 751 | .selftest = trace_selftest_startup_wakeup, |
| 752 | #endif |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 753 | .open = wakeup_trace_open, |
| 754 | .close = wakeup_trace_close, |
Steven Rostedt (Red Hat) | 65daaca7 | 2014-01-14 07:06:29 -0500 | [diff] [blame] | 755 | .allow_instances = true, |
Hiraku Toyooka | f43c738 | 2012-10-02 17:27:10 +0900 | [diff] [blame] | 756 | .use_max_tr = true, |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 757 | }; |
| 758 | |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 759 | static struct tracer wakeup_rt_tracer __read_mostly = |
| 760 | { |
| 761 | .name = "wakeup_rt", |
| 762 | .init = wakeup_rt_tracer_init, |
| 763 | .reset = wakeup_tracer_reset, |
| 764 | .start = wakeup_tracer_start, |
| 765 | .stop = wakeup_tracer_stop, |
Hiraku Toyooka | f43c738 | 2012-10-02 17:27:10 +0900 | [diff] [blame] | 766 | .print_max = true, |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 767 | .print_header = wakeup_print_header, |
| 768 | .print_line = wakeup_print_line, |
Steven Rostedt (Red Hat) | 328df47 | 2013-03-14 12:10:40 -0400 | [diff] [blame] | 769 | .flag_changed = wakeup_flag_changed, |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 770 | #ifdef CONFIG_FTRACE_SELFTEST |
| 771 | .selftest = trace_selftest_startup_wakeup, |
| 772 | #endif |
Jiri Olsa | 7495a5b | 2010-09-23 14:00:53 +0200 | [diff] [blame] | 773 | .open = wakeup_trace_open, |
| 774 | .close = wakeup_trace_close, |
Steven Rostedt (Red Hat) | 65daaca7 | 2014-01-14 07:06:29 -0500 | [diff] [blame] | 775 | .allow_instances = true, |
Hiraku Toyooka | f43c738 | 2012-10-02 17:27:10 +0900 | [diff] [blame] | 776 | .use_max_tr = true, |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 777 | }; |
| 778 | |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 779 | static struct tracer wakeup_dl_tracer __read_mostly = |
| 780 | { |
| 781 | .name = "wakeup_dl", |
| 782 | .init = wakeup_dl_tracer_init, |
| 783 | .reset = wakeup_tracer_reset, |
| 784 | .start = wakeup_tracer_start, |
| 785 | .stop = wakeup_tracer_stop, |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 786 | .print_max = true, |
| 787 | .print_header = wakeup_print_header, |
| 788 | .print_line = wakeup_print_line, |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 789 | .flag_changed = wakeup_flag_changed, |
| 790 | #ifdef CONFIG_FTRACE_SELFTEST |
| 791 | .selftest = trace_selftest_startup_wakeup, |
| 792 | #endif |
| 793 | .open = wakeup_trace_open, |
| 794 | .close = wakeup_trace_close, |
Zhou Chengming | 8d414bd | 2016-11-14 11:19:13 +0800 | [diff] [blame] | 795 | .allow_instances = true, |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 796 | .use_max_tr = true, |
| 797 | }; |
| 798 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 799 | __init static int init_wakeup_tracer(void) |
| 800 | { |
| 801 | int ret; |
| 802 | |
| 803 | ret = register_tracer(&wakeup_tracer); |
| 804 | if (ret) |
| 805 | return ret; |
| 806 | |
Steven Rostedt | 3244351 | 2009-01-21 16:24:46 -0500 | [diff] [blame] | 807 | ret = register_tracer(&wakeup_rt_tracer); |
| 808 | if (ret) |
| 809 | return ret; |
| 810 | |
Dario Faggioli | af6ace7 | 2013-11-07 14:43:42 +0100 | [diff] [blame] | 811 | ret = register_tracer(&wakeup_dl_tracer); |
| 812 | if (ret) |
| 813 | return ret; |
| 814 | |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 815 | return 0; |
| 816 | } |
Steven Rostedt | 6f41567 | 2012-10-05 12:13:07 -0400 | [diff] [blame] | 817 | core_initcall(init_wakeup_tracer); |