Lines Matching refs:tr
72 #define do_for_each_event_file(tr, file) \ argument
73 list_for_each_entry(tr, &ftrace_trace_arrays, list) { \
74 list_for_each_entry(file, &tr->events, list)
76 #define do_for_each_event_file_safe(tr, file) \ argument
77 list_for_each_entry(tr, &ftrace_trace_arrays, list) { \
79 list_for_each_entry_safe(file, ___n, &tr->events, list)
461 struct trace_array *tr = trace_file->tr; in trace_event_ignore_this_pid() local
466 pid_list = rcu_dereference_raw(tr->filtered_pids); in trace_event_ignore_this_pid()
467 no_pid_list = rcu_dereference_raw(tr->filtered_no_pids); in trace_event_ignore_this_pid()
472 data = this_cpu_ptr(tr->array_buffer.data); in trace_event_ignore_this_pid()
551 struct trace_array *tr; in trace_event_enable_cmd_record() local
555 do_for_each_event_file(tr, file) { in trace_event_enable_cmd_record()
573 struct trace_array *tr; in trace_event_enable_tgid_record() local
577 do_for_each_event_file(tr, file) { in trace_event_enable_tgid_record()
596 struct trace_array *tr = file->tr; in __ftrace_event_enable_disable() local
668 if (tr->trace_flags & TRACE_ITER_RECORD_CMD) { in __ftrace_event_enable_disable()
674 if (tr->trace_flags & TRACE_ITER_RECORD_TGID) { in __ftrace_event_enable_disable()
722 static void ftrace_clear_events(struct trace_array *tr) in ftrace_clear_events() argument
727 list_for_each_entry(file, &tr->events, list) { in ftrace_clear_events()
737 struct trace_array *tr = data; in event_filter_pid_sched_process_exit() local
739 pid_list = rcu_dereference_raw(tr->filtered_pids); in event_filter_pid_sched_process_exit()
742 pid_list = rcu_dereference_raw(tr->filtered_no_pids); in event_filter_pid_sched_process_exit()
752 struct trace_array *tr = data; in event_filter_pid_sched_process_fork() local
754 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_process_fork()
757 pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_process_fork()
761 void trace_event_follow_fork(struct trace_array *tr, bool enable) in trace_event_follow_fork() argument
765 tr, INT_MIN); in trace_event_follow_fork()
767 tr, INT_MAX); in trace_event_follow_fork()
770 tr); in trace_event_follow_fork()
772 tr); in trace_event_follow_fork()
782 struct trace_array *tr = data; in event_filter_pid_sched_switch_probe_pre() local
787 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_switch_probe_pre()
788 no_pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_switch_probe_pre()
797 this_cpu_write(tr->array_buffer.data->ignore_pid, ret || in event_filter_pid_sched_switch_probe_pre()
808 struct trace_array *tr = data; in event_filter_pid_sched_switch_probe_post() local
812 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_switch_probe_post()
813 no_pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_switch_probe_post()
815 this_cpu_write(tr->array_buffer.data->ignore_pid, in event_filter_pid_sched_switch_probe_post()
822 struct trace_array *tr = data; in event_filter_pid_sched_wakeup_probe_pre() local
827 if (!this_cpu_read(tr->array_buffer.data->ignore_pid)) in event_filter_pid_sched_wakeup_probe_pre()
830 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_wakeup_probe_pre()
831 no_pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_wakeup_probe_pre()
833 this_cpu_write(tr->array_buffer.data->ignore_pid, in event_filter_pid_sched_wakeup_probe_pre()
840 struct trace_array *tr = data; in event_filter_pid_sched_wakeup_probe_post() local
845 if (this_cpu_read(tr->array_buffer.data->ignore_pid)) in event_filter_pid_sched_wakeup_probe_post()
848 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_wakeup_probe_post()
849 no_pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_wakeup_probe_post()
852 this_cpu_write(tr->array_buffer.data->ignore_pid, in event_filter_pid_sched_wakeup_probe_post()
856 static void unregister_pid_events(struct trace_array *tr) in unregister_pid_events() argument
858 unregister_trace_sched_switch(event_filter_pid_sched_switch_probe_pre, tr); in unregister_pid_events()
859 unregister_trace_sched_switch(event_filter_pid_sched_switch_probe_post, tr); in unregister_pid_events()
861 unregister_trace_sched_wakeup(event_filter_pid_sched_wakeup_probe_pre, tr); in unregister_pid_events()
862 unregister_trace_sched_wakeup(event_filter_pid_sched_wakeup_probe_post, tr); in unregister_pid_events()
864 unregister_trace_sched_wakeup_new(event_filter_pid_sched_wakeup_probe_pre, tr); in unregister_pid_events()
865 unregister_trace_sched_wakeup_new(event_filter_pid_sched_wakeup_probe_post, tr); in unregister_pid_events()
867 unregister_trace_sched_waking(event_filter_pid_sched_wakeup_probe_pre, tr); in unregister_pid_events()
868 unregister_trace_sched_waking(event_filter_pid_sched_wakeup_probe_post, tr); in unregister_pid_events()
871 static void __ftrace_clear_event_pids(struct trace_array *tr, int type) in __ftrace_clear_event_pids() argument
878 pid_list = rcu_dereference_protected(tr->filtered_pids, in __ftrace_clear_event_pids()
880 no_pid_list = rcu_dereference_protected(tr->filtered_no_pids, in __ftrace_clear_event_pids()
888 unregister_pid_events(tr); in __ftrace_clear_event_pids()
890 list_for_each_entry(file, &tr->events, list) { in __ftrace_clear_event_pids()
895 per_cpu_ptr(tr->array_buffer.data, cpu)->ignore_pid = false; in __ftrace_clear_event_pids()
899 rcu_assign_pointer(tr->filtered_pids, NULL); in __ftrace_clear_event_pids()
902 rcu_assign_pointer(tr->filtered_no_pids, NULL); in __ftrace_clear_event_pids()
914 static void ftrace_clear_event_pids(struct trace_array *tr, int type) in ftrace_clear_event_pids() argument
917 __ftrace_clear_event_pids(tr, type); in ftrace_clear_event_pids()
1008 __ftrace_set_clr_event_nolock(struct trace_array *tr, const char *match, in __ftrace_set_clr_event_nolock() argument
1017 list_for_each_entry(file, &tr->events, list) { in __ftrace_set_clr_event_nolock()
1055 static int __ftrace_set_clr_event(struct trace_array *tr, const char *match, in __ftrace_set_clr_event() argument
1061 ret = __ftrace_set_clr_event_nolock(tr, match, sub, event, set); in __ftrace_set_clr_event()
1067 int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set) in ftrace_set_clr_event() argument
1072 if (!tr) in ftrace_set_clr_event()
1098 ret = __ftrace_set_clr_event(tr, match, sub, event, set); in ftrace_set_clr_event()
1121 struct trace_array *tr = top_trace_array(); in trace_set_clr_event() local
1123 if (!tr) in trace_set_clr_event()
1126 return __ftrace_set_clr_event(tr, NULL, system, event, set); in trace_set_clr_event()
1143 int trace_array_set_clr_event(struct trace_array *tr, const char *system, in trace_array_set_clr_event() argument
1148 if (!tr) in trace_array_set_clr_event()
1152 return __ftrace_set_clr_event(tr, NULL, system, event, set); in trace_array_set_clr_event()
1165 struct trace_array *tr = m->private; in ftrace_event_write() local
1186 ret = ftrace_set_clr_event(tr, parser.buffer + !set, set); in ftrace_event_write()
1204 struct trace_array *tr = m->private; in t_next() local
1208 list_for_each_entry_continue(file, &tr->events, list) { in t_next()
1225 struct trace_array *tr = m->private; in t_start() local
1230 file = list_entry(&tr->events, struct trace_event_file, list); in t_start()
1243 struct trace_array *tr = m->private; in s_next() local
1247 list_for_each_entry_continue(file, &tr->events, list) { in s_next()
1258 struct trace_array *tr = m->private; in s_start() local
1263 file = list_entry(&tr->events, struct trace_event_file, list); in s_start()
1292 struct trace_array *tr = m->private; in __next() local
1296 pid_list = rcu_dereference_sched(tr->filtered_pids); in __next()
1298 pid_list = rcu_dereference_sched(tr->filtered_no_pids); in __next()
1319 struct trace_array *tr = m->private; in __start() local
1331 pid_list = rcu_dereference_sched(tr->filtered_pids); in __start()
1333 pid_list = rcu_dereference_sched(tr->filtered_no_pids); in __start()
1435 struct trace_array *tr = dir->tr; in system_enable_read() local
1441 list_for_each_entry(file, &tr->events, list) { in system_enable_read()
1501 ret = __ftrace_set_clr_event(dir->tr, NULL, name, NULL, val); in system_enable_write()
1729 struct trace_array *tr = NULL, *iter_tr; in subsystem_open() local
1743 tr = iter_tr; in subsystem_open()
1761 if (trace_array_get(tr) < 0) { in subsystem_open()
1768 trace_array_put(tr); in subsystem_open()
1778 struct trace_array *tr = inode->i_private; in system_tr_open() local
1791 dir->tr = tr; in system_tr_open()
1801 trace_array_put(dir->tr); in subsystem_release()
1895 struct trace_array *tr = data; in ignore_task_cpu() local
1903 pid_list = rcu_dereference_protected(tr->filtered_pids, in ignore_task_cpu()
1905 no_pid_list = rcu_dereference_protected(tr->filtered_no_pids, in ignore_task_cpu()
1908 this_cpu_write(tr->array_buffer.data->ignore_pid, in ignore_task_cpu()
1912 static void register_pid_events(struct trace_array *tr) in register_pid_events() argument
1921 tr, INT_MAX); in register_pid_events()
1923 tr, 0); in register_pid_events()
1926 tr, INT_MAX); in register_pid_events()
1928 tr, 0); in register_pid_events()
1931 tr, INT_MAX); in register_pid_events()
1933 tr, 0); in register_pid_events()
1936 tr, INT_MAX); in register_pid_events()
1938 tr, 0); in register_pid_events()
1946 struct trace_array *tr = m->private; in event_pid_write() local
1963 filtered_pids = rcu_dereference_protected(tr->filtered_pids, in event_pid_write()
1965 other_pids = rcu_dereference_protected(tr->filtered_no_pids, in event_pid_write()
1968 filtered_pids = rcu_dereference_protected(tr->filtered_no_pids, in event_pid_write()
1970 other_pids = rcu_dereference_protected(tr->filtered_pids, in event_pid_write()
1979 rcu_assign_pointer(tr->filtered_pids, pid_list); in event_pid_write()
1981 rcu_assign_pointer(tr->filtered_no_pids, pid_list); in event_pid_write()
1983 list_for_each_entry(file, &tr->events, list) { in event_pid_write()
1991 register_pid_events(tr); in event_pid_write()
1999 on_each_cpu(ignore_task_cpu, tr, 1); in event_pid_write()
2168 struct trace_array *tr = inode->i_private; in ftrace_event_release() local
2170 trace_array_put(tr); in ftrace_event_release()
2188 struct trace_array *tr = inode->i_private; in ftrace_event_set_open() local
2191 ret = tracing_check_open_get_tr(tr); in ftrace_event_set_open()
2197 ftrace_clear_events(tr); in ftrace_event_set_open()
2201 trace_array_put(tr); in ftrace_event_set_open()
2209 struct trace_array *tr = inode->i_private; in ftrace_event_set_pid_open() local
2212 ret = tracing_check_open_get_tr(tr); in ftrace_event_set_pid_open()
2218 ftrace_clear_event_pids(tr, TRACE_PIDS); in ftrace_event_set_pid_open()
2222 trace_array_put(tr); in ftrace_event_set_pid_open()
2230 struct trace_array *tr = inode->i_private; in ftrace_event_set_npid_open() local
2233 ret = tracing_check_open_get_tr(tr); in ftrace_event_set_npid_open()
2239 ftrace_clear_event_pids(tr, TRACE_NO_PIDS); in ftrace_event_set_npid_open()
2243 trace_array_put(tr); in ftrace_event_set_npid_open()
2281 event_subsystem_dir(struct trace_array *tr, const char *name, in event_subsystem_dir() argument
2289 list_for_each_entry(dir, &tr->systems, list) { in event_subsystem_dir()
2325 dir->tr = tr; in event_subsystem_dir()
2347 list_add(&dir->list, &tr->systems); in event_subsystem_dir()
2401 struct trace_array *tr = file->tr; in event_create_dir() local
2411 d_events = event_subsystem_dir(tr, call->class->system, file, parent); in event_create_dir()
2476 struct trace_array *tr; in remove_event_from_tracers() local
2478 do_for_each_event_file_safe(tr, file) { in remove_event_from_tracers()
2495 struct trace_array *tr; in event_remove() local
2498 do_for_each_event_file(tr, file) { in event_remove()
2503 tr->clear_trace = true; in event_remove()
2769 struct trace_array *tr) in trace_create_new_event() argument
2780 pid_list = rcu_dereference_protected(tr->filtered_pids, in trace_create_new_event()
2782 no_pid_list = rcu_dereference_protected(tr->filtered_no_pids, in trace_create_new_event()
2790 file->tr = tr; in trace_create_new_event()
2794 list_add(&file->list, &tr->events); in trace_create_new_event()
2801 __trace_add_new_event(struct trace_event_call *call, struct trace_array *tr) in __trace_add_new_event() argument
2805 file = trace_create_new_event(call, tr); in __trace_add_new_event()
2810 return event_create_dir(tr->event_dir, file); in __trace_add_new_event()
2822 struct trace_array *tr) in __trace_early_add_new_event() argument
2826 file = trace_create_new_event(call, tr); in __trace_early_add_new_event()
2867 struct trace_array *tr; in probe_remove_event_call() local
2874 do_for_each_event_file(tr, file) { in probe_remove_event_call()
2886 tr->clear_trace = true; in probe_remove_event_call()
2901 list_for_each_entry(tr, &ftrace_trace_arrays, list) { in probe_remove_event_call()
2902 tr->clear_trace = false; in probe_remove_event_call()
3016 __trace_add_event_dirs(struct trace_array *tr) in __trace_add_event_dirs() argument
3022 ret = __trace_add_new_event(call, tr); in __trace_add_event_dirs()
3031 __find_event_file(struct trace_array *tr, const char *system, const char *event) in __find_event_file() argument
3037 list_for_each_entry(file, &tr->events, list) { in __find_event_file()
3054 find_event_file(struct trace_array *tr, const char *system, const char *event) in find_event_file() argument
3058 file = __find_event_file(tr, system, event); in find_event_file()
3090 struct trace_array *tr = top_trace_array(); in trace_get_event_file() local
3095 tr = trace_array_find_get(instance); in trace_get_event_file()
3096 if (!tr) in trace_get_event_file()
3099 ret = trace_array_get(tr); in trace_get_event_file()
3106 file = find_event_file(tr, system, event); in trace_get_event_file()
3108 trace_array_put(tr); in trace_get_event_file()
3116 trace_array_put(tr); in trace_get_event_file()
3147 trace_array_put(file->tr); in trace_put_event_file()
3174 struct trace_array *tr, struct ftrace_probe_ops *ops, in event_enable_probe() argument
3191 struct trace_array *tr, struct ftrace_probe_ops *ops, in event_enable_count_probe() argument
3248 event_enable_init(struct ftrace_probe_ops *ops, struct trace_array *tr, in event_enable_init() argument
3286 event_enable_free(struct ftrace_probe_ops *ops, struct trace_array *tr, in event_enable_free() argument
3339 event_enable_func(struct trace_array *tr, struct ftrace_hash *hash, in event_enable_func() argument
3351 if (!tr) in event_enable_func()
3367 file = find_event_file(tr, system, event); in event_enable_func()
3379 ret = unregister_ftrace_function_probe_func(glob+1, tr, ops); in event_enable_func()
3422 ret = register_ftrace_function_probe(glob, tr, ops, data); in event_enable_func()
3481 static void __trace_early_add_event_dirs(struct trace_array *tr) in __trace_early_add_event_dirs() argument
3487 list_for_each_entry(file, &tr->events, list) { in __trace_early_add_event_dirs()
3488 ret = event_create_dir(tr->event_dir, file); in __trace_early_add_event_dirs()
3501 void __trace_early_add_events(struct trace_array *tr) in __trace_early_add_events() argument
3512 ret = __trace_early_add_new_event(call, tr); in __trace_early_add_events()
3521 __trace_remove_event_dirs(struct trace_array *tr) in __trace_remove_event_dirs() argument
3525 list_for_each_entry_safe(file, next, &tr->events, list) in __trace_remove_event_dirs()
3531 struct trace_array *tr; in __add_event_to_tracers() local
3533 list_for_each_entry(tr, &ftrace_trace_arrays, list) in __add_event_to_tracers()
3534 __trace_add_new_event(call, tr); in __add_event_to_tracers()
3554 create_event_toplevel_files(struct dentry *parent, struct trace_array *tr) in create_event_toplevel_files() argument
3560 tr, &ftrace_set_event_fops); in create_event_toplevel_files()
3571 tr, &ftrace_tr_enable_fops); in create_event_toplevel_files()
3578 tr, &ftrace_set_event_pid_fops); in create_event_toplevel_files()
3581 TRACE_MODE_WRITE, parent, tr, in create_event_toplevel_files()
3593 tr->event_dir = d_events; in create_event_toplevel_files()
3611 int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr) in event_trace_add_tracer() argument
3617 ret = create_event_toplevel_files(parent, tr); in event_trace_add_tracer()
3623 if (unlikely(!list_empty(&tr->events))) in event_trace_add_tracer()
3624 __trace_early_add_event_dirs(tr); in event_trace_add_tracer()
3626 __trace_add_event_dirs(tr); in event_trace_add_tracer()
3638 early_event_add_tracer(struct dentry *parent, struct trace_array *tr) in early_event_add_tracer() argument
3644 ret = create_event_toplevel_files(parent, tr); in early_event_add_tracer()
3649 __trace_early_add_event_dirs(tr); in early_event_add_tracer()
3659 int event_trace_del_tracer(struct trace_array *tr) in event_trace_del_tracer() argument
3664 clear_event_triggers(tr); in event_trace_del_tracer()
3667 __ftrace_clear_event_pids(tr, TRACE_PIDS | TRACE_NO_PIDS); in event_trace_del_tracer()
3670 __ftrace_set_clr_event_nolock(tr, NULL, NULL, NULL, 0); in event_trace_del_tracer()
3676 __trace_remove_event_dirs(tr); in event_trace_del_tracer()
3677 tracefs_remove(tr->event_dir); in event_trace_del_tracer()
3680 tr->event_dir = NULL; in event_trace_del_tracer()
3693 early_enable_events(struct trace_array *tr, bool disable_first) in early_enable_events() argument
3708 ftrace_set_clr_event(tr, token, 0); in early_enable_events()
3710 ret = ftrace_set_clr_event(tr, token, 1); in early_enable_events()
3723 struct trace_array *tr = top_trace_array(); in event_trace_enable() local
3727 if (!tr) in event_trace_enable()
3744 __trace_early_add_events(tr); in event_trace_enable()
3746 early_enable_events(tr, false); in event_trace_enable()
3769 struct trace_array *tr; in event_trace_enable_again() local
3771 tr = top_trace_array(); in event_trace_enable_again()
3772 if (!tr) in event_trace_enable_again()
3775 early_enable_events(tr, true); in event_trace_enable_again()
3796 struct trace_array *tr; in event_trace_init() local
3799 tr = top_trace_array(); in event_trace_init()
3800 if (!tr) in event_trace_init()
3804 NULL, tr, &ftrace_avail_fops); in event_trace_init()
3806 ret = early_event_add_tracer(NULL, tr); in event_trace_init()
3892 struct trace_array *tr; in event_trace_self_tests() local
3895 tr = top_trace_array(); in event_trace_self_tests()
3896 if (!tr) in event_trace_self_tests()
3901 list_for_each_entry(file, &tr->events, list) { in event_trace_self_tests()
3944 list_for_each_entry(dir, &tr->systems, list) { in event_trace_self_tests()
3954 ret = __ftrace_set_clr_event(tr, NULL, system->name, NULL, 1); in event_trace_self_tests()
3963 ret = __ftrace_set_clr_event(tr, NULL, system->name, NULL, 0); in event_trace_self_tests()
3978 ret = __ftrace_set_clr_event(tr, NULL, NULL, NULL, 1); in event_trace_self_tests()
3987 ret = __ftrace_set_clr_event(tr, NULL, NULL, NULL, 0); in event_trace_self_tests()
4046 event_trace_file.tr = top_trace_array(); in event_trace_self_test_with_function()
4047 if (WARN_ON(!event_trace_file.tr)) in event_trace_self_test_with_function()