Lines Matching refs:tf

71 static bool trace_fprobe_is_return(struct trace_fprobe *tf)
73 return tf->fp.exit_handler != NULL;
76 static bool trace_fprobe_is_tracepoint(struct trace_fprobe *tf)
78 return tf->tpoint != NULL;
81 static const char *trace_fprobe_symbol(struct trace_fprobe *tf)
83 return tf->symbol ? tf->symbol : "unknown";
88 struct trace_fprobe *tf = to_trace_fprobe(ev);
90 return trace_probe_is_enabled(&tf->tp);
93 static bool trace_fprobe_match_command_head(struct trace_fprobe *tf,
101 snprintf(buf, sizeof(buf), "%s", trace_fprobe_symbol(tf));
106 return trace_probe_match_command_args(&tf->tp, argc, argv);
112 struct trace_fprobe *tf = to_trace_fprobe(ev);
114 if (event[0] != '\0' && strcmp(trace_probe_name(&tf->tp), event))
117 if (system && strcmp(trace_probe_group_name(&tf->tp), system))
120 return trace_fprobe_match_command_head(tf, argc, argv);
123 static bool trace_fprobe_is_registered(struct trace_fprobe *tf)
125 return fprobe_is_registered(&tf->fp);
176 __fentry_trace_func(struct trace_fprobe *tf, unsigned long entry_ip,
181 struct trace_event_call *call = trace_probe_event_call(&tf->tp);
191 dsize = __get_data_size(&tf->tp, regs, NULL);
194 sizeof(*entry) + tf->tp.size + dsize);
201 store_trace_args(&entry[1], &tf->tp, regs, NULL, sizeof(*entry), dsize);
207 fentry_trace_func(struct trace_fprobe *tf, unsigned long entry_ip,
212 trace_probe_for_each_link_rcu(link, &tf->tp)
213 __fentry_trace_func(tf, entry_ip, regs, link->file);
222 struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp);
224 if (tf->tp.entry_arg)
225 store_trace_entry_data(entry_data, &tf->tp, regs);
232 __fexit_trace_func(struct trace_fprobe *tf, unsigned long entry_ip,
238 struct trace_event_call *call = trace_probe_event_call(&tf->tp);
247 dsize = __get_data_size(&tf->tp, regs, entry_data);
250 sizeof(*entry) + tf->tp.size + dsize);
258 store_trace_args(&entry[1], &tf->tp, regs, entry_data, sizeof(*entry), dsize);
264 fexit_trace_func(struct trace_fprobe *tf, unsigned long entry_ip,
269 trace_probe_for_each_link_rcu(link, &tf->tp)
270 __fexit_trace_func(tf, entry_ip, ret_ip, regs, entry_data, link->file);
276 static int fentry_perf_func(struct trace_fprobe *tf, unsigned long entry_ip,
279 struct trace_event_call *call = trace_probe_event_call(&tf->tp);
289 dsize = __get_data_size(&tf->tp, regs, NULL);
290 __size = sizeof(*entry) + tf->tp.size + dsize;
300 store_trace_args(&entry[1], &tf->tp, regs, NULL, sizeof(*entry), dsize);
308 fexit_perf_func(struct trace_fprobe *tf, unsigned long entry_ip,
312 struct trace_event_call *call = trace_probe_event_call(&tf->tp);
322 dsize = __get_data_size(&tf->tp, regs, entry_data);
323 __size = sizeof(*entry) + tf->tp.size + dsize;
333 store_trace_args(&entry[1], &tf->tp, regs, entry_data, sizeof(*entry), dsize);
344 struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp);
347 if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE))
348 fentry_trace_func(tf, entry_ip, regs);
350 if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE))
351 ret = fentry_perf_func(tf, entry_ip, regs);
361 struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp);
363 if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE))
364 fexit_trace_func(tf, entry_ip, ret_ip, regs, entry_data);
366 if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE))
367 fexit_perf_func(tf, entry_ip, ret_ip, regs, entry_data);
372 static void free_trace_fprobe(struct trace_fprobe *tf)
374 if (tf) {
375 trace_probe_cleanup(&tf->tp);
376 kfree(tf->symbol);
377 kfree(tf);
391 struct trace_fprobe *tf;
394 tf = kzalloc(struct_size(tf, tp.args, nargs), GFP_KERNEL);
395 if (!tf)
398 tf->symbol = kstrdup(symbol, GFP_KERNEL);
399 if (!tf->symbol)
403 tf->fp.exit_handler = fexit_dispatcher;
405 tf->fp.entry_handler = fentry_dispatcher;
407 tf->tpoint = tpoint;
408 tf->fp.nr_maxactive = maxactive;
410 ret = trace_probe_init(&tf->tp, event, group, false, nargs);
414 dyn_event_init(&tf->devent, &trace_fprobe_ops);
415 return tf;
417 free_trace_fprobe(tf);
425 struct trace_fprobe *tf;
427 for_each_trace_fprobe(tf, pos)
428 if (strcmp(trace_probe_name(&tf->tp), event) == 0 &&
429 strcmp(trace_probe_group_name(&tf->tp), group) == 0)
430 return tf;
434 static inline int __enable_trace_fprobe(struct trace_fprobe *tf)
436 if (trace_fprobe_is_registered(tf))
437 enable_fprobe(&tf->fp);
444 struct trace_fprobe *tf;
446 list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) {
447 if (!trace_fprobe_is_registered(tf))
449 disable_fprobe(&tf->fp);
461 struct trace_fprobe *tf;
479 list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) {
481 __enable_trace_fprobe(tf);
647 static inline void init_trace_event_call(struct trace_fprobe *tf)
649 struct trace_event_call *call = trace_probe_event_call(&tf->tp);
651 if (trace_fprobe_is_return(tf)) {
663 static int register_fprobe_event(struct trace_fprobe *tf)
665 init_trace_event_call(tf);
667 return trace_probe_register_event_call(&tf->tp);
670 static int unregister_fprobe_event(struct trace_fprobe *tf)
672 return trace_probe_unregister_event_call(&tf->tp);
676 static int __register_trace_fprobe(struct trace_fprobe *tf)
685 if (trace_fprobe_is_registered(tf))
688 for (i = 0; i < tf->tp.nr_args; i++) {
689 ret = traceprobe_update_arg(&tf->tp.args[i]);
695 if (trace_probe_is_enabled(&tf->tp))
696 tf->fp.flags &= ~FPROBE_FL_DISABLED;
698 tf->fp.flags |= FPROBE_FL_DISABLED;
700 if (trace_fprobe_is_tracepoint(tf)) {
701 struct tracepoint *tpoint = tf->tpoint;
712 return register_fprobe_ips(&tf->fp, &ip, 1);
716 return register_fprobe(&tf->fp, tf->symbol, NULL);
720 static void __unregister_trace_fprobe(struct trace_fprobe *tf)
722 if (trace_fprobe_is_registered(tf)) {
723 unregister_fprobe(&tf->fp);
724 memset(&tf->fp, 0, sizeof(tf->fp));
725 if (trace_fprobe_is_tracepoint(tf)) {
726 tracepoint_probe_unregister(tf->tpoint,
727 tf->tpoint->probestub, NULL);
728 tf->tpoint = NULL;
729 tf->mod = NULL;
736 static int unregister_trace_fprobe(struct trace_fprobe *tf)
739 if (trace_probe_has_sibling(&tf->tp))
743 if (trace_probe_is_enabled(&tf->tp))
747 if (trace_event_dyn_busy(trace_probe_event_call(&tf->tp)))
751 if (unregister_fprobe_event(tf))
755 __unregister_trace_fprobe(tf);
756 dyn_event_remove(&tf->devent);
757 trace_probe_unlink(&tf->tp);
790 static int append_trace_fprobe(struct trace_fprobe *tf, struct trace_fprobe *to)
794 if (trace_fprobe_is_return(tf) != trace_fprobe_is_return(to) ||
795 trace_fprobe_is_tracepoint(tf) != trace_fprobe_is_tracepoint(to)) {
800 ret = trace_probe_compare_arg_type(&tf->tp, &to->tp);
807 if (trace_fprobe_has_same_fprobe(to, tf)) {
814 ret = trace_probe_append(&tf->tp, &to->tp);
818 ret = __register_trace_fprobe(tf);
820 trace_probe_unlink(&tf->tp);
822 dyn_event_add(&tf->devent, trace_probe_event_call(&tf->tp));
828 static int register_trace_fprobe(struct trace_fprobe *tf)
835 old_tf = find_trace_fprobe(trace_probe_name(&tf->tp),
836 trace_probe_group_name(&tf->tp));
838 ret = append_trace_fprobe(tf, old_tf);
843 ret = register_fprobe_event(tf);
854 ret = __register_trace_fprobe(tf);
856 unregister_fprobe_event(tf);
858 dyn_event_add(&tf->devent, trace_probe_event_call(&tf->tp));
870 struct trace_fprobe *tf;
877 for_each_trace_fprobe(tf, pos) {
878 if (tp_mod->mod == tf->mod) {
879 tracepoint_probe_unregister(tf->tpoint,
880 tf->tpoint->probestub, NULL);
881 tf->tpoint = NULL;
882 tf->mod = NULL;
986 struct trace_fprobe *tf = NULL;
1108 tf = alloc_trace_fprobe(group, event, symbol, tpoint, maxactive,
1110 if (IS_ERR(tf)) {
1111 ret = PTR_ERR(tf);
1114 goto out; /* We know tf is not allocated */
1118 tf->mod = __module_text_address(
1119 (unsigned long)tf->tpoint->probestub);
1125 ret = traceprobe_parse_probe_arg(&tf->tp, i, argv[i], &ctx);
1130 if (is_return && tf->tp.entry_arg) {
1131 tf->fp.entry_handler = trace_fprobe_entry_handler;
1132 tf->fp.entry_data_size = traceprobe_get_entry_data_size(&tf->tp);
1135 ret = traceprobe_set_print_fmt(&tf->tp,
1140 ret = register_trace_fprobe(tf);
1162 free_trace_fprobe(tf);
1173 struct trace_fprobe *tf = to_trace_fprobe(ev);
1174 int ret = unregister_trace_fprobe(tf);
1177 free_trace_fprobe(tf);
1183 struct trace_fprobe *tf = to_trace_fprobe(ev);
1186 if (trace_fprobe_is_tracepoint(tf))
1190 if (trace_fprobe_is_return(tf) && tf->fp.nr_maxactive)
1191 seq_printf(m, "%d", tf->fp.nr_maxactive);
1192 seq_printf(m, ":%s/%s", trace_probe_group_name(&tf->tp),
1193 trace_probe_name(&tf->tp));
1195 seq_printf(m, " %s%s", trace_fprobe_symbol(tf),
1196 trace_fprobe_is_return(tf) ? "%return" : "");
1198 for (i = 0; i < tf->tp.nr_args; i++)
1199 seq_printf(m, " %s=%s", tf->tp.args[i].name, tf->tp.args[i].comm);