Lines Matching refs:user
206 typedef void (*user_event_func_t) (struct user_event *user, struct iov_iter *i,
214 static struct user_event_mm *user_event_mm_get_all(struct user_event *user);
216 static int destroy_user_event(struct user_event *user);
223 static struct user_event *user_event_get(struct user_event *user) in user_event_get() argument
225 refcount_inc(&user->refcnt); in user_event_get()
227 return user; in user_event_get()
232 struct user_event *user = container_of( in delayed_destroy_user_event() local
237 if (!refcount_dec_and_test(&user->refcnt)) in delayed_destroy_user_event()
240 if (destroy_user_event(user)) { in delayed_destroy_user_event()
248 refcount_set(&user->refcnt, 1); in delayed_destroy_user_event()
254 static void user_event_put(struct user_event *user, bool locked) in user_event_put() argument
258 if (unlikely(!user)) in user_event_put()
274 delete = refcount_dec_and_mutex_lock(&user->refcnt, &event_mutex); in user_event_put()
277 delete = refcount_dec_and_test(&user->refcnt); in user_event_put()
290 if (user->reg_flags & USER_EVENT_REG_PERSIST) { in user_event_put()
301 INIT_WORK(&user->put_work, delayed_destroy_user_event); in user_event_put()
314 refcount_set(&user->refcnt, 1); in user_event_put()
316 if (WARN_ON_ONCE(!schedule_work(&user->put_work))) { in user_event_put()
437 struct user_event *user = enabler->event; in user_event_enabler_fault_fixup() local
440 mm->mm, (unsigned long long)uaddr, EVENT_NAME(user)); in user_event_enabler_fault_fixup()
573 static void user_event_enabler_update(struct user_event *user) in user_event_enabler_update() argument
593 mm = user_event_mm_get_all(user); in user_event_enabler_update()
600 if (enabler->event == user) { in user_event_enabler_update()
645 static struct user_event_mm *user_event_mm_get_all(struct user_event *user) in user_event_mm_get_all() argument
673 if (enabler->event == user) { in user_event_mm_get_all()
863 *user_event_enabler_create(struct user_reg *reg, struct user_event *user, in user_event_enabler_create() argument
881 enabler->event = user; in user_event_enabler_create()
909 user_event_get(user); in user_event_enabler_create()
930 bool user_event_last_ref(struct user_event *user) in user_event_last_ref() argument
934 if (user->reg_flags & USER_EVENT_REG_PERSIST) in user_event_last_ref()
937 return refcount_read(&user->refcnt) == last; in user_event_last_ref()
956 struct user_event *user = (struct user_event *)call->data; in user_event_get_fields() local
958 return &user->fields; in user_event_get_fields()
1067 static void user_event_destroy_validators(struct user_event *user) in user_event_destroy_validators() argument
1070 struct list_head *head = &user->validators; in user_event_destroy_validators()
1078 static void user_event_destroy_fields(struct user_event *user) in user_event_destroy_fields() argument
1081 struct list_head *head = &user->fields; in user_event_destroy_fields()
1089 static int user_event_add_field(struct user_event *user, const char *type, in user_event_add_field() argument
1127 list_add_tail(&validator->user_event_link, &user->validators); in user_event_add_field()
1140 list_add(&field->link, &user->fields); in user_event_add_field()
1146 user->min_size = (offset + size) - sizeof(struct trace_entry); in user_event_add_field()
1155 static int user_event_parse_field(char *field, struct user_event *user, in user_event_parse_field() argument
1242 return user_event_add_field(user, type, name, saved_offset, size, in user_event_parse_field()
1246 static int user_event_parse_fields(struct user_event *user, char *args) in user_event_parse_fields() argument
1256 ret = user_event_parse_field(field, user, &offset); in user_event_parse_fields()
1367 static int user_event_set_print_fmt(struct user_event *user, char *buf, int len) in user_event_set_print_fmt() argument
1370 struct list_head *head = &user->fields; in user_event_set_print_fmt()
1401 static int user_event_create_print_fmt(struct user_event *user) in user_event_create_print_fmt() argument
1406 len = user_event_set_print_fmt(user, NULL, 0); in user_event_create_print_fmt()
1413 user_event_set_print_fmt(user, print_fmt, len); in user_event_create_print_fmt()
1415 user->call.print_fmt = print_fmt; in user_event_create_print_fmt()
1431 static int user_event_set_call_visible(struct user_event *user, bool visible) in user_event_set_call_visible() argument
1456 ret = trace_add_event_call(&user->call); in user_event_set_call_visible()
1458 ret = trace_remove_event_call(&user->call); in user_event_set_call_visible()
1466 static int destroy_user_event(struct user_event *user) in destroy_user_event() argument
1473 user_event_destroy_fields(user); in destroy_user_event()
1475 ret = user_event_set_call_visible(user, false); in destroy_user_event()
1480 dyn_event_remove(&user->devent); in destroy_user_event()
1481 hash_del(&user->node); in destroy_user_event()
1483 user_event_destroy_validators(user); in destroy_user_event()
1484 kfree(user->call.print_fmt); in destroy_user_event()
1485 kfree(EVENT_NAME(user)); in destroy_user_event()
1486 kfree(user); in destroy_user_event()
1499 struct user_event *user; in find_user_event() local
1504 hash_for_each_possible(group->register_table, user, node, key) in find_user_event()
1505 if (!strcmp(EVENT_NAME(user), name)) in find_user_event()
1506 return user_event_get(user); in find_user_event()
1511 static int user_event_validate(struct user_event *user, void *data, int len) in user_event_validate() argument
1513 struct list_head *head = &user->validators; in user_event_validate()
1547 static void user_event_ftrace(struct user_event *user, struct iov_iter *i, in user_event_ftrace() argument
1571 if (!list_empty(&user->validators) && in user_event_ftrace()
1572 unlikely(user_event_validate(user, entry, size))) in user_event_ftrace()
1588 static void user_event_perf(struct user_event *user, struct iov_iter *i, in user_event_perf() argument
1593 perf_head = this_cpu_ptr(user->call.perf_events); in user_event_perf()
1612 if (!list_empty(&user->validators) && in user_event_perf()
1613 unlikely(user_event_validate(user, perf_entry, size))) in user_event_perf()
1617 user->call.event.type, 1, regs, in user_event_perf()
1631 static void update_enable_bit_for(struct user_event *user) in update_enable_bit_for() argument
1633 struct tracepoint *tp = &user->tracepoint; in update_enable_bit_for()
1662 user->status = status; in update_enable_bit_for()
1664 user_event_enabler_update(user); in update_enable_bit_for()
1674 struct user_event *user = (struct user_event *)call->data; in user_event_reg() local
1677 if (!user) in user_event_reg()
1720 user_event_get(user); in user_event_reg()
1721 update_enable_bit_for(user); in user_event_reg()
1724 update_enable_bit_for(user); in user_event_reg()
1725 user_event_put(user, true); in user_event_reg()
1732 struct user_event *user; in user_event_create() local
1757 ret = user_event_parse_cmd(group, name, &user, USER_EVENT_REG_PERSIST); in user_event_create()
1760 user_event_put(user, false); in user_event_create()
1772 struct user_event *user = container_of(ev, struct user_event, devent); in user_event_show() local
1777 seq_printf(m, "%s%s", USER_EVENTS_PREFIX, EVENT_NAME(user)); in user_event_show()
1779 head = trace_get_fields(&user->call); in user_event_show()
1802 struct user_event *user = container_of(ev, struct user_event, devent); in user_event_is_busy() local
1804 return !user_event_last_ref(user); in user_event_is_busy()
1809 struct user_event *user = container_of(ev, struct user_event, devent); in user_event_free() local
1811 if (!user_event_last_ref(user)) in user_event_free()
1814 return destroy_user_event(user); in user_event_free()
1854 static bool user_fields_match(struct user_event *user, int argc, in user_fields_match() argument
1858 struct list_head *head = &user->fields; in user_fields_match()
1875 struct user_event *user = container_of(ev, struct user_event, devent); in user_event_match() local
1878 match = strcmp(EVENT_NAME(user), event) == 0 && in user_event_match()
1882 match = user_fields_match(user, argc, argv); in user_event_match()
1884 match = list_empty(&user->fields); in user_event_match()
1897 static int user_event_trace_register(struct user_event *user) in user_event_trace_register() argument
1901 ret = register_trace_event(&user->call.event); in user_event_trace_register()
1906 ret = user_event_set_call_visible(user, true); in user_event_trace_register()
1909 unregister_trace_event(&user->call.event); in user_event_trace_register()
1925 struct user_event *user; in user_event_parse() local
1935 user = find_user_event(group, name, &key); in user_event_parse()
1938 if (user) { in user_event_parse()
1946 ret = user_fields_match(user, argc, (const char **)argv); in user_event_parse()
1950 ret = list_empty(&user->fields); in user_event_parse()
1953 *newuser = user; in user_event_parse()
1966 user_event_put(user, false); in user_event_parse()
1970 user = kzalloc(sizeof(*user), GFP_KERNEL_ACCOUNT); in user_event_parse()
1972 if (!user) in user_event_parse()
1975 INIT_LIST_HEAD(&user->class.fields); in user_event_parse()
1976 INIT_LIST_HEAD(&user->fields); in user_event_parse()
1977 INIT_LIST_HEAD(&user->validators); in user_event_parse()
1979 user->group = group; in user_event_parse()
1980 user->tracepoint.name = name; in user_event_parse()
1982 ret = user_event_parse_fields(user, args); in user_event_parse()
1987 ret = user_event_create_print_fmt(user); in user_event_parse()
1992 user->call.data = user; in user_event_parse()
1993 user->call.class = &user->class; in user_event_parse()
1994 user->call.name = name; in user_event_parse()
1995 user->call.flags = TRACE_EVENT_FL_TRACEPOINT; in user_event_parse()
1996 user->call.tp = &user->tracepoint; in user_event_parse()
1997 user->call.event.funcs = &user_event_funcs; in user_event_parse()
1998 user->class.system = group->system_name; in user_event_parse()
2000 user->class.fields_array = user_event_fields_array; in user_event_parse()
2001 user->class.get_fields = user_event_get_fields; in user_event_parse()
2002 user->class.reg = user_event_reg; in user_event_parse()
2003 user->class.probe = user_event_ftrace; in user_event_parse()
2005 user->class.perf_probe = user_event_perf; in user_event_parse()
2015 ret = user_event_trace_register(user); in user_event_parse()
2020 user->reg_flags = reg_flags; in user_event_parse()
2022 if (user->reg_flags & USER_EVENT_REG_PERSIST) { in user_event_parse()
2024 refcount_set(&user->refcnt, 2); in user_event_parse()
2027 refcount_set(&user->refcnt, 1); in user_event_parse()
2030 dyn_event_init(&user->devent, &user_event_dops); in user_event_parse()
2031 dyn_event_add(&user->devent, &user->call); in user_event_parse()
2032 hash_add(group->register_table, &user->node, key); in user_event_parse()
2037 *newuser = user; in user_event_parse()
2042 user_event_destroy_fields(user); in user_event_parse()
2043 user_event_destroy_validators(user); in user_event_parse()
2044 kfree(user->call.print_fmt); in user_event_parse()
2045 kfree(user); in user_event_parse()
2055 struct user_event *user = find_user_event(group, name, &key); in delete_user_event() local
2057 if (!user) in delete_user_event()
2060 user_event_put(user, true); in delete_user_event()
2062 if (!user_event_last_ref(user)) in delete_user_event()
2065 return destroy_user_event(user); in delete_user_event()
2075 struct user_event *user = NULL; in user_events_write_core() local
2096 user = refs->events[idx]; in user_events_write_core()
2100 if (unlikely(user == NULL)) in user_events_write_core()
2103 if (unlikely(i->count < user->min_size)) in user_events_write_core()
2106 tp = &user->tracepoint; in user_events_write_core()
2133 probe_func(user, ©, tpdata, &faulted); in user_events_write_core()
2191 struct user_event *user) in user_events_ref_add() argument
2204 if (refs->events[i] == user) in user_events_ref_add()
2220 new_refs->events[i] = user_event_get(user); in user_events_ref_add()
2295 struct user_event *user; in user_events_ioctl_reg() local
2324 ret = user_event_parse_cmd(info->group, name, &user, reg.flags); in user_events_ioctl_reg()
2331 ret = user_events_ref_add(info, user); in user_events_ioctl_reg()
2334 user_event_put(user, false); in user_events_ioctl_reg()
2352 enabler = user_event_enabler_create(®, user, &write_result); in user_events_ioctl_reg()
2613 struct user_event *user; in user_seq_show() local
2622 hash_for_each(group->register_table, i, user, node) { in user_seq_show()
2623 status = user->status; in user_seq_show()
2625 seq_printf(m, "%s", EVENT_NAME(user)); in user_seq_show()