Lines Matching +full:tf +full:- +full:a

1 // SPDX-License-Identifier: GPL-2.0
3 * Fprobe-based tracing events
61 struct tracepoint *tpoint = tuser->tpoint; in tracepoint_user_register()
67 tpoint->probestub, NULL, 0); in tracepoint_user_register()
72 if (!tuser->tpoint) in tracepoint_user_unregister()
75 WARN_ON_ONCE(tracepoint_probe_unregister(tuser->tpoint, tuser->tpoint->probestub, NULL)); in tracepoint_user_unregister()
76 tuser->tpoint = NULL; in tracepoint_user_unregister()
81 if (!tuser->tpoint) in tracepoint_user_ip()
84 return (unsigned long)tuser->tpoint->probestub; in tracepoint_user_ip()
91 kfree(tuser->name); in __tracepoint_user_free()
105 tuser->name = kstrdup(name, GFP_KERNEL); in DEFINE_FREE()
106 if (!tuser->name) in DEFINE_FREE()
111 tuser->tpoint = tpoint; in DEFINE_FREE()
117 tuser->refcount = 1; in DEFINE_FREE()
118 INIT_LIST_HEAD(&tuser->list); in DEFINE_FREE()
119 list_add(&tuser->list, &tracepoint_user_list); in DEFINE_FREE()
129 * If tracepoint is on a module, get its refcounter too.
139 return ERR_PTR(-EINVAL); in tracepoint_user_find_get()
147 if (!strcmp(tuser->name, name)) { in tracepoint_user_find_get()
148 tuser->refcount++; in tracepoint_user_find_get()
165 if (--tuser->refcount > 0) in tracepoint_user_put()
168 list_del(&tuser->list); in tracepoint_user_put()
186 * loaded with a module. If @tuser != NULL, this trace_fprobe is enabled.
199 return ev->ops == &trace_fprobe_ops; in is_trace_fprobe()
208 * for_each_trace_fprobe - iterate over the trace_fprobe list
210 * @dpos: the struct dyn_event * to use as a loop cursor
216 static bool trace_fprobe_is_return(struct trace_fprobe *tf) in trace_fprobe_is_return() argument
218 return tf->fp.exit_handler != NULL; in trace_fprobe_is_return()
221 static bool trace_fprobe_is_tracepoint(struct trace_fprobe *tf) in trace_fprobe_is_tracepoint() argument
223 return tf->tprobe; in trace_fprobe_is_tracepoint()
226 static const char *trace_fprobe_symbol(struct trace_fprobe *tf) in trace_fprobe_symbol() argument
228 return tf->symbol ? tf->symbol : "unknown"; in trace_fprobe_symbol()
233 struct trace_fprobe *tf = to_trace_fprobe(ev); in trace_fprobe_is_busy() local
235 return trace_probe_is_enabled(&tf->tp); in trace_fprobe_is_busy()
238 static bool trace_fprobe_match_command_head(struct trace_fprobe *tf, in trace_fprobe_match_command_head() argument
246 snprintf(buf, sizeof(buf), "%s", trace_fprobe_symbol(tf)); in trace_fprobe_match_command_head()
249 argc--; argv++; in trace_fprobe_match_command_head()
251 return trace_probe_match_command_args(&tf->tp, argc, argv); in trace_fprobe_match_command_head()
257 struct trace_fprobe *tf = to_trace_fprobe(ev); in trace_fprobe_match() local
259 if (event[0] != '\0' && strcmp(trace_probe_name(&tf->tp), event)) in trace_fprobe_match()
262 if (system && strcmp(trace_probe_group_name(&tf->tp), system)) in trace_fprobe_match()
265 return trace_fprobe_match_command_head(tf, argc, argv); in trace_fprobe_match()
268 static bool trace_fprobe_is_registered(struct trace_fprobe *tf) in trace_fprobe_is_registered() argument
270 return fprobe_is_registered(&tf->fp); in trace_fprobe_is_registered()
287 switch (code->op) { in process_fetch_insn()
289 val = ftrace_regs_get_kernel_stack_nth(fregs, code->param); in process_fetch_insn()
299 val = ftrace_regs_get_argument(fregs, code->param); in process_fetch_insn()
302 val = *(unsigned long *)((unsigned long)edata + code->offset); in process_fetch_insn()
305 case FETCH_NOP_SYMBOL: /* Ignore a place holder */ in process_fetch_insn()
321 __fentry_trace_func(struct trace_fprobe *tf, unsigned long entry_ip, in NOKPROBE_SYMBOL()
326 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in NOKPROBE_SYMBOL()
330 if (WARN_ON_ONCE(call != trace_file->event_call)) in NOKPROBE_SYMBOL()
336 dsize = __get_data_size(&tf->tp, fregs, NULL); in NOKPROBE_SYMBOL()
339 sizeof(*entry) + tf->tp.size + dsize); in NOKPROBE_SYMBOL()
345 entry->ip = entry_ip; in NOKPROBE_SYMBOL()
346 store_trace_args(&entry[1], &tf->tp, fregs, NULL, sizeof(*entry), dsize); in NOKPROBE_SYMBOL()
352 fentry_trace_func(struct trace_fprobe *tf, unsigned long entry_ip, in fentry_trace_func() argument
357 trace_probe_for_each_link_rcu(link, &tf->tp) in fentry_trace_func()
358 __fentry_trace_func(tf, entry_ip, fregs, link->file); in fentry_trace_func()
365 struct probe_entry_arg *earg = tp->entry_arg; in store_fprobe_entry_data()
372 for (i = 0; i < earg->size; i++) { in store_fprobe_entry_data()
373 struct fetch_insn *code = &earg->code[i]; in store_fprobe_entry_data()
375 switch (code->op) { in store_fprobe_entry_data()
377 val = ftrace_regs_get_argument(fregs, code->param); in store_fprobe_entry_data()
380 *(unsigned long *)((unsigned long)edata + code->offset) = val; in store_fprobe_entry_data()
397 struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); in trace_fprobe_entry_handler() local
399 if (tf->tp.entry_arg) in trace_fprobe_entry_handler()
400 store_fprobe_entry_data(entry_data, &tf->tp, fregs); in trace_fprobe_entry_handler()
407 __fexit_trace_func(struct trace_fprobe *tf, unsigned long entry_ip, in NOKPROBE_SYMBOL()
413 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in NOKPROBE_SYMBOL()
416 if (WARN_ON_ONCE(call != trace_file->event_call)) in NOKPROBE_SYMBOL()
422 dsize = __get_data_size(&tf->tp, fregs, entry_data); in NOKPROBE_SYMBOL()
425 sizeof(*entry) + tf->tp.size + dsize); in NOKPROBE_SYMBOL()
431 entry->func = entry_ip; in NOKPROBE_SYMBOL()
432 entry->ret_ip = ret_ip; in NOKPROBE_SYMBOL()
433 store_trace_args(&entry[1], &tf->tp, fregs, entry_data, sizeof(*entry), dsize); in NOKPROBE_SYMBOL()
439 fexit_trace_func(struct trace_fprobe *tf, unsigned long entry_ip, in fexit_trace_func() argument
444 trace_probe_for_each_link_rcu(link, &tf->tp) in fexit_trace_func()
445 __fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data, link->file); in fexit_trace_func()
451 static int fentry_perf_func(struct trace_fprobe *tf, unsigned long entry_ip, in fentry_perf_func() argument
454 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in fentry_perf_func()
461 head = this_cpu_ptr(call->perf_events); in fentry_perf_func()
465 dsize = __get_data_size(&tf->tp, fregs, NULL); in fentry_perf_func()
466 __size = sizeof(*entry) + tf->tp.size + dsize; in fentry_perf_func()
468 size -= sizeof(u32); in fentry_perf_func()
476 entry->ip = entry_ip; in fentry_perf_func()
478 store_trace_args(&entry[1], &tf->tp, fregs, NULL, sizeof(*entry), dsize); in fentry_perf_func()
479 perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs, in fentry_perf_func()
486 fexit_perf_func(struct trace_fprobe *tf, unsigned long entry_ip, in fexit_perf_func() argument
490 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in fexit_perf_func()
497 head = this_cpu_ptr(call->perf_events); in fexit_perf_func()
501 dsize = __get_data_size(&tf->tp, fregs, entry_data); in fexit_perf_func()
502 __size = sizeof(*entry) + tf->tp.size + dsize; in fexit_perf_func()
504 size -= sizeof(u32); in fexit_perf_func()
512 entry->func = entry_ip; in fexit_perf_func()
513 entry->ret_ip = ret_ip; in fexit_perf_func()
514 store_trace_args(&entry[1], &tf->tp, fregs, entry_data, sizeof(*entry), dsize); in fexit_perf_func()
515 perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs, in fexit_perf_func()
525 struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); in fentry_dispatcher() local
526 unsigned int flags = trace_probe_load_flag(&tf->tp); in fentry_dispatcher()
530 fentry_trace_func(tf, entry_ip, fregs); in fentry_dispatcher()
534 ret = fentry_perf_func(tf, entry_ip, fregs); in fentry_dispatcher()
544 struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); in fexit_dispatcher() local
545 unsigned int flags = trace_probe_load_flag(&tf->tp); in fexit_dispatcher()
548 fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data); in fexit_dispatcher()
551 fexit_perf_func(tf, entry_ip, ret_ip, fregs, entry_data); in fexit_dispatcher()
556 static void free_trace_fprobe(struct trace_fprobe *tf) in free_trace_fprobe() argument
558 if (tf) { in free_trace_fprobe()
559 trace_probe_cleanup(&tf->tp); in free_trace_fprobe()
560 if (tf->tuser) in free_trace_fprobe()
561 tracepoint_user_put(tf->tuser); in free_trace_fprobe()
562 kfree(tf->symbol); in free_trace_fprobe()
563 kfree(tf); in free_trace_fprobe()
579 struct trace_fprobe *tf __free(free_trace_fprobe) = NULL; in alloc_trace_fprobe()
580 int ret = -ENOMEM; in alloc_trace_fprobe()
582 tf = kzalloc(struct_size(tf, tp.args, nargs), GFP_KERNEL); in alloc_trace_fprobe()
583 if (!tf) in alloc_trace_fprobe()
586 tf->symbol = kstrdup(symbol, GFP_KERNEL); in alloc_trace_fprobe()
587 if (!tf->symbol) in alloc_trace_fprobe()
588 return ERR_PTR(-ENOMEM); in alloc_trace_fprobe()
591 tf->fp.exit_handler = fexit_dispatcher; in alloc_trace_fprobe()
593 tf->fp.entry_handler = fentry_dispatcher; in alloc_trace_fprobe()
595 tf->tprobe = is_tracepoint; in alloc_trace_fprobe()
597 ret = trace_probe_init(&tf->tp, event, group, false, nargs); in alloc_trace_fprobe()
601 dyn_event_init(&tf->devent, &trace_fprobe_ops); in alloc_trace_fprobe()
602 return_ptr(tf); in alloc_trace_fprobe()
609 struct trace_fprobe *tf; in find_trace_fprobe() local
611 for_each_trace_fprobe(tf, pos) in find_trace_fprobe()
612 if (strcmp(trace_probe_name(&tf->tp), event) == 0 && in find_trace_fprobe()
613 strcmp(trace_probe_group_name(&tf->tp), group) == 0) in find_trace_fprobe()
614 return tf; in find_trace_fprobe()
624 struct trace_seq *s = &iter->seq; in print_fentry_event()
627 field = (struct fentry_trace_entry_head *)iter->ent; in print_fentry_event()
635 if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET)) in print_fentry_event()
640 if (trace_probe_print_args(s, tp->args, tp->nr_args, in print_fentry_event()
654 struct trace_seq *s = &iter->seq; in print_fexit_event()
657 field = (struct fexit_trace_entry_head *)iter->ent; in print_fexit_event()
665 if (!seq_print_ip_sym(s, field->ret_ip, flags | TRACE_ITER_SYM_OFFSET)) in print_fexit_event()
668 trace_seq_puts(s, " <- "); in print_fexit_event()
670 if (!seq_print_ip_sym(s, field->func, flags & ~TRACE_ITER_SYM_OFFSET)) in print_fexit_event()
675 if (trace_probe_print_args(s, tp->args, tp->nr_args, in print_fexit_event()
693 return -ENOENT; in fentry_event_define_fields()
708 return -ENOENT; in fexit_event_define_fields()
739 static inline void init_trace_event_call(struct trace_fprobe *tf) in init_trace_event_call() argument
741 struct trace_event_call *call = trace_probe_event_call(&tf->tp); in init_trace_event_call()
743 if (trace_fprobe_is_return(tf)) { in init_trace_event_call()
744 call->event.funcs = &fexit_funcs; in init_trace_event_call()
745 call->class->fields_array = fexit_fields_array; in init_trace_event_call()
747 call->event.funcs = &fentry_funcs; in init_trace_event_call()
748 call->class->fields_array = fentry_fields_array; in init_trace_event_call()
751 call->flags = TRACE_EVENT_FL_FPROBE; in init_trace_event_call()
752 call->class->reg = fprobe_register; in init_trace_event_call()
755 static int register_fprobe_event(struct trace_fprobe *tf) in register_fprobe_event() argument
757 init_trace_event_call(tf); in register_fprobe_event()
759 return trace_probe_register_event_call(&tf->tp); in register_fprobe_event()
762 static int unregister_fprobe_event(struct trace_fprobe *tf) in unregister_fprobe_event() argument
764 return trace_probe_unregister_event_call(&tf->tp); in unregister_fprobe_event()
767 static int __regsiter_tracepoint_fprobe(struct trace_fprobe *tf) in __regsiter_tracepoint_fprobe() argument
774 if (WARN_ON_ONCE(tf->tuser)) in __regsiter_tracepoint_fprobe()
775 return -EINVAL; in __regsiter_tracepoint_fprobe()
777 /* If the tracepoint is in a module, it must be locked in this function. */ in __regsiter_tracepoint_fprobe()
778 tuser = tracepoint_user_find_get(tf->symbol, &mod); in __regsiter_tracepoint_fprobe()
783 return -ENOMEM; in __regsiter_tracepoint_fprobe()
786 if (tuser->tpoint) { in __regsiter_tracepoint_fprobe()
789 return -ENOENT; in __regsiter_tracepoint_fprobe()
791 ret = register_fprobe_ips(&tf->fp, &ip, 1); in __regsiter_tracepoint_fprobe()
796 tf->tuser = no_free_ptr(tuser); in __regsiter_tracepoint_fprobe()
801 static int trace_fprobe_verify_target(struct trace_fprobe *tf) in trace_fprobe_verify_target() argument
805 /* Tracepoint should have a stub function. */ in trace_fprobe_verify_target()
806 if (trace_fprobe_is_tracepoint(tf)) in trace_fprobe_verify_target()
813 ret = fprobe_count_ips_from_filter(tf->symbol, NULL); in trace_fprobe_verify_target()
817 /* Internal register function - just handle fprobe and flags */
818 static int __register_trace_fprobe(struct trace_fprobe *tf) in __register_trace_fprobe() argument
827 if (trace_fprobe_is_registered(tf)) in __register_trace_fprobe()
828 return -EINVAL; in __register_trace_fprobe()
830 for (i = 0; i < tf->tp.nr_args; i++) { in __register_trace_fprobe()
831 ret = traceprobe_update_arg(&tf->tp.args[i]); in __register_trace_fprobe()
836 tf->fp.flags &= ~FPROBE_FL_DISABLED; in __register_trace_fprobe()
838 if (trace_fprobe_is_tracepoint(tf)) in __register_trace_fprobe()
839 return __regsiter_tracepoint_fprobe(tf); in __register_trace_fprobe()
842 return register_fprobe(&tf->fp, tf->symbol, NULL); in __register_trace_fprobe()
845 /* Internal unregister function - just handle fprobe and flags */
846 static void __unregister_trace_fprobe(struct trace_fprobe *tf) in __unregister_trace_fprobe() argument
848 if (trace_fprobe_is_registered(tf)) in __unregister_trace_fprobe()
849 unregister_fprobe(&tf->fp); in __unregister_trace_fprobe()
850 if (tf->tuser) { in __unregister_trace_fprobe()
851 tracepoint_user_put(tf->tuser); in __unregister_trace_fprobe()
852 tf->tuser = NULL; in __unregister_trace_fprobe()
857 /* Unregister a trace_probe and probe_event */
858 static int unregister_trace_fprobe(struct trace_fprobe *tf) in unregister_trace_fprobe() argument
861 if (trace_probe_has_sibling(&tf->tp)) in unregister_trace_fprobe()
865 if (trace_probe_is_enabled(&tf->tp)) in unregister_trace_fprobe()
866 return -EBUSY; in unregister_trace_fprobe()
868 /* If there's a reference to the dynamic event */ in unregister_trace_fprobe()
869 if (trace_event_dyn_busy(trace_probe_event_call(&tf->tp))) in unregister_trace_fprobe()
870 return -EBUSY; in unregister_trace_fprobe()
873 if (unregister_fprobe_event(tf)) in unregister_trace_fprobe()
874 return -EBUSY; in unregister_trace_fprobe()
877 __unregister_trace_fprobe(tf); in unregister_trace_fprobe()
878 dyn_event_remove(&tf->devent); in unregister_trace_fprobe()
879 trace_probe_unlink(&tf->tp); in unregister_trace_fprobe()
887 struct trace_probe_event *tpe = orig->tp.event; in trace_fprobe_has_same_fprobe()
890 list_for_each_entry(orig, &tpe->probes, tp.list) { in trace_fprobe_has_same_fprobe()
899 for (i = 0; i < orig->tp.nr_args; i++) { in trace_fprobe_has_same_fprobe()
900 if (strcmp(orig->tp.args[i].comm, in trace_fprobe_has_same_fprobe()
901 comp->tp.args[i].comm)) in trace_fprobe_has_same_fprobe()
905 if (i == orig->tp.nr_args) in trace_fprobe_has_same_fprobe()
912 static int append_trace_fprobe_event(struct trace_fprobe *tf, struct trace_fprobe *to) in append_trace_fprobe_event() argument
916 if (trace_fprobe_is_return(tf) != trace_fprobe_is_return(to) || in append_trace_fprobe_event()
917 trace_fprobe_is_tracepoint(tf) != trace_fprobe_is_tracepoint(to)) { in append_trace_fprobe_event()
920 return -EEXIST; in append_trace_fprobe_event()
922 ret = trace_probe_compare_arg_type(&tf->tp, &to->tp); in append_trace_fprobe_event()
927 return -EEXIST; in append_trace_fprobe_event()
929 if (trace_fprobe_has_same_fprobe(to, tf)) { in append_trace_fprobe_event()
932 return -EEXIST; in append_trace_fprobe_event()
936 ret = trace_probe_append(&tf->tp, &to->tp); in append_trace_fprobe_event()
940 ret = trace_fprobe_verify_target(tf); in append_trace_fprobe_event()
942 trace_probe_unlink(&tf->tp); in append_trace_fprobe_event()
944 dyn_event_add(&tf->devent, trace_probe_event_call(&tf->tp)); in append_trace_fprobe_event()
949 /* Register a trace_probe and probe_event, and check the fprobe is available. */
950 static int register_trace_fprobe_event(struct trace_fprobe *tf) in register_trace_fprobe_event() argument
957 old_tf = find_trace_fprobe(trace_probe_name(&tf->tp), in register_trace_fprobe_event()
958 trace_probe_group_name(&tf->tp)); in register_trace_fprobe_event()
960 return append_trace_fprobe_event(tf, old_tf); in register_trace_fprobe_event()
963 ret = register_fprobe_event(tf); in register_trace_fprobe_event()
965 if (ret == -EEXIST) { in register_trace_fprobe_event()
974 ret = trace_fprobe_verify_target(tf); in register_trace_fprobe_event()
976 unregister_fprobe_event(tf); in register_trace_fprobe_event()
978 dyn_event_add(&tf->devent, trace_probe_event_call(&tf->tp)); in register_trace_fprobe_event()
993 if (!data->tpoint && !strcmp(data->tp_name, tp->name)) { in __find_tracepoint_module_cb()
995 if (!data->mod && mod) { in __find_tracepoint_module_cb()
1000 data->mod = mod; in __find_tracepoint_module_cb()
1002 data->tpoint = tp; in __find_tracepoint_module_cb()
1010 if (!data->tpoint && !strcmp(data->tp_name, tp->name)) in __find_tracepoint_cb()
1011 data->tpoint = tp; in __find_tracepoint_cb()
1015 * Find a tracepoint from kernel and module. If the tracepoint is on the module,
1039 * Find a tracepoint from specified module. In this case, this does not get the
1064 tuser->tpoint = tpoint; in tracepoint_user_register_again()
1071 tuser->tpoint = NULL; in tracepoint_user_unregister_clear()
1088 /* This is not a tracepoint in this module. Skip it. */ in __tracepoint_probe_module_cb()
1089 tpoint = find_tracepoint_in_module(tp_mod->mod, tuser->name); in __tracepoint_probe_module_cb()
1094 tracepoint_user_within_module(tuser, tp_mod->mod)) { in __tracepoint_probe_module_cb()
1112 struct trace_fprobe *tf; in __tprobe_event_module_cb() local
1120 for_each_trace_fprobe(tf, pos) { in __tprobe_event_module_cb()
1122 if (!trace_fprobe_is_tracepoint(tf) || !tf->tuser) in __tprobe_event_module_cb()
1127 tracepoint_user_within_module(tf->tuser, mod)) { in __tprobe_event_module_cb()
1128 unsigned long ip = tracepoint_user_ip(tf->tuser); in __tprobe_event_module_cb()
1130 WARN_ON_ONCE(register_fprobe_ips(&tf->fp, &ip, 1)); in __tprobe_event_module_cb()
1139 trace_fprobe_is_registered(tf) && in __tprobe_event_module_cb()
1140 !tf->tuser->tpoint) { in __tprobe_event_module_cb()
1141 unregister_fprobe(&tf->fp); in __tprobe_event_module_cb()
1153 .priority = -10,
1165 int len = tmp - argv[1]; in parse_symbol_and_return()
1171 return -EINVAL; in parse_symbol_and_return()
1177 return -ENOMEM; in parse_symbol_and_return()
1187 /* find a wrong character. */ in parse_symbol_and_return()
1188 trace_probe_log_err(tmp - *symbol, BAD_TP_NAME); in parse_symbol_and_return()
1191 return -EINVAL; in parse_symbol_and_return()
1195 /* If there is $retval, this should be a return fprobe. */ in parse_symbol_and_return()
1201 trace_probe_log_err(tmp - argv[i], RETVAL_ON_PROBE); in parse_symbol_and_return()
1204 return -EINVAL; in parse_symbol_and_return()
1218 * - Add fentry probe: in trace_fprobe_create_internal()
1220 * - Add fexit probe: in trace_fprobe_create_internal()
1222 * - Add tracepoint probe: in trace_fprobe_create_internal()
1228 * $stackN : fetch Nth entry of stack (N:0-) in trace_fprobe_create_internal()
1229 * $argN : fetch Nth argument (N:1-) in trace_fprobe_create_internal()
1232 * @SYM[+|-offs] : fetch memory at SYM +|- offs (SYM is a data symbol) in trace_fprobe_create_internal()
1234 * +|-offs(ARG) : fetch memory at ARG +|- offs address. in trace_fprobe_create_internal()
1240 struct trace_fprobe *tf __free(free_trace_fprobe) = NULL; in trace_fprobe_create_internal()
1255 return -ECANCELED; in trace_fprobe_create_internal()
1266 return -EINVAL; in trace_fprobe_create_internal()
1273 /* a symbol(or tracepoint) must be specified */ in trace_fprobe_create_internal()
1276 return -EINVAL; in trace_fprobe_create_internal()
1282 return -ENOMEM; in trace_fprobe_create_internal()
1284 event - argv[0]); in trace_fprobe_create_internal()
1286 return -EINVAL; in trace_fprobe_create_internal()
1292 return -ENOMEM; in trace_fprobe_create_internal()
1293 /* Make a new event name */ in trace_fprobe_create_internal()
1305 ctx->flags |= TPARG_FL_RETURN; in trace_fprobe_create_internal()
1307 ctx->flags |= TPARG_FL_FENTRY; in trace_fprobe_create_internal()
1309 ctx->funcname = NULL; in trace_fprobe_create_internal()
1314 ctx->flags |= TPARG_FL_TPOINT; in trace_fprobe_create_internal()
1320 return -ENOMEM; in trace_fprobe_create_internal()
1321 ctx->funcname = kallsyms_lookup((unsigned long)tpoint->probestub, in trace_fprobe_create_internal()
1325 if (!ctx->funcname) in trace_fprobe_create_internal()
1326 ctx->funcname = symbol; in trace_fprobe_create_internal()
1330 return -ENOMEM; in trace_fprobe_create_internal()
1331 argc -= 2; argv += 2; in trace_fprobe_create_internal()
1343 return -E2BIG; in trace_fprobe_create_internal()
1350 /* setup a probe */ in trace_fprobe_create_internal()
1351 tf = alloc_trace_fprobe(group, event, symbol, argc, is_return, is_tracepoint); in trace_fprobe_create_internal()
1352 if (IS_ERR(tf)) { in trace_fprobe_create_internal()
1353 ret = PTR_ERR(tf); in trace_fprobe_create_internal()
1354 /* This must return -ENOMEM, else there is a bug */ in trace_fprobe_create_internal()
1355 WARN_ON_ONCE(ret != -ENOMEM); in trace_fprobe_create_internal()
1362 ctx->offset = 0; in trace_fprobe_create_internal()
1363 ret = traceprobe_parse_probe_arg(&tf->tp, i, argv[i], ctx); in trace_fprobe_create_internal()
1365 return ret; /* This can be -ENOMEM */ in trace_fprobe_create_internal()
1368 if (is_return && tf->tp.entry_arg) { in trace_fprobe_create_internal()
1369 tf->fp.entry_handler = trace_fprobe_entry_handler; in trace_fprobe_create_internal()
1370 tf->fp.entry_data_size = traceprobe_get_entry_data_size(&tf->tp); in trace_fprobe_create_internal()
1371 if (ALIGN(tf->fp.entry_data_size, sizeof(long)) > MAX_FPROBE_DATA_SIZE) { in trace_fprobe_create_internal()
1374 return -E2BIG; in trace_fprobe_create_internal()
1378 ret = traceprobe_set_print_fmt(&tf->tp, in trace_fprobe_create_internal()
1383 ret = register_trace_fprobe_event(tf); in trace_fprobe_create_internal()
1386 if (ret == -EILSEQ) in trace_fprobe_create_internal()
1388 else if (ret == -ENOENT) in trace_fprobe_create_internal()
1390 else if (ret != -ENOMEM && ret != -EEXIST) in trace_fprobe_create_internal()
1392 return -EINVAL; in trace_fprobe_create_internal()
1395 /* 'tf' is successfully registered. To avoid freeing, assign NULL. */ in trace_fprobe_create_internal()
1396 tf = NULL; in trace_fprobe_create_internal()
1408 return -ENOMEM; in trace_fprobe_create_cb()
1410 ctx->flags = TPARG_FL_KERNEL | TPARG_FL_FPROBE; in trace_fprobe_create_cb()
1425 struct trace_fprobe *tf = to_trace_fprobe(ev); in trace_fprobe_release() local
1426 int ret = unregister_trace_fprobe(tf); in trace_fprobe_release()
1429 free_trace_fprobe(tf); in trace_fprobe_release()
1435 struct trace_fprobe *tf = to_trace_fprobe(ev); in trace_fprobe_show() local
1438 if (trace_fprobe_is_tracepoint(tf)) in trace_fprobe_show()
1442 seq_printf(m, ":%s/%s", trace_probe_group_name(&tf->tp), in trace_fprobe_show()
1443 trace_probe_name(&tf->tp)); in trace_fprobe_show()
1445 seq_printf(m, " %s%s", trace_fprobe_symbol(tf), in trace_fprobe_show()
1446 trace_fprobe_is_return(tf) ? "%return" : ""); in trace_fprobe_show()
1448 for (i = 0; i < tf->tp.nr_args; i++) in trace_fprobe_show()
1449 seq_printf(m, " %s=%s", tf->tp.args[i].name, tf->tp.args[i].comm); in trace_fprobe_show()
1463 struct trace_fprobe *tf; in enable_trace_fprobe() local
1469 return -ENODEV; in enable_trace_fprobe()
1481 list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) { in enable_trace_fprobe()
1482 ret = __register_trace_fprobe(tf); in enable_trace_fprobe()
1498 struct trace_fprobe *tf; in disable_trace_fprobe() local
1503 return -ENODEV; in disable_trace_fprobe()
1507 return -ENOENT; in disable_trace_fprobe()
1515 list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) { in disable_trace_fprobe()
1516 unregister_fprobe(&tf->fp); in disable_trace_fprobe()
1517 if (tf->tuser) { in disable_trace_fprobe()
1518 tracepoint_user_put(tf->tuser); in disable_trace_fprobe()
1519 tf->tuser = NULL; in disable_trace_fprobe()