Lines Matching refs:tu
91 static int register_uprobe_event(struct trace_uprobe *tu);
92 static int unregister_uprobe_event(struct trace_uprobe *tu);
213 base_addr = udd->bp_addr - udd->tu->offset; in translate_user_vaddr()
269 static inline bool is_ret_probe(struct trace_uprobe *tu) in is_ret_probe() argument
271 return tu->consumer.ret_handler != NULL; in is_ret_probe()
276 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_is_busy() local
278 return trace_probe_is_enabled(&tu->tp); in trace_uprobe_is_busy()
281 static bool trace_uprobe_match_command_head(struct trace_uprobe *tu, in trace_uprobe_match_command_head() argument
290 len = strlen(tu->filename); in trace_uprobe_match_command_head()
291 if (strncmp(tu->filename, argv[0], len) || argv[0][len] != ':') in trace_uprobe_match_command_head()
294 if (tu->ref_ctr_offset == 0) in trace_uprobe_match_command_head()
296 (int)(sizeof(void *) * 2), tu->offset); in trace_uprobe_match_command_head()
299 (int)(sizeof(void *) * 2), tu->offset, in trace_uprobe_match_command_head()
300 tu->ref_ctr_offset); in trace_uprobe_match_command_head()
306 return trace_probe_match_command_args(&tu->tp, argc, argv); in trace_uprobe_match_command_head()
312 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_match() local
315 strcmp(trace_probe_name(&tu->tp), event) == 0) && in trace_uprobe_match()
316 (!system || strcmp(trace_probe_group_name(&tu->tp), system) == 0) && in trace_uprobe_match()
317 trace_uprobe_match_command_head(tu, argc, argv); in trace_uprobe_match()
338 struct trace_uprobe *tu; in alloc_trace_uprobe() local
341 tu = kzalloc(struct_size(tu, tp.args, nargs), GFP_KERNEL); in alloc_trace_uprobe()
342 if (!tu) in alloc_trace_uprobe()
345 tu->nhits = alloc_percpu(unsigned long); in alloc_trace_uprobe()
346 if (!tu->nhits) { in alloc_trace_uprobe()
351 ret = trace_probe_init(&tu->tp, event, group, true, nargs); in alloc_trace_uprobe()
355 dyn_event_init(&tu->devent, &trace_uprobe_ops); in alloc_trace_uprobe()
356 tu->consumer.handler = uprobe_dispatcher; in alloc_trace_uprobe()
358 tu->consumer.ret_handler = uretprobe_dispatcher; in alloc_trace_uprobe()
359 init_trace_uprobe_filter(tu->tp.event->filter); in alloc_trace_uprobe()
360 return tu; in alloc_trace_uprobe()
363 free_percpu(tu->nhits); in alloc_trace_uprobe()
364 kfree(tu); in alloc_trace_uprobe()
369 static void free_trace_uprobe(struct trace_uprobe *tu) in free_trace_uprobe() argument
371 if (!tu) in free_trace_uprobe()
374 path_put(&tu->path); in free_trace_uprobe()
375 trace_probe_cleanup(&tu->tp); in free_trace_uprobe()
376 kfree(tu->filename); in free_trace_uprobe()
377 free_percpu(tu->nhits); in free_trace_uprobe()
378 kfree(tu); in free_trace_uprobe()
384 struct trace_uprobe *tu; in find_probe_event() local
386 for_each_trace_uprobe(tu, pos) in find_probe_event()
387 if (strcmp(trace_probe_name(&tu->tp), event) == 0 && in find_probe_event()
388 strcmp(trace_probe_group_name(&tu->tp), group) == 0) in find_probe_event()
389 return tu; in find_probe_event()
395 static int unregister_trace_uprobe(struct trace_uprobe *tu) in unregister_trace_uprobe() argument
399 if (trace_probe_has_sibling(&tu->tp)) in unregister_trace_uprobe()
403 if (trace_event_dyn_busy(trace_probe_event_call(&tu->tp))) in unregister_trace_uprobe()
406 ret = unregister_uprobe_event(tu); in unregister_trace_uprobe()
411 dyn_event_remove(&tu->devent); in unregister_trace_uprobe()
412 trace_probe_unlink(&tu->tp); in unregister_trace_uprobe()
413 free_trace_uprobe(tu); in unregister_trace_uprobe()
446 static int append_trace_uprobe(struct trace_uprobe *tu, struct trace_uprobe *to) in append_trace_uprobe() argument
450 ret = trace_probe_compare_arg_type(&tu->tp, &to->tp); in append_trace_uprobe()
457 if (trace_uprobe_has_same_uprobe(to, tu)) { in append_trace_uprobe()
464 ret = trace_probe_append(&tu->tp, &to->tp); in append_trace_uprobe()
466 dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp)); in append_trace_uprobe()
498 static int register_trace_uprobe(struct trace_uprobe *tu) in register_trace_uprobe() argument
505 ret = validate_ref_ctr_offset(tu); in register_trace_uprobe()
510 old_tu = find_probe_event(trace_probe_name(&tu->tp), in register_trace_uprobe()
511 trace_probe_group_name(&tu->tp)); in register_trace_uprobe()
513 if (is_ret_probe(tu) != is_ret_probe(old_tu)) { in register_trace_uprobe()
518 return append_trace_uprobe(tu, old_tu); in register_trace_uprobe()
521 ret = register_uprobe_event(tu); in register_trace_uprobe()
531 dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp)); in register_trace_uprobe()
545 struct trace_uprobe *tu __free(free_trace_uprobe) = NULL; in DEFINE_FREE()
688 tu = alloc_trace_uprobe(group, event, argc, is_return); in DEFINE_FREE()
689 if (IS_ERR(tu)) { in DEFINE_FREE()
690 ret = PTR_ERR(tu); in DEFINE_FREE()
695 tu->offset = offset; in DEFINE_FREE()
696 tu->ref_ctr_offset = ref_ctr_offset; in DEFINE_FREE()
697 tu->path = path; in DEFINE_FREE()
700 tu->filename = no_free_ptr(filename); in DEFINE_FREE()
710 ret = traceprobe_parse_probe_arg(&tu->tp, i, argv[i], ctx); in DEFINE_FREE()
715 ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; in DEFINE_FREE()
716 ret = traceprobe_set_print_fmt(&tu->tp, ptype); in DEFINE_FREE()
720 ret = register_trace_uprobe(tu); in DEFINE_FREE()
722 tu = NULL; in DEFINE_FREE()
745 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_release() local
747 return unregister_trace_uprobe(tu); in trace_uprobe_release()
753 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_show() local
754 char c = is_ret_probe(tu) ? 'r' : 'p'; in trace_uprobe_show()
757 seq_printf(m, "%c:%s/%s %s:0x%0*lx", c, trace_probe_group_name(&tu->tp), in trace_uprobe_show()
758 trace_probe_name(&tu->tp), tu->filename, in trace_uprobe_show()
759 (int)(sizeof(void *) * 2), tu->offset); in trace_uprobe_show()
761 if (tu->ref_ctr_offset) in trace_uprobe_show()
762 seq_printf(m, "(0x%lx)", tu->ref_ctr_offset); in trace_uprobe_show()
764 for (i = 0; i < tu->tp.nr_args; i++) in trace_uprobe_show()
765 seq_printf(m, " %s=%s", tu->tp.args[i].name, tu->tp.args[i].comm); in trace_uprobe_show()
825 struct trace_uprobe *tu; in probes_profile_seq_show() local
832 tu = to_trace_uprobe(ev); in probes_profile_seq_show()
836 nhits += per_cpu(*tu->nhits, cpu); in probes_profile_seq_show()
839 seq_printf(m, " %s %-44s %15lu\n", tu->filename, in probes_profile_seq_show()
840 trace_probe_name(&tu->tp), nhits); in probes_profile_seq_show()
966 static struct uprobe_cpu_buffer *prepare_uprobe_buffer(struct trace_uprobe *tu, in prepare_uprobe_buffer() argument
976 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in prepare_uprobe_buffer()
977 dsize = __get_data_size(&tu->tp, regs, NULL); in prepare_uprobe_buffer()
980 ucb->dsize = tu->tp.size + dsize; in prepare_uprobe_buffer()
984 dsize = MAX_UCB_BUFFER_SIZE - tu->tp.size; in prepare_uprobe_buffer()
987 store_trace_args(ucb->buf, &tu->tp, regs, NULL, esize, dsize); in prepare_uprobe_buffer()
993 static void __uprobe_trace_func(struct trace_uprobe *tu, in __uprobe_trace_func() argument
1002 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_trace_func()
1009 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_trace_func()
1015 if (is_ret_probe(tu)) { in __uprobe_trace_func()
1030 static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_trace_func() argument
1036 if (is_ret_probe(tu)) in uprobe_trace_func()
1039 ucb = prepare_uprobe_buffer(tu, regs, ucbp); in uprobe_trace_func()
1042 trace_probe_for_each_link_rcu(link, &tu->tp) in uprobe_trace_func()
1043 __uprobe_trace_func(tu, 0, regs, ucb, link->file); in uprobe_trace_func()
1049 static void uretprobe_trace_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_trace_func() argument
1056 ucb = prepare_uprobe_buffer(tu, regs, ucbp); in uretprobe_trace_func()
1059 trace_probe_for_each_link_rcu(link, &tu->tp) in uretprobe_trace_func()
1060 __uprobe_trace_func(tu, func, regs, ucb, link->file); in uretprobe_trace_func()
1070 struct trace_uprobe *tu; in print_uprobe_event() local
1074 tu = trace_uprobe_primary_from_call( in print_uprobe_event()
1076 if (unlikely(!tu)) in print_uprobe_event()
1079 if (is_ret_probe(tu)) { in print_uprobe_event()
1081 trace_probe_name(&tu->tp), in print_uprobe_event()
1086 trace_probe_name(&tu->tp), in print_uprobe_event()
1091 if (trace_probe_print_args(s, tu->tp.args, tu->tp.nr_args, data, entry) < 0) in print_uprobe_event()
1102 static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter) in trace_uprobe_enable() argument
1104 struct inode *inode = d_real_inode(tu->path.dentry); in trace_uprobe_enable()
1107 tu->consumer.filter = filter; in trace_uprobe_enable()
1108 uprobe = uprobe_register(inode, tu->offset, tu->ref_ctr_offset, &tu->consumer); in trace_uprobe_enable()
1112 tu->uprobe = uprobe; in trace_uprobe_enable()
1118 struct trace_uprobe *tu; in __probe_event_disable() local
1121 tu = container_of(tp, struct trace_uprobe, tp); in __probe_event_disable()
1122 WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); in __probe_event_disable()
1124 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in __probe_event_disable()
1125 if (!tu->uprobe) in __probe_event_disable()
1128 uprobe_unregister_nosync(tu->uprobe, &tu->consumer); in __probe_event_disable()
1130 tu->uprobe = NULL; in __probe_event_disable()
1140 struct trace_uprobe *tu; in probe_event_enable() local
1164 tu = container_of(tp, struct trace_uprobe, tp); in probe_event_enable()
1165 WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); in probe_event_enable()
1174 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in probe_event_enable()
1175 ret = trace_uprobe_enable(tu, filter); in probe_event_enable()
1225 struct trace_uprobe *tu; in uprobe_event_define_fields() local
1227 tu = trace_uprobe_primary_from_call(event_call); in uprobe_event_define_fields()
1228 if (unlikely(!tu)) in uprobe_event_define_fields()
1231 if (is_ret_probe(tu)) { in uprobe_event_define_fields()
1240 return traceprobe_define_arg_fields(event_call, size, &tu->tp); in uprobe_event_define_fields()
1317 struct trace_uprobe *tu; in uprobe_perf_close() local
1324 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_close()
1325 if (trace_uprobe_filter_remove(tu->tp.event->filter, event)) in uprobe_perf_close()
1328 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in uprobe_perf_close()
1329 ret = uprobe_apply(tu->uprobe, &tu->consumer, false); in uprobe_perf_close()
1341 struct trace_uprobe *tu; in uprobe_perf_open() local
1348 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_open()
1349 if (trace_uprobe_filter_add(tu->tp.event->filter, event)) in uprobe_perf_open()
1352 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in uprobe_perf_open()
1353 err = uprobe_apply(tu->uprobe, &tu->consumer, true); in uprobe_perf_open()
1366 struct trace_uprobe *tu; in uprobe_perf_filter() local
1369 tu = container_of(uc, struct trace_uprobe, consumer); in uprobe_perf_filter()
1370 filter = tu->tp.event->filter; in uprobe_perf_filter()
1386 static void __uprobe_perf_func(struct trace_uprobe *tu, in __uprobe_perf_func() argument
1390 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_perf_func()
1412 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_perf_func()
1414 ucb = prepare_uprobe_buffer(tu, regs, ucbp); in __uprobe_perf_func()
1429 if (is_ret_probe(tu)) { in __uprobe_perf_func()
1450 static int uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_perf_func() argument
1453 if (!uprobe_perf_filter(&tu->consumer, current->mm)) in uprobe_perf_func()
1456 if (!is_ret_probe(tu)) in uprobe_perf_func()
1457 __uprobe_perf_func(tu, 0, regs, ucbp); in uprobe_perf_func()
1461 static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_perf_func() argument
1465 __uprobe_perf_func(tu, func, regs, ucbp); in uretprobe_perf_func()
1474 struct trace_uprobe *tu; in bpf_get_uprobe_info() local
1477 tu = find_probe_event(pevent, group); in bpf_get_uprobe_info()
1479 tu = trace_uprobe_primary_from_call(event->tp_event); in bpf_get_uprobe_info()
1480 if (!tu) in bpf_get_uprobe_info()
1483 *fd_type = is_ret_probe(tu) ? BPF_FD_TYPE_URETPROBE in bpf_get_uprobe_info()
1485 *filename = tu->filename; in bpf_get_uprobe_info()
1486 *probe_offset = tu->offset; in bpf_get_uprobe_info()
1487 *probe_addr = tu->ref_ctr_offset; in bpf_get_uprobe_info()
1529 struct trace_uprobe *tu; in uprobe_dispatcher() local
1535 tu = container_of(con, struct trace_uprobe, consumer); in uprobe_dispatcher()
1537 this_cpu_inc(*tu->nhits); in uprobe_dispatcher()
1539 udd.tu = tu; in uprobe_dispatcher()
1547 flags = trace_probe_load_flag(&tu->tp); in uprobe_dispatcher()
1549 ret |= uprobe_trace_func(tu, regs, &ucb); in uprobe_dispatcher()
1553 ret |= uprobe_perf_func(tu, regs, &ucb); in uprobe_dispatcher()
1563 struct trace_uprobe *tu; in uretprobe_dispatcher() local
1568 tu = container_of(con, struct trace_uprobe, consumer); in uretprobe_dispatcher()
1570 udd.tu = tu; in uretprobe_dispatcher()
1578 flags = trace_probe_load_flag(&tu->tp); in uretprobe_dispatcher()
1580 uretprobe_trace_func(tu, func, regs, &ucb); in uretprobe_dispatcher()
1584 uretprobe_perf_func(tu, func, regs, &ucb); in uretprobe_dispatcher()
1600 static inline void init_trace_event_call(struct trace_uprobe *tu) in init_trace_event_call() argument
1602 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in init_trace_event_call()
1610 static int register_uprobe_event(struct trace_uprobe *tu) in register_uprobe_event() argument
1612 init_trace_event_call(tu); in register_uprobe_event()
1614 return trace_probe_register_event_call(&tu->tp); in register_uprobe_event()
1617 static int unregister_uprobe_event(struct trace_uprobe *tu) in unregister_uprobe_event() argument
1619 return trace_probe_unregister_event_call(&tu->tp); in unregister_uprobe_event()
1628 struct trace_uprobe *tu; in create_local_trace_uprobe() local
1646 tu = alloc_trace_uprobe(UPROBE_EVENT_SYSTEM, "DUMMY_EVENT", 0, in create_local_trace_uprobe()
1649 if (IS_ERR(tu)) { in create_local_trace_uprobe()
1651 (int)PTR_ERR(tu)); in create_local_trace_uprobe()
1653 return ERR_CAST(tu); in create_local_trace_uprobe()
1656 tu->offset = offs; in create_local_trace_uprobe()
1657 tu->path = path; in create_local_trace_uprobe()
1658 tu->ref_ctr_offset = ref_ctr_offset; in create_local_trace_uprobe()
1659 tu->filename = kstrdup(name, GFP_KERNEL); in create_local_trace_uprobe()
1660 if (!tu->filename) { in create_local_trace_uprobe()
1665 init_trace_event_call(tu); in create_local_trace_uprobe()
1667 ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; in create_local_trace_uprobe()
1668 if (traceprobe_set_print_fmt(&tu->tp, ptype) < 0) { in create_local_trace_uprobe()
1673 return trace_probe_event_call(&tu->tp); in create_local_trace_uprobe()
1675 free_trace_uprobe(tu); in create_local_trace_uprobe()
1681 struct trace_uprobe *tu; in destroy_local_trace_uprobe() local
1683 tu = trace_uprobe_primary_from_call(event_call); in destroy_local_trace_uprobe()
1685 free_trace_uprobe(tu); in destroy_local_trace_uprobe()