Lines Matching refs:tu
89 static int register_uprobe_event(struct trace_uprobe *tu);
90 static int unregister_uprobe_event(struct trace_uprobe *tu);
209 base_addr = udd->bp_addr - udd->tu->offset; in translate_user_vaddr()
265 static inline bool is_ret_probe(struct trace_uprobe *tu) in is_ret_probe() argument
267 return tu->consumer.ret_handler != NULL; in is_ret_probe()
272 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_is_busy() local
274 return trace_probe_is_enabled(&tu->tp); in trace_uprobe_is_busy()
277 static bool trace_uprobe_match_command_head(struct trace_uprobe *tu, in trace_uprobe_match_command_head() argument
286 len = strlen(tu->filename); in trace_uprobe_match_command_head()
287 if (strncmp(tu->filename, argv[0], len) || argv[0][len] != ':') in trace_uprobe_match_command_head()
290 if (tu->ref_ctr_offset == 0) in trace_uprobe_match_command_head()
292 (int)(sizeof(void *) * 2), tu->offset); in trace_uprobe_match_command_head()
295 (int)(sizeof(void *) * 2), tu->offset, in trace_uprobe_match_command_head()
296 tu->ref_ctr_offset); in trace_uprobe_match_command_head()
302 return trace_probe_match_command_args(&tu->tp, argc, argv); in trace_uprobe_match_command_head()
308 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_match() local
311 strcmp(trace_probe_name(&tu->tp), event) == 0) && in trace_uprobe_match()
312 (!system || strcmp(trace_probe_group_name(&tu->tp), system) == 0) && in trace_uprobe_match()
313 trace_uprobe_match_command_head(tu, argc, argv); in trace_uprobe_match()
334 struct trace_uprobe *tu; in alloc_trace_uprobe() local
337 tu = kzalloc(struct_size(tu, tp.args, nargs), GFP_KERNEL); in alloc_trace_uprobe()
338 if (!tu) in alloc_trace_uprobe()
341 tu->nhits = alloc_percpu(unsigned long); in alloc_trace_uprobe()
342 if (!tu->nhits) { in alloc_trace_uprobe()
347 ret = trace_probe_init(&tu->tp, event, group, true, nargs); in alloc_trace_uprobe()
351 dyn_event_init(&tu->devent, &trace_uprobe_ops); in alloc_trace_uprobe()
352 tu->consumer.handler = uprobe_dispatcher; in alloc_trace_uprobe()
354 tu->consumer.ret_handler = uretprobe_dispatcher; in alloc_trace_uprobe()
355 init_trace_uprobe_filter(tu->tp.event->filter); in alloc_trace_uprobe()
356 return tu; in alloc_trace_uprobe()
359 free_percpu(tu->nhits); in alloc_trace_uprobe()
360 kfree(tu); in alloc_trace_uprobe()
365 static void free_trace_uprobe(struct trace_uprobe *tu) in free_trace_uprobe() argument
367 if (!tu) in free_trace_uprobe()
370 path_put(&tu->path); in free_trace_uprobe()
371 trace_probe_cleanup(&tu->tp); in free_trace_uprobe()
372 kfree(tu->filename); in free_trace_uprobe()
373 free_percpu(tu->nhits); in free_trace_uprobe()
374 kfree(tu); in free_trace_uprobe()
380 struct trace_uprobe *tu; in find_probe_event() local
382 for_each_trace_uprobe(tu, pos) in find_probe_event()
383 if (strcmp(trace_probe_name(&tu->tp), event) == 0 && in find_probe_event()
384 strcmp(trace_probe_group_name(&tu->tp), group) == 0) in find_probe_event()
385 return tu; in find_probe_event()
391 static int unregister_trace_uprobe(struct trace_uprobe *tu) in unregister_trace_uprobe() argument
395 if (trace_probe_has_sibling(&tu->tp)) in unregister_trace_uprobe()
399 if (trace_event_dyn_busy(trace_probe_event_call(&tu->tp))) in unregister_trace_uprobe()
402 ret = unregister_uprobe_event(tu); in unregister_trace_uprobe()
407 dyn_event_remove(&tu->devent); in unregister_trace_uprobe()
408 trace_probe_unlink(&tu->tp); in unregister_trace_uprobe()
409 free_trace_uprobe(tu); in unregister_trace_uprobe()
442 static int append_trace_uprobe(struct trace_uprobe *tu, struct trace_uprobe *to) in append_trace_uprobe() argument
446 ret = trace_probe_compare_arg_type(&tu->tp, &to->tp); in append_trace_uprobe()
453 if (trace_uprobe_has_same_uprobe(to, tu)) { in append_trace_uprobe()
460 ret = trace_probe_append(&tu->tp, &to->tp); in append_trace_uprobe()
462 dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp)); in append_trace_uprobe()
494 static int register_trace_uprobe(struct trace_uprobe *tu) in register_trace_uprobe() argument
501 ret = validate_ref_ctr_offset(tu); in register_trace_uprobe()
506 old_tu = find_probe_event(trace_probe_name(&tu->tp), in register_trace_uprobe()
507 trace_probe_group_name(&tu->tp)); in register_trace_uprobe()
509 if (is_ret_probe(tu) != is_ret_probe(old_tu)) { in register_trace_uprobe()
514 ret = append_trace_uprobe(tu, old_tu); in register_trace_uprobe()
519 ret = register_uprobe_event(tu); in register_trace_uprobe()
529 dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp)); in register_trace_uprobe()
543 struct trace_uprobe *tu; in __trace_uprobe_create() local
682 tu = alloc_trace_uprobe(group, event, argc, is_return); in __trace_uprobe_create()
683 if (IS_ERR(tu)) { in __trace_uprobe_create()
684 ret = PTR_ERR(tu); in __trace_uprobe_create()
689 tu->offset = offset; in __trace_uprobe_create()
690 tu->ref_ctr_offset = ref_ctr_offset; in __trace_uprobe_create()
691 tu->path = path; in __trace_uprobe_create()
692 tu->filename = filename; in __trace_uprobe_create()
701 ret = traceprobe_parse_probe_arg(&tu->tp, i, argv[i], &ctx); in __trace_uprobe_create()
707 ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; in __trace_uprobe_create()
708 ret = traceprobe_set_print_fmt(&tu->tp, ptype); in __trace_uprobe_create()
712 ret = register_trace_uprobe(tu); in __trace_uprobe_create()
717 free_trace_uprobe(tu); in __trace_uprobe_create()
748 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_release() local
750 return unregister_trace_uprobe(tu); in trace_uprobe_release()
756 struct trace_uprobe *tu = to_trace_uprobe(ev); in trace_uprobe_show() local
757 char c = is_ret_probe(tu) ? 'r' : 'p'; in trace_uprobe_show()
760 seq_printf(m, "%c:%s/%s %s:0x%0*lx", c, trace_probe_group_name(&tu->tp), in trace_uprobe_show()
761 trace_probe_name(&tu->tp), tu->filename, in trace_uprobe_show()
762 (int)(sizeof(void *) * 2), tu->offset); in trace_uprobe_show()
764 if (tu->ref_ctr_offset) in trace_uprobe_show()
765 seq_printf(m, "(0x%lx)", tu->ref_ctr_offset); in trace_uprobe_show()
767 for (i = 0; i < tu->tp.nr_args; i++) in trace_uprobe_show()
768 seq_printf(m, " %s=%s", tu->tp.args[i].name, tu->tp.args[i].comm); in trace_uprobe_show()
828 struct trace_uprobe *tu; in probes_profile_seq_show() local
835 tu = to_trace_uprobe(ev); in probes_profile_seq_show()
839 nhits += per_cpu(*tu->nhits, cpu); in probes_profile_seq_show()
842 seq_printf(m, " %s %-44s %15lu\n", tu->filename, in probes_profile_seq_show()
843 trace_probe_name(&tu->tp), nhits); in probes_profile_seq_show()
969 static struct uprobe_cpu_buffer *prepare_uprobe_buffer(struct trace_uprobe *tu, in prepare_uprobe_buffer() argument
979 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in prepare_uprobe_buffer()
980 dsize = __get_data_size(&tu->tp, regs, NULL); in prepare_uprobe_buffer()
983 ucb->dsize = tu->tp.size + dsize; in prepare_uprobe_buffer()
987 dsize = MAX_UCB_BUFFER_SIZE - tu->tp.size; in prepare_uprobe_buffer()
990 store_trace_args(ucb->buf, &tu->tp, regs, NULL, esize, dsize); in prepare_uprobe_buffer()
996 static void __uprobe_trace_func(struct trace_uprobe *tu, in __uprobe_trace_func() argument
1005 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_trace_func()
1012 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_trace_func()
1018 if (is_ret_probe(tu)) { in __uprobe_trace_func()
1033 static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_trace_func() argument
1039 if (is_ret_probe(tu)) in uprobe_trace_func()
1042 ucb = prepare_uprobe_buffer(tu, regs, ucbp); in uprobe_trace_func()
1045 trace_probe_for_each_link_rcu(link, &tu->tp) in uprobe_trace_func()
1046 __uprobe_trace_func(tu, 0, regs, ucb, link->file); in uprobe_trace_func()
1052 static void uretprobe_trace_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_trace_func() argument
1059 ucb = prepare_uprobe_buffer(tu, regs, ucbp); in uretprobe_trace_func()
1062 trace_probe_for_each_link_rcu(link, &tu->tp) in uretprobe_trace_func()
1063 __uprobe_trace_func(tu, func, regs, ucb, link->file); in uretprobe_trace_func()
1073 struct trace_uprobe *tu; in print_uprobe_event() local
1077 tu = trace_uprobe_primary_from_call( in print_uprobe_event()
1079 if (unlikely(!tu)) in print_uprobe_event()
1082 if (is_ret_probe(tu)) { in print_uprobe_event()
1084 trace_probe_name(&tu->tp), in print_uprobe_event()
1089 trace_probe_name(&tu->tp), in print_uprobe_event()
1094 if (trace_probe_print_args(s, tu->tp.args, tu->tp.nr_args, data, entry) < 0) in print_uprobe_event()
1105 static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter) in trace_uprobe_enable() argument
1107 struct inode *inode = d_real_inode(tu->path.dentry); in trace_uprobe_enable()
1110 tu->consumer.filter = filter; in trace_uprobe_enable()
1111 uprobe = uprobe_register(inode, tu->offset, tu->ref_ctr_offset, &tu->consumer); in trace_uprobe_enable()
1115 tu->uprobe = uprobe; in trace_uprobe_enable()
1121 struct trace_uprobe *tu; in __probe_event_disable() local
1124 tu = container_of(tp, struct trace_uprobe, tp); in __probe_event_disable()
1125 WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); in __probe_event_disable()
1127 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in __probe_event_disable()
1128 if (!tu->uprobe) in __probe_event_disable()
1131 uprobe_unregister_nosync(tu->uprobe, &tu->consumer); in __probe_event_disable()
1133 tu->uprobe = NULL; in __probe_event_disable()
1143 struct trace_uprobe *tu; in probe_event_enable() local
1167 tu = container_of(tp, struct trace_uprobe, tp); in probe_event_enable()
1168 WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); in probe_event_enable()
1177 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in probe_event_enable()
1178 ret = trace_uprobe_enable(tu, filter); in probe_event_enable()
1228 struct trace_uprobe *tu; in uprobe_event_define_fields() local
1230 tu = trace_uprobe_primary_from_call(event_call); in uprobe_event_define_fields()
1231 if (unlikely(!tu)) in uprobe_event_define_fields()
1234 if (is_ret_probe(tu)) { in uprobe_event_define_fields()
1243 return traceprobe_define_arg_fields(event_call, size, &tu->tp); in uprobe_event_define_fields()
1320 struct trace_uprobe *tu; in uprobe_perf_close() local
1327 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_close()
1328 if (trace_uprobe_filter_remove(tu->tp.event->filter, event)) in uprobe_perf_close()
1331 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in uprobe_perf_close()
1332 ret = uprobe_apply(tu->uprobe, &tu->consumer, false); in uprobe_perf_close()
1344 struct trace_uprobe *tu; in uprobe_perf_open() local
1351 tu = container_of(tp, struct trace_uprobe, tp); in uprobe_perf_open()
1352 if (trace_uprobe_filter_add(tu->tp.event->filter, event)) in uprobe_perf_open()
1355 list_for_each_entry(tu, trace_probe_probe_list(tp), tp.list) { in uprobe_perf_open()
1356 err = uprobe_apply(tu->uprobe, &tu->consumer, true); in uprobe_perf_open()
1369 struct trace_uprobe *tu; in uprobe_perf_filter() local
1372 tu = container_of(uc, struct trace_uprobe, consumer); in uprobe_perf_filter()
1373 filter = tu->tp.event->filter; in uprobe_perf_filter()
1389 static void __uprobe_perf_func(struct trace_uprobe *tu, in __uprobe_perf_func() argument
1393 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in __uprobe_perf_func()
1411 esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); in __uprobe_perf_func()
1413 ucb = prepare_uprobe_buffer(tu, regs, ucbp); in __uprobe_perf_func()
1428 if (is_ret_probe(tu)) { in __uprobe_perf_func()
1449 static int uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs, in uprobe_perf_func() argument
1452 if (!uprobe_perf_filter(&tu->consumer, current->mm)) in uprobe_perf_func()
1455 if (!is_ret_probe(tu)) in uprobe_perf_func()
1456 __uprobe_perf_func(tu, 0, regs, ucbp); in uprobe_perf_func()
1460 static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func, in uretprobe_perf_func() argument
1464 __uprobe_perf_func(tu, func, regs, ucbp); in uretprobe_perf_func()
1473 struct trace_uprobe *tu; in bpf_get_uprobe_info() local
1476 tu = find_probe_event(pevent, group); in bpf_get_uprobe_info()
1478 tu = trace_uprobe_primary_from_call(event->tp_event); in bpf_get_uprobe_info()
1479 if (!tu) in bpf_get_uprobe_info()
1482 *fd_type = is_ret_probe(tu) ? BPF_FD_TYPE_URETPROBE in bpf_get_uprobe_info()
1484 *filename = tu->filename; in bpf_get_uprobe_info()
1485 *probe_offset = tu->offset; in bpf_get_uprobe_info()
1527 struct trace_uprobe *tu; in uprobe_dispatcher() local
1532 tu = container_of(con, struct trace_uprobe, consumer); in uprobe_dispatcher()
1534 this_cpu_inc(*tu->nhits); in uprobe_dispatcher()
1536 udd.tu = tu; in uprobe_dispatcher()
1544 if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) in uprobe_dispatcher()
1545 ret |= uprobe_trace_func(tu, regs, &ucb); in uprobe_dispatcher()
1548 if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) in uprobe_dispatcher()
1549 ret |= uprobe_perf_func(tu, regs, &ucb); in uprobe_dispatcher()
1558 struct trace_uprobe *tu; in uretprobe_dispatcher() local
1562 tu = container_of(con, struct trace_uprobe, consumer); in uretprobe_dispatcher()
1564 udd.tu = tu; in uretprobe_dispatcher()
1572 if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) in uretprobe_dispatcher()
1573 uretprobe_trace_func(tu, func, regs, &ucb); in uretprobe_dispatcher()
1576 if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) in uretprobe_dispatcher()
1577 uretprobe_perf_func(tu, func, regs, &ucb); in uretprobe_dispatcher()
1593 static inline void init_trace_event_call(struct trace_uprobe *tu) in init_trace_event_call() argument
1595 struct trace_event_call *call = trace_probe_event_call(&tu->tp); in init_trace_event_call()
1603 static int register_uprobe_event(struct trace_uprobe *tu) in register_uprobe_event() argument
1605 init_trace_event_call(tu); in register_uprobe_event()
1607 return trace_probe_register_event_call(&tu->tp); in register_uprobe_event()
1610 static int unregister_uprobe_event(struct trace_uprobe *tu) in unregister_uprobe_event() argument
1612 return trace_probe_unregister_event_call(&tu->tp); in unregister_uprobe_event()
1621 struct trace_uprobe *tu; in create_local_trace_uprobe() local
1639 tu = alloc_trace_uprobe(UPROBE_EVENT_SYSTEM, "DUMMY_EVENT", 0, in create_local_trace_uprobe()
1642 if (IS_ERR(tu)) { in create_local_trace_uprobe()
1644 (int)PTR_ERR(tu)); in create_local_trace_uprobe()
1646 return ERR_CAST(tu); in create_local_trace_uprobe()
1649 tu->offset = offs; in create_local_trace_uprobe()
1650 tu->path = path; in create_local_trace_uprobe()
1651 tu->ref_ctr_offset = ref_ctr_offset; in create_local_trace_uprobe()
1652 tu->filename = kstrdup(name, GFP_KERNEL); in create_local_trace_uprobe()
1653 if (!tu->filename) { in create_local_trace_uprobe()
1658 init_trace_event_call(tu); in create_local_trace_uprobe()
1660 ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; in create_local_trace_uprobe()
1661 if (traceprobe_set_print_fmt(&tu->tp, ptype) < 0) { in create_local_trace_uprobe()
1666 return trace_probe_event_call(&tu->tp); in create_local_trace_uprobe()
1668 free_trace_uprobe(tu); in create_local_trace_uprobe()
1674 struct trace_uprobe *tu; in destroy_local_trace_uprobe() local
1676 tu = trace_uprobe_primary_from_call(event_call); in destroy_local_trace_uprobe()
1678 free_trace_uprobe(tu); in destroy_local_trace_uprobe()