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)
476 struct trace_array *tr = trace_file->tr; in trace_event_ignore_this_pid() local
481 pid_list = rcu_dereference_raw(tr->filtered_pids); in trace_event_ignore_this_pid()
482 no_pid_list = rcu_dereference_raw(tr->filtered_no_pids); in trace_event_ignore_this_pid()
487 data = this_cpu_ptr(tr->array_buffer.data); in trace_event_ignore_this_pid()
566 struct trace_array *tr; in trace_event_enable_cmd_record() local
570 do_for_each_event_file(tr, file) { in trace_event_enable_cmd_record()
588 struct trace_array *tr; in trace_event_enable_tgid_record() local
592 do_for_each_event_file(tr, file) { in trace_event_enable_tgid_record()
611 struct trace_array *tr = file->tr; in __ftrace_event_enable_disable() local
686 if (tr->trace_flags & TRACE_ITER_RECORD_CMD) { in __ftrace_event_enable_disable()
692 if (tr->trace_flags & TRACE_ITER_RECORD_TGID) { in __ftrace_event_enable_disable()
731 static void ftrace_clear_events(struct trace_array *tr) in ftrace_clear_events() argument
736 list_for_each_entry(file, &tr->events, list) { in ftrace_clear_events()
746 struct trace_array *tr = data; in event_filter_pid_sched_process_exit() local
748 pid_list = rcu_dereference_raw(tr->filtered_pids); in event_filter_pid_sched_process_exit()
751 pid_list = rcu_dereference_raw(tr->filtered_no_pids); in event_filter_pid_sched_process_exit()
761 struct trace_array *tr = data; in event_filter_pid_sched_process_fork() local
763 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_process_fork()
766 pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_process_fork()
770 void trace_event_follow_fork(struct trace_array *tr, bool enable) in trace_event_follow_fork() argument
774 tr, INT_MIN); in trace_event_follow_fork()
776 tr, INT_MAX); in trace_event_follow_fork()
779 tr); in trace_event_follow_fork()
781 tr); in trace_event_follow_fork()
791 struct trace_array *tr = data; in event_filter_pid_sched_switch_probe_pre() local
796 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_switch_probe_pre()
797 no_pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_switch_probe_pre()
806 this_cpu_write(tr->array_buffer.data->ignore_pid, ret || in event_filter_pid_sched_switch_probe_pre()
817 struct trace_array *tr = data; in event_filter_pid_sched_switch_probe_post() local
821 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_switch_probe_post()
822 no_pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_switch_probe_post()
824 this_cpu_write(tr->array_buffer.data->ignore_pid, in event_filter_pid_sched_switch_probe_post()
831 struct trace_array *tr = data; in event_filter_pid_sched_wakeup_probe_pre() local
836 if (!this_cpu_read(tr->array_buffer.data->ignore_pid)) in event_filter_pid_sched_wakeup_probe_pre()
839 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_wakeup_probe_pre()
840 no_pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_wakeup_probe_pre()
842 this_cpu_write(tr->array_buffer.data->ignore_pid, in event_filter_pid_sched_wakeup_probe_pre()
849 struct trace_array *tr = data; in event_filter_pid_sched_wakeup_probe_post() local
854 if (this_cpu_read(tr->array_buffer.data->ignore_pid)) in event_filter_pid_sched_wakeup_probe_post()
857 pid_list = rcu_dereference_sched(tr->filtered_pids); in event_filter_pid_sched_wakeup_probe_post()
858 no_pid_list = rcu_dereference_sched(tr->filtered_no_pids); in event_filter_pid_sched_wakeup_probe_post()
861 this_cpu_write(tr->array_buffer.data->ignore_pid, in event_filter_pid_sched_wakeup_probe_post()
865 static void unregister_pid_events(struct trace_array *tr) in unregister_pid_events() argument
867 unregister_trace_sched_switch(event_filter_pid_sched_switch_probe_pre, tr); in unregister_pid_events()
868 unregister_trace_sched_switch(event_filter_pid_sched_switch_probe_post, tr); in unregister_pid_events()
870 unregister_trace_sched_wakeup(event_filter_pid_sched_wakeup_probe_pre, tr); in unregister_pid_events()
871 unregister_trace_sched_wakeup(event_filter_pid_sched_wakeup_probe_post, tr); in unregister_pid_events()
873 unregister_trace_sched_wakeup_new(event_filter_pid_sched_wakeup_probe_pre, tr); in unregister_pid_events()
874 unregister_trace_sched_wakeup_new(event_filter_pid_sched_wakeup_probe_post, tr); in unregister_pid_events()
876 unregister_trace_sched_waking(event_filter_pid_sched_wakeup_probe_pre, tr); in unregister_pid_events()
877 unregister_trace_sched_waking(event_filter_pid_sched_wakeup_probe_post, tr); in unregister_pid_events()
880 static void __ftrace_clear_event_pids(struct trace_array *tr, int type) in __ftrace_clear_event_pids() argument
887 pid_list = rcu_dereference_protected(tr->filtered_pids, in __ftrace_clear_event_pids()
889 no_pid_list = rcu_dereference_protected(tr->filtered_no_pids, in __ftrace_clear_event_pids()
897 unregister_pid_events(tr); in __ftrace_clear_event_pids()
899 list_for_each_entry(file, &tr->events, list) { in __ftrace_clear_event_pids()
904 per_cpu_ptr(tr->array_buffer.data, cpu)->ignore_pid = false; in __ftrace_clear_event_pids()
908 rcu_assign_pointer(tr->filtered_pids, NULL); in __ftrace_clear_event_pids()
911 rcu_assign_pointer(tr->filtered_no_pids, NULL); in __ftrace_clear_event_pids()
923 static void ftrace_clear_event_pids(struct trace_array *tr, int type) in ftrace_clear_event_pids() argument
926 __ftrace_clear_event_pids(tr, type); in ftrace_clear_event_pids()
1017 __ftrace_set_clr_event_nolock(struct trace_array *tr, const char *match, in __ftrace_set_clr_event_nolock() argument
1026 list_for_each_entry(file, &tr->events, list) { in __ftrace_set_clr_event_nolock()
1064 static int __ftrace_set_clr_event(struct trace_array *tr, const char *match, in __ftrace_set_clr_event() argument
1070 ret = __ftrace_set_clr_event_nolock(tr, match, sub, event, set); in __ftrace_set_clr_event()
1076 int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set) in ftrace_set_clr_event() argument
1081 if (!tr) in ftrace_set_clr_event()
1107 ret = __ftrace_set_clr_event(tr, match, sub, event, set); in ftrace_set_clr_event()
1130 struct trace_array *tr = top_trace_array(); in trace_set_clr_event() local
1132 if (!tr) in trace_set_clr_event()
1135 return __ftrace_set_clr_event(tr, NULL, system, event, set); in trace_set_clr_event()
1152 int trace_array_set_clr_event(struct trace_array *tr, const char *system, in trace_array_set_clr_event() argument
1157 if (!tr) in trace_array_set_clr_event()
1161 return __ftrace_set_clr_event(tr, NULL, system, event, set); in trace_array_set_clr_event()
1174 struct trace_array *tr = m->private; in ftrace_event_write() local
1195 ret = ftrace_set_clr_event(tr, parser.buffer + !set, set); in ftrace_event_write()
1213 struct trace_array *tr = m->private; in t_next() local
1217 list_for_each_entry_continue(file, &tr->events, list) { in t_next()
1234 struct trace_array *tr = m->private; in t_start() local
1239 file = list_entry(&tr->events, struct trace_event_file, list); in t_start()
1252 struct trace_array *tr = m->private; in s_next() local
1256 list_for_each_entry_continue(file, &tr->events, list) { in s_next()
1267 struct trace_array *tr = m->private; in s_start() local
1272 file = list_entry(&tr->events, struct trace_event_file, list); in s_start()
1301 struct trace_array *tr = m->private; in __next() local
1305 pid_list = rcu_dereference_sched(tr->filtered_pids); in __next()
1307 pid_list = rcu_dereference_sched(tr->filtered_no_pids); in __next()
1328 struct trace_array *tr = m->private; in __start() local
1340 pid_list = rcu_dereference_sched(tr->filtered_pids); in __start()
1342 pid_list = rcu_dereference_sched(tr->filtered_no_pids); in __start()
1444 struct trace_array *tr = dir->tr; in system_enable_read() local
1450 list_for_each_entry(file, &tr->events, list) { in system_enable_read()
1510 ret = __ftrace_set_clr_event(dir->tr, NULL, name, NULL, val); in system_enable_write()
1743 struct trace_array *tr = NULL, *iter_tr; in subsystem_open() local
1757 tr = iter_tr; in subsystem_open()
1775 if (trace_array_get(tr) < 0) { in subsystem_open()
1782 trace_array_put(tr); in subsystem_open()
1792 struct trace_array *tr = inode->i_private; in system_tr_open() local
1805 dir->tr = tr; in system_tr_open()
1815 trace_array_put(dir->tr); in subsystem_release()
1909 struct trace_array *tr = data; in ignore_task_cpu() local
1917 pid_list = rcu_dereference_protected(tr->filtered_pids, in ignore_task_cpu()
1919 no_pid_list = rcu_dereference_protected(tr->filtered_no_pids, in ignore_task_cpu()
1922 this_cpu_write(tr->array_buffer.data->ignore_pid, in ignore_task_cpu()
1926 static void register_pid_events(struct trace_array *tr) in register_pid_events() argument
1935 tr, INT_MAX); in register_pid_events()
1937 tr, 0); in register_pid_events()
1940 tr, INT_MAX); in register_pid_events()
1942 tr, 0); in register_pid_events()
1945 tr, INT_MAX); in register_pid_events()
1947 tr, 0); in register_pid_events()
1950 tr, INT_MAX); in register_pid_events()
1952 tr, 0); in register_pid_events()
1960 struct trace_array *tr = m->private; in event_pid_write() local
1977 filtered_pids = rcu_dereference_protected(tr->filtered_pids, in event_pid_write()
1979 other_pids = rcu_dereference_protected(tr->filtered_no_pids, in event_pid_write()
1982 filtered_pids = rcu_dereference_protected(tr->filtered_no_pids, in event_pid_write()
1984 other_pids = rcu_dereference_protected(tr->filtered_pids, in event_pid_write()
1993 rcu_assign_pointer(tr->filtered_pids, pid_list); in event_pid_write()
1995 rcu_assign_pointer(tr->filtered_no_pids, pid_list); in event_pid_write()
1997 list_for_each_entry(file, &tr->events, list) { in event_pid_write()
2005 register_pid_events(tr); in event_pid_write()
2013 on_each_cpu(ignore_task_cpu, tr, 1); in event_pid_write()
2184 struct trace_array *tr = inode->i_private; in ftrace_event_release() local
2186 trace_array_put(tr); in ftrace_event_release()
2204 struct trace_array *tr = inode->i_private; in ftrace_event_set_open() local
2207 ret = tracing_check_open_get_tr(tr); in ftrace_event_set_open()
2213 ftrace_clear_events(tr); in ftrace_event_set_open()
2217 trace_array_put(tr); in ftrace_event_set_open()
2225 struct trace_array *tr = inode->i_private; in ftrace_event_set_pid_open() local
2228 ret = tracing_check_open_get_tr(tr); in ftrace_event_set_pid_open()
2234 ftrace_clear_event_pids(tr, TRACE_PIDS); in ftrace_event_set_pid_open()
2238 trace_array_put(tr); in ftrace_event_set_pid_open()
2246 struct trace_array *tr = inode->i_private; in ftrace_event_set_npid_open() local
2249 ret = tracing_check_open_get_tr(tr); in ftrace_event_set_npid_open()
2255 ftrace_clear_event_pids(tr, TRACE_NO_PIDS); in ftrace_event_set_npid_open()
2259 trace_array_put(tr); in ftrace_event_set_npid_open()
2297 event_subsystem_dir(struct trace_array *tr, const char *name, in event_subsystem_dir() argument
2305 list_for_each_entry(dir, &tr->systems, list) { in event_subsystem_dir()
2341 dir->tr = tr; in event_subsystem_dir()
2363 list_add(&dir->list, &tr->systems); in event_subsystem_dir()
2418 struct trace_array *tr = file->tr; in event_create_dir() local
2428 d_events = event_subsystem_dir(tr, call->class->system, file, parent); in event_create_dir()
2493 struct trace_array *tr; in remove_event_from_tracers() local
2495 do_for_each_event_file_safe(tr, file) { in remove_event_from_tracers()
2512 struct trace_array *tr; in event_remove() local
2515 do_for_each_event_file(tr, file) { in event_remove()
2520 tr->clear_trace = true; in event_remove()
2787 struct trace_array *tr) in trace_create_new_event() argument
2798 pid_list = rcu_dereference_protected(tr->filtered_pids, in trace_create_new_event()
2800 no_pid_list = rcu_dereference_protected(tr->filtered_no_pids, in trace_create_new_event()
2808 file->tr = tr; in trace_create_new_event()
2812 list_add(&file->list, &tr->events); in trace_create_new_event()
2819 __trace_add_new_event(struct trace_event_call *call, struct trace_array *tr) in __trace_add_new_event() argument
2823 file = trace_create_new_event(call, tr); in __trace_add_new_event()
2828 return event_create_dir(tr->event_dir, file); in __trace_add_new_event()
2840 struct trace_array *tr) in __trace_early_add_new_event() argument
2844 file = trace_create_new_event(call, tr); in __trace_early_add_new_event()
2885 struct trace_array *tr; in probe_remove_event_call() local
2892 do_for_each_event_file(tr, file) { in probe_remove_event_call()
2904 tr->clear_trace = true; in probe_remove_event_call()
2919 list_for_each_entry(tr, &ftrace_trace_arrays, list) { in probe_remove_event_call()
2920 tr->clear_trace = false; in probe_remove_event_call()
3034 __trace_add_event_dirs(struct trace_array *tr) in __trace_add_event_dirs() argument
3040 ret = __trace_add_new_event(call, tr); in __trace_add_event_dirs()
3049 __find_event_file(struct trace_array *tr, const char *system, const char *event) in __find_event_file() argument
3055 list_for_each_entry(file, &tr->events, list) { in __find_event_file()
3072 find_event_file(struct trace_array *tr, const char *system, const char *event) in find_event_file() argument
3076 file = __find_event_file(tr, system, event); in find_event_file()
3108 struct trace_array *tr = top_trace_array(); in trace_get_event_file() local
3113 tr = trace_array_find_get(instance); in trace_get_event_file()
3114 if (!tr) in trace_get_event_file()
3117 ret = trace_array_get(tr); in trace_get_event_file()
3124 file = find_event_file(tr, system, event); in trace_get_event_file()
3126 trace_array_put(tr); in trace_get_event_file()
3134 trace_array_put(tr); in trace_get_event_file()
3165 trace_array_put(file->tr); in trace_put_event_file()
3192 struct trace_array *tr, struct ftrace_probe_ops *ops, in event_enable_probe() argument
3209 struct trace_array *tr, struct ftrace_probe_ops *ops, in event_enable_count_probe() argument
3266 event_enable_init(struct ftrace_probe_ops *ops, struct trace_array *tr, in event_enable_init() argument
3304 event_enable_free(struct ftrace_probe_ops *ops, struct trace_array *tr, in event_enable_free() argument
3357 event_enable_func(struct trace_array *tr, struct ftrace_hash *hash, in event_enable_func() argument
3369 if (!tr) in event_enable_func()
3385 file = find_event_file(tr, system, event); in event_enable_func()
3397 ret = unregister_ftrace_function_probe_func(glob+1, tr, ops); in event_enable_func()
3440 ret = register_ftrace_function_probe(glob, tr, ops, data); in event_enable_func()
3499 static void __trace_early_add_event_dirs(struct trace_array *tr) in __trace_early_add_event_dirs() argument
3505 list_for_each_entry(file, &tr->events, list) { in __trace_early_add_event_dirs()
3506 ret = event_create_dir(tr->event_dir, file); in __trace_early_add_event_dirs()
3519 void __trace_early_add_events(struct trace_array *tr) in __trace_early_add_events() argument
3530 ret = __trace_early_add_new_event(call, tr); in __trace_early_add_events()
3539 __trace_remove_event_dirs(struct trace_array *tr) in __trace_remove_event_dirs() argument
3543 list_for_each_entry_safe(file, next, &tr->events, list) in __trace_remove_event_dirs()
3549 struct trace_array *tr; in __add_event_to_tracers() local
3551 list_for_each_entry(tr, &ftrace_trace_arrays, list) in __add_event_to_tracers()
3552 __trace_add_new_event(call, tr); in __add_event_to_tracers()
3572 create_event_toplevel_files(struct dentry *parent, struct trace_array *tr) in create_event_toplevel_files() argument
3578 tr, &ftrace_set_event_fops); in create_event_toplevel_files()
3589 tr, &ftrace_tr_enable_fops); in create_event_toplevel_files()
3596 tr, &ftrace_set_event_pid_fops); in create_event_toplevel_files()
3599 TRACE_MODE_WRITE, parent, tr, in create_event_toplevel_files()
3611 tr->event_dir = d_events; in create_event_toplevel_files()
3629 int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr) in event_trace_add_tracer() argument
3635 ret = create_event_toplevel_files(parent, tr); in event_trace_add_tracer()
3641 if (unlikely(!list_empty(&tr->events))) in event_trace_add_tracer()
3642 __trace_early_add_event_dirs(tr); in event_trace_add_tracer()
3644 __trace_add_event_dirs(tr); in event_trace_add_tracer()
3656 early_event_add_tracer(struct dentry *parent, struct trace_array *tr) in early_event_add_tracer() argument
3662 ret = create_event_toplevel_files(parent, tr); in early_event_add_tracer()
3667 __trace_early_add_event_dirs(tr); in early_event_add_tracer()
3677 int event_trace_del_tracer(struct trace_array *tr) in event_trace_del_tracer() argument
3682 clear_event_triggers(tr); in event_trace_del_tracer()
3685 __ftrace_clear_event_pids(tr, TRACE_PIDS | TRACE_NO_PIDS); in event_trace_del_tracer()
3688 __ftrace_set_clr_event_nolock(tr, NULL, NULL, NULL, 0); in event_trace_del_tracer()
3694 __trace_remove_event_dirs(tr); in event_trace_del_tracer()
3695 tracefs_remove(tr->event_dir); in event_trace_del_tracer()
3698 tr->event_dir = NULL; in event_trace_del_tracer()
3711 early_enable_events(struct trace_array *tr, bool disable_first) in early_enable_events() argument
3726 ftrace_set_clr_event(tr, token, 0); in early_enable_events()
3728 ret = ftrace_set_clr_event(tr, token, 1); in early_enable_events()
3741 struct trace_array *tr = top_trace_array(); in event_trace_enable() local
3745 if (!tr) in event_trace_enable()
3762 __trace_early_add_events(tr); in event_trace_enable()
3764 early_enable_events(tr, false); in event_trace_enable()
3787 struct trace_array *tr; in event_trace_enable_again() local
3789 tr = top_trace_array(); in event_trace_enable_again()
3790 if (!tr) in event_trace_enable_again()
3793 early_enable_events(tr, true); in event_trace_enable_again()
3814 struct trace_array *tr; in event_trace_init() local
3817 tr = top_trace_array(); in event_trace_init()
3818 if (!tr) in event_trace_init()
3822 NULL, tr, &ftrace_avail_fops); in event_trace_init()
3824 ret = early_event_add_tracer(NULL, tr); in event_trace_init()
3910 struct trace_array *tr; in event_trace_self_tests() local
3913 tr = top_trace_array(); in event_trace_self_tests()
3914 if (!tr) in event_trace_self_tests()
3919 list_for_each_entry(file, &tr->events, list) { in event_trace_self_tests()
3962 list_for_each_entry(dir, &tr->systems, list) { in event_trace_self_tests()
3972 ret = __ftrace_set_clr_event(tr, NULL, system->name, NULL, 1); in event_trace_self_tests()
3981 ret = __ftrace_set_clr_event(tr, NULL, system->name, NULL, 0); in event_trace_self_tests()
3996 ret = __ftrace_set_clr_event(tr, NULL, NULL, NULL, 1); in event_trace_self_tests()
4005 ret = __ftrace_set_clr_event(tr, NULL, NULL, NULL, 0); in event_trace_self_tests()
4064 event_trace_file.tr = top_trace_array(); in event_trace_self_test_with_function()
4065 if (WARN_ON(!event_trace_file.tr)) in event_trace_self_test_with_function()