Lines Matching +full:tf +full:- +full:a
1 // SPDX-License-Identifier: GPL-2.0
3 * Fprobe-based tracing events
24 #define TRACEPOINT_STUB ERR_PTR(-ENOENT)
55 return ev->ops == &trace_fprobe_ops; in is_trace_fprobe()
64 * for_each_trace_fprobe - iterate over the trace_fprobe list
66 * @dpos: the struct dyn_event * to use as a loop cursor
72 static bool trace_fprobe_is_return(struct trace_fprobe *tf) in trace_fprobe_is_return() argument
74 return tf->fp.exit_handler != NULL; in trace_fprobe_is_return()
77 static bool trace_fprobe_is_tracepoint(struct trace_fprobe *tf) in trace_fprobe_is_tracepoint() argument
79 return tf->tpoint != NULL; in trace_fprobe_is_tracepoint()
82 static const char *trace_fprobe_symbol(struct trace_fprobe *tf) in trace_fprobe_symbol() argument
84 return tf->symbol ? tf->symbol : "unknown"; in trace_fprobe_symbol()
89 struct trace_fprobe *tf = to_trace_fprobe(ev); in trace_fprobe_is_busy() local
91 return trace_probe_is_enabled(&tf->tp); in trace_fprobe_is_busy()
94 static bool trace_fprobe_match_command_head(struct trace_fprobe *tf, in trace_fprobe_match_command_head() argument
102 snprintf(buf, sizeof(buf), "%s", trace_fprobe_symbol(tf)); in trace_fprobe_match_command_head()
105 argc--; argv++; in trace_fprobe_match_command_head()
107 return trace_probe_match_command_args(&tf->tp, argc, argv); in trace_fprobe_match_command_head()
113 struct trace_fprobe *tf = to_trace_fprobe(ev); in trace_fprobe_match() local
115 if (event[0] != '\0' && strcmp(trace_probe_name(&tf->tp), event)) in trace_fprobe_match()
118 if (system && strcmp(trace_probe_group_name(&tf->tp), system)) in trace_fprobe_match()
121 return trace_fprobe_match_command_head(tf, argc, argv); in trace_fprobe_match()
124 static bool trace_fprobe_is_registered(struct trace_fprobe *tf) in trace_fprobe_is_registered() argument
126 return fprobe_is_registered(&tf->fp); in trace_fprobe_is_registered()
143 switch (code->op) { in process_fetch_insn()
145 val = ftrace_regs_get_kernel_stack_nth(fregs, code->param); in process_fetch_insn()
155 val = ftrace_regs_get_argument(fregs, code->param); in process_fetch_insn()
158 val = *(unsigned long *)((unsigned long)edata + code->offset); in process_fetch_insn()
161 case FETCH_NOP_SYMBOL: /* Ignore a place holder */ in process_fetch_insn()
177 __fentry_trace_func(struct trace_fprobe *tf, unsigned long entry_ip, in NOKPROBE_SYMBOL()
182 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in NOKPROBE_SYMBOL()
186 if (WARN_ON_ONCE(call != trace_file->event_call)) in NOKPROBE_SYMBOL()
192 dsize = __get_data_size(&tf->tp, fregs, NULL); in NOKPROBE_SYMBOL()
195 sizeof(*entry) + tf->tp.size + dsize); in NOKPROBE_SYMBOL()
201 entry->ip = entry_ip; in NOKPROBE_SYMBOL()
202 store_trace_args(&entry[1], &tf->tp, fregs, NULL, sizeof(*entry), dsize); in NOKPROBE_SYMBOL()
208 fentry_trace_func(struct trace_fprobe *tf, unsigned long entry_ip, in fentry_trace_func() argument
213 trace_probe_for_each_link_rcu(link, &tf->tp) in fentry_trace_func()
214 __fentry_trace_func(tf, entry_ip, fregs, link->file); in fentry_trace_func()
221 struct probe_entry_arg *earg = tp->entry_arg; in store_fprobe_entry_data()
228 for (i = 0; i < earg->size; i++) { in store_fprobe_entry_data()
229 struct fetch_insn *code = &earg->code[i]; in store_fprobe_entry_data()
231 switch (code->op) { in store_fprobe_entry_data()
233 val = ftrace_regs_get_argument(fregs, code->param); in store_fprobe_entry_data()
236 *(unsigned long *)((unsigned long)edata + code->offset) = val; in store_fprobe_entry_data()
253 struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); in trace_fprobe_entry_handler() local
255 if (tf->tp.entry_arg) in trace_fprobe_entry_handler()
256 store_fprobe_entry_data(entry_data, &tf->tp, fregs); in trace_fprobe_entry_handler()
263 __fexit_trace_func(struct trace_fprobe *tf, unsigned long entry_ip, in NOKPROBE_SYMBOL()
269 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in NOKPROBE_SYMBOL()
272 if (WARN_ON_ONCE(call != trace_file->event_call)) in NOKPROBE_SYMBOL()
278 dsize = __get_data_size(&tf->tp, fregs, entry_data); in NOKPROBE_SYMBOL()
281 sizeof(*entry) + tf->tp.size + dsize); in NOKPROBE_SYMBOL()
287 entry->func = entry_ip; in NOKPROBE_SYMBOL()
288 entry->ret_ip = ret_ip; in NOKPROBE_SYMBOL()
289 store_trace_args(&entry[1], &tf->tp, fregs, entry_data, sizeof(*entry), dsize); in NOKPROBE_SYMBOL()
295 fexit_trace_func(struct trace_fprobe *tf, unsigned long entry_ip, in fexit_trace_func() argument
300 trace_probe_for_each_link_rcu(link, &tf->tp) in fexit_trace_func()
301 __fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data, link->file); in fexit_trace_func()
307 static int fentry_perf_func(struct trace_fprobe *tf, unsigned long entry_ip, in fentry_perf_func() argument
310 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in fentry_perf_func()
317 head = this_cpu_ptr(call->perf_events); in fentry_perf_func()
321 dsize = __get_data_size(&tf->tp, fregs, NULL); in fentry_perf_func()
322 __size = sizeof(*entry) + tf->tp.size + dsize; in fentry_perf_func()
324 size -= sizeof(u32); in fentry_perf_func()
332 entry->ip = entry_ip; in fentry_perf_func()
334 store_trace_args(&entry[1], &tf->tp, fregs, NULL, sizeof(*entry), dsize); in fentry_perf_func()
335 perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs, in fentry_perf_func()
342 fexit_perf_func(struct trace_fprobe *tf, unsigned long entry_ip, in fexit_perf_func() argument
346 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in fexit_perf_func()
353 head = this_cpu_ptr(call->perf_events); in fexit_perf_func()
357 dsize = __get_data_size(&tf->tp, fregs, entry_data); in fexit_perf_func()
358 __size = sizeof(*entry) + tf->tp.size + dsize; in fexit_perf_func()
360 size -= sizeof(u32); in fexit_perf_func()
368 entry->func = entry_ip; in fexit_perf_func()
369 entry->ret_ip = ret_ip; in fexit_perf_func()
370 store_trace_args(&entry[1], &tf->tp, fregs, entry_data, sizeof(*entry), dsize); in fexit_perf_func()
371 perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs, in fexit_perf_func()
381 struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); in fentry_dispatcher() local
384 if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) in fentry_dispatcher()
385 fentry_trace_func(tf, entry_ip, fregs); in fentry_dispatcher()
388 if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) in fentry_dispatcher()
389 ret = fentry_perf_func(tf, entry_ip, fregs); in fentry_dispatcher()
399 struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); in fexit_dispatcher() local
401 if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) in fexit_dispatcher()
402 fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data); in fexit_dispatcher()
404 if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) in fexit_dispatcher()
405 fexit_perf_func(tf, entry_ip, ret_ip, fregs, entry_data); in fexit_dispatcher()
410 static void free_trace_fprobe(struct trace_fprobe *tf) in free_trace_fprobe() argument
412 if (tf) { in free_trace_fprobe()
413 trace_probe_cleanup(&tf->tp); in free_trace_fprobe()
414 kfree(tf->symbol); in free_trace_fprobe()
415 kfree(tf); in free_trace_fprobe()
432 struct trace_fprobe *tf __free(free_trace_fprobe) = NULL; in alloc_trace_fprobe()
433 int ret = -ENOMEM; in alloc_trace_fprobe()
435 tf = kzalloc(struct_size(tf, tp.args, nargs), GFP_KERNEL); in alloc_trace_fprobe()
436 if (!tf) in alloc_trace_fprobe()
439 tf->symbol = kstrdup(symbol, GFP_KERNEL); in alloc_trace_fprobe()
440 if (!tf->symbol) in alloc_trace_fprobe()
441 return ERR_PTR(-ENOMEM); in alloc_trace_fprobe()
444 tf->fp.exit_handler = fexit_dispatcher; in alloc_trace_fprobe()
446 tf->fp.entry_handler = fentry_dispatcher; in alloc_trace_fprobe()
448 tf->tpoint = tpoint; in alloc_trace_fprobe()
449 tf->mod = mod; in alloc_trace_fprobe()
451 ret = trace_probe_init(&tf->tp, event, group, false, nargs); in alloc_trace_fprobe()
455 dyn_event_init(&tf->devent, &trace_fprobe_ops); in alloc_trace_fprobe()
456 return_ptr(tf); in alloc_trace_fprobe()
463 struct trace_fprobe *tf; in find_trace_fprobe() local
465 for_each_trace_fprobe(tf, pos) in find_trace_fprobe()
466 if (strcmp(trace_probe_name(&tf->tp), event) == 0 && in find_trace_fprobe()
467 strcmp(trace_probe_group_name(&tf->tp), group) == 0) in find_trace_fprobe()
468 return tf; in find_trace_fprobe()
472 static inline int __enable_trace_fprobe(struct trace_fprobe *tf) in __enable_trace_fprobe() argument
474 if (trace_fprobe_is_registered(tf)) in __enable_trace_fprobe()
475 enable_fprobe(&tf->fp); in __enable_trace_fprobe()
482 struct trace_fprobe *tf; in __disable_trace_fprobe() local
484 list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) { in __disable_trace_fprobe()
485 if (!trace_fprobe_is_registered(tf)) in __disable_trace_fprobe()
487 disable_fprobe(&tf->fp); in __disable_trace_fprobe()
499 struct trace_fprobe *tf; in enable_trace_fprobe() local
505 return -ENODEV; in enable_trace_fprobe()
517 list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) { in enable_trace_fprobe()
519 __enable_trace_fprobe(tf); in enable_trace_fprobe()
537 return -ENODEV; in disable_trace_fprobe()
541 return -ENOENT; in disable_trace_fprobe()
570 struct trace_seq *s = &iter->seq; in print_fentry_event()
573 field = (struct fentry_trace_entry_head *)iter->ent; in print_fentry_event()
581 if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET)) in print_fentry_event()
586 if (trace_probe_print_args(s, tp->args, tp->nr_args, in print_fentry_event()
600 struct trace_seq *s = &iter->seq; in print_fexit_event()
603 field = (struct fexit_trace_entry_head *)iter->ent; in print_fexit_event()
611 if (!seq_print_ip_sym(s, field->ret_ip, flags | TRACE_ITER_SYM_OFFSET)) in print_fexit_event()
614 trace_seq_puts(s, " <- "); in print_fexit_event()
616 if (!seq_print_ip_sym(s, field->func, flags & ~TRACE_ITER_SYM_OFFSET)) in print_fexit_event()
621 if (trace_probe_print_args(s, tp->args, tp->nr_args, in print_fexit_event()
639 return -ENOENT; in fentry_event_define_fields()
654 return -ENOENT; in fexit_event_define_fields()
685 static inline void init_trace_event_call(struct trace_fprobe *tf) in init_trace_event_call() argument
687 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in init_trace_event_call()
689 if (trace_fprobe_is_return(tf)) { in init_trace_event_call()
690 call->event.funcs = &fexit_funcs; in init_trace_event_call()
691 call->class->fields_array = fexit_fields_array; in init_trace_event_call()
693 call->event.funcs = &fentry_funcs; in init_trace_event_call()
694 call->class->fields_array = fentry_fields_array; in init_trace_event_call()
697 call->flags = TRACE_EVENT_FL_FPROBE; in init_trace_event_call()
698 call->class->reg = fprobe_register; in init_trace_event_call()
701 static int register_fprobe_event(struct trace_fprobe *tf) in register_fprobe_event() argument
703 init_trace_event_call(tf); in register_fprobe_event()
705 return trace_probe_register_event_call(&tf->tp); in register_fprobe_event()
708 static int unregister_fprobe_event(struct trace_fprobe *tf) in unregister_fprobe_event() argument
710 return trace_probe_unregister_event_call(&tf->tp); in unregister_fprobe_event()
713 static int __regsiter_tracepoint_fprobe(struct trace_fprobe *tf) in __regsiter_tracepoint_fprobe() argument
715 struct tracepoint *tpoint = tf->tpoint; in __regsiter_tracepoint_fprobe()
716 unsigned long ip = (unsigned long)tpoint->probestub; in __regsiter_tracepoint_fprobe()
720 * Here, we do 2 steps to enable fprobe on a tracepoint. in __regsiter_tracepoint_fprobe()
722 * and put a fprobe on the stub function. in __regsiter_tracepoint_fprobe()
725 tpoint->probestub, NULL, 0); in __regsiter_tracepoint_fprobe()
728 return register_fprobe_ips(&tf->fp, &ip, 1); in __regsiter_tracepoint_fprobe()
731 /* Internal register function - just handle fprobe and flags */
732 static int __register_trace_fprobe(struct trace_fprobe *tf) in __register_trace_fprobe() argument
741 if (trace_fprobe_is_registered(tf)) in __register_trace_fprobe()
742 return -EINVAL; in __register_trace_fprobe()
744 for (i = 0; i < tf->tp.nr_args; i++) { in __register_trace_fprobe()
745 ret = traceprobe_update_arg(&tf->tp.args[i]); in __register_trace_fprobe()
750 /* Set/clear disabled flag according to tp->flag */ in __register_trace_fprobe()
751 if (trace_probe_is_enabled(&tf->tp)) in __register_trace_fprobe()
752 tf->fp.flags &= ~FPROBE_FL_DISABLED; in __register_trace_fprobe()
754 tf->fp.flags |= FPROBE_FL_DISABLED; in __register_trace_fprobe()
756 if (trace_fprobe_is_tracepoint(tf)) { in __register_trace_fprobe()
759 if (tf->tpoint == TRACEPOINT_STUB) in __register_trace_fprobe()
762 return __regsiter_tracepoint_fprobe(tf); in __register_trace_fprobe()
766 return register_fprobe(&tf->fp, tf->symbol, NULL); in __register_trace_fprobe()
769 /* Internal unregister function - just handle fprobe and flags */
770 static void __unregister_trace_fprobe(struct trace_fprobe *tf) in __unregister_trace_fprobe() argument
772 if (trace_fprobe_is_registered(tf)) { in __unregister_trace_fprobe()
773 unregister_fprobe(&tf->fp); in __unregister_trace_fprobe()
774 memset(&tf->fp, 0, sizeof(tf->fp)); in __unregister_trace_fprobe()
775 if (trace_fprobe_is_tracepoint(tf)) { in __unregister_trace_fprobe()
776 tracepoint_probe_unregister(tf->tpoint, in __unregister_trace_fprobe()
777 tf->tpoint->probestub, NULL); in __unregister_trace_fprobe()
778 tf->tpoint = NULL; in __unregister_trace_fprobe()
779 tf->mod = NULL; in __unregister_trace_fprobe()
785 /* Unregister a trace_probe and probe_event */
786 static int unregister_trace_fprobe(struct trace_fprobe *tf) in unregister_trace_fprobe() argument
789 if (trace_probe_has_sibling(&tf->tp)) in unregister_trace_fprobe()
793 if (trace_probe_is_enabled(&tf->tp)) in unregister_trace_fprobe()
794 return -EBUSY; in unregister_trace_fprobe()
796 /* If there's a reference to the dynamic event */ in unregister_trace_fprobe()
797 if (trace_event_dyn_busy(trace_probe_event_call(&tf->tp))) in unregister_trace_fprobe()
798 return -EBUSY; in unregister_trace_fprobe()
801 if (unregister_fprobe_event(tf)) in unregister_trace_fprobe()
802 return -EBUSY; in unregister_trace_fprobe()
805 __unregister_trace_fprobe(tf); in unregister_trace_fprobe()
806 dyn_event_remove(&tf->devent); in unregister_trace_fprobe()
807 trace_probe_unlink(&tf->tp); in unregister_trace_fprobe()
815 struct trace_probe_event *tpe = orig->tp.event; in trace_fprobe_has_same_fprobe()
818 list_for_each_entry(orig, &tpe->probes, tp.list) { in trace_fprobe_has_same_fprobe()
827 for (i = 0; i < orig->tp.nr_args; i++) { in trace_fprobe_has_same_fprobe()
828 if (strcmp(orig->tp.args[i].comm, in trace_fprobe_has_same_fprobe()
829 comp->tp.args[i].comm)) in trace_fprobe_has_same_fprobe()
833 if (i == orig->tp.nr_args) in trace_fprobe_has_same_fprobe()
840 static int append_trace_fprobe(struct trace_fprobe *tf, struct trace_fprobe *to) in append_trace_fprobe() argument
844 if (trace_fprobe_is_return(tf) != trace_fprobe_is_return(to) || in append_trace_fprobe()
845 trace_fprobe_is_tracepoint(tf) != trace_fprobe_is_tracepoint(to)) { in append_trace_fprobe()
848 return -EEXIST; in append_trace_fprobe()
850 ret = trace_probe_compare_arg_type(&tf->tp, &to->tp); in append_trace_fprobe()
855 return -EEXIST; in append_trace_fprobe()
857 if (trace_fprobe_has_same_fprobe(to, tf)) { in append_trace_fprobe()
860 return -EEXIST; in append_trace_fprobe()
864 ret = trace_probe_append(&tf->tp, &to->tp); in append_trace_fprobe()
868 ret = __register_trace_fprobe(tf); in append_trace_fprobe()
870 trace_probe_unlink(&tf->tp); in append_trace_fprobe()
872 dyn_event_add(&tf->devent, trace_probe_event_call(&tf->tp)); in append_trace_fprobe()
877 /* Register a trace_probe and probe_event */
878 static int register_trace_fprobe(struct trace_fprobe *tf) in register_trace_fprobe() argument
885 old_tf = find_trace_fprobe(trace_probe_name(&tf->tp), in register_trace_fprobe()
886 trace_probe_group_name(&tf->tp)); in register_trace_fprobe()
888 return append_trace_fprobe(tf, old_tf); in register_trace_fprobe()
891 ret = register_fprobe_event(tf); in register_trace_fprobe()
893 if (ret == -EEXIST) { in register_trace_fprobe()
902 ret = __register_trace_fprobe(tf); in register_trace_fprobe()
904 unregister_fprobe_event(tf); in register_trace_fprobe()
906 dyn_event_add(&tf->devent, trace_probe_event_call(&tf->tp)); in register_trace_fprobe()
921 if (!data->tpoint && !strcmp(data->tp_name, tp->name)) { in __find_tracepoint_module_cb()
923 if (!data->mod && mod) { in __find_tracepoint_module_cb()
928 data->mod = mod; in __find_tracepoint_module_cb()
930 data->tpoint = tp; in __find_tracepoint_module_cb()
938 if (!data->tpoint && !strcmp(data->tp_name, tp->name)) in __find_tracepoint_cb()
939 data->tpoint = tp; in __find_tracepoint_cb()
943 * Find a tracepoint from kernel and module. If the tracepoint is on the module,
966 static void reenable_trace_fprobe(struct trace_fprobe *tf) in reenable_trace_fprobe() argument
968 struct trace_probe *tp = &tf->tp; in reenable_trace_fprobe()
970 list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) { in reenable_trace_fprobe()
971 __enable_trace_fprobe(tf); in reenable_trace_fprobe()
976 * Find a tracepoint from specified module. In this case, this does not get the
996 struct trace_fprobe *tf; in __tracepoint_probe_module_cb() local
1003 for_each_trace_fprobe(tf, pos) { in __tracepoint_probe_module_cb()
1004 if (val == MODULE_STATE_COMING && tf->tpoint == TRACEPOINT_STUB) { in __tracepoint_probe_module_cb()
1005 tpoint = find_tracepoint_in_module(tp_mod->mod, tf->symbol); in __tracepoint_probe_module_cb()
1007 tf->tpoint = tpoint; in __tracepoint_probe_module_cb()
1008 tf->mod = tp_mod->mod; in __tracepoint_probe_module_cb()
1009 if (!WARN_ON_ONCE(__regsiter_tracepoint_fprobe(tf)) && in __tracepoint_probe_module_cb()
1010 trace_probe_is_enabled(&tf->tp)) in __tracepoint_probe_module_cb()
1011 reenable_trace_fprobe(tf); in __tracepoint_probe_module_cb()
1013 } else if (val == MODULE_STATE_GOING && tp_mod->mod == tf->mod) { in __tracepoint_probe_module_cb()
1014 unregister_fprobe(&tf->fp); in __tracepoint_probe_module_cb()
1015 if (trace_fprobe_is_tracepoint(tf)) { in __tracepoint_probe_module_cb()
1016 tracepoint_probe_unregister(tf->tpoint, in __tracepoint_probe_module_cb()
1017 tf->tpoint->probestub, NULL); in __tracepoint_probe_module_cb()
1018 tf->tpoint = TRACEPOINT_STUB; in __tracepoint_probe_module_cb()
1019 tf->mod = NULL; in __tracepoint_probe_module_cb()
1041 int len = tmp - argv[1]; in parse_symbol_and_return()
1047 return -EINVAL; in parse_symbol_and_return()
1053 return -ENOMEM; in parse_symbol_and_return()
1063 /* find a wrong character. */ in parse_symbol_and_return()
1064 trace_probe_log_err(tmp - *symbol, BAD_TP_NAME); in parse_symbol_and_return()
1067 return -EINVAL; in parse_symbol_and_return()
1071 /* If there is $retval, this should be a return fprobe. */ in parse_symbol_and_return()
1077 trace_probe_log_err(tmp - argv[i], RETVAL_ON_PROBE); in parse_symbol_and_return()
1080 return -EINVAL; in parse_symbol_and_return()
1096 * - Add fentry probe: in DEFINE_FREE()
1098 * - Add fexit probe: in DEFINE_FREE()
1100 * - Add tracepoint probe: in DEFINE_FREE()
1106 * $stackN : fetch Nth entry of stack (N:0-) in DEFINE_FREE()
1107 * $argN : fetch Nth argument (N:1-) in DEFINE_FREE()
1110 * @SYM[+|-offs] : fetch memory at SYM +|- offs (SYM is a data symbol) in DEFINE_FREE()
1112 * +|-offs(ARG) : fetch memory at ARG +|- offs address. in DEFINE_FREE()
1118 struct trace_fprobe *tf __free(free_trace_fprobe) = NULL; in DEFINE_FREE()
1134 return -ECANCELED; in DEFINE_FREE()
1145 return -EINVAL; in DEFINE_FREE()
1152 /* a symbol(or tracepoint) must be specified */ in DEFINE_FREE()
1155 return -EINVAL; in DEFINE_FREE()
1160 event - argv[0]); in DEFINE_FREE()
1162 return -EINVAL; in DEFINE_FREE()
1166 /* Make a new event name */ in DEFINE_FREE()
1178 ctx->flags |= TPARG_FL_RETURN; in DEFINE_FREE()
1180 ctx->flags |= TPARG_FL_FENTRY; in DEFINE_FREE()
1183 ctx->flags |= TPARG_FL_TPOINT; in DEFINE_FREE()
1186 ctx->funcname = kallsyms_lookup( in DEFINE_FREE()
1187 (unsigned long)tpoint->probestub, in DEFINE_FREE()
1192 ctx->funcname = symbol; in DEFINE_FREE()
1196 return -EINVAL; in DEFINE_FREE()
1199 ctx->funcname = symbol; in DEFINE_FREE()
1201 argc -= 2; argv += 2; in DEFINE_FREE()
1213 return -E2BIG; in DEFINE_FREE()
1220 /* setup a probe */ in DEFINE_FREE()
1221 tf = alloc_trace_fprobe(group, event, symbol, tpoint, tp_mod, in DEFINE_FREE()
1223 if (IS_ERR(tf)) { in DEFINE_FREE()
1224 ret = PTR_ERR(tf); in DEFINE_FREE()
1225 /* This must return -ENOMEM, else there is a bug */ in DEFINE_FREE()
1226 WARN_ON_ONCE(ret != -ENOMEM); in DEFINE_FREE()
1233 ctx->offset = 0; in DEFINE_FREE()
1234 ret = traceprobe_parse_probe_arg(&tf->tp, i, argv[i], ctx); in DEFINE_FREE()
1236 return ret; /* This can be -ENOMEM */ in DEFINE_FREE()
1239 if (is_return && tf->tp.entry_arg) { in DEFINE_FREE()
1240 tf->fp.entry_handler = trace_fprobe_entry_handler; in DEFINE_FREE()
1241 tf->fp.entry_data_size = traceprobe_get_entry_data_size(&tf->tp); in DEFINE_FREE()
1242 if (ALIGN(tf->fp.entry_data_size, sizeof(long)) > MAX_FPROBE_DATA_SIZE) { in DEFINE_FREE()
1245 return -E2BIG; in DEFINE_FREE()
1249 ret = traceprobe_set_print_fmt(&tf->tp, in DEFINE_FREE()
1254 ret = register_trace_fprobe(tf); in DEFINE_FREE()
1257 if (ret == -EILSEQ) in DEFINE_FREE()
1259 else if (ret == -ENOENT) in DEFINE_FREE()
1261 else if (ret != -ENOMEM && ret != -EEXIST) in DEFINE_FREE()
1263 return -EINVAL; in DEFINE_FREE()
1266 /* 'tf' is successfully registered. To avoid freeing, assign NULL. */ in DEFINE_FREE()
1267 tf = NULL; in DEFINE_FREE()
1293 struct trace_fprobe *tf = to_trace_fprobe(ev); in trace_fprobe_release() local
1294 int ret = unregister_trace_fprobe(tf); in trace_fprobe_release()
1297 free_trace_fprobe(tf); in trace_fprobe_release()
1303 struct trace_fprobe *tf = to_trace_fprobe(ev); in trace_fprobe_show() local
1306 if (trace_fprobe_is_tracepoint(tf)) in trace_fprobe_show()
1310 seq_printf(m, ":%s/%s", trace_probe_group_name(&tf->tp), in trace_fprobe_show()
1311 trace_probe_name(&tf->tp)); in trace_fprobe_show()
1313 seq_printf(m, " %s%s", trace_fprobe_symbol(tf), in trace_fprobe_show()
1314 trace_fprobe_is_return(tf) ? "%return" : ""); in trace_fprobe_show()
1316 for (i = 0; i < tf->tp.nr_args; i++) in trace_fprobe_show()
1317 seq_printf(m, " %s=%s", tf->tp.args[i].name, tf->tp.args[i].comm); in trace_fprobe_show()