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