1 // SPDX-License-Identifier: GPL-2.0
3 * Common code for probe-based Dynamic events.
5 * This code was copied from kernel/trace/trace_kprobe.c written by
6 * Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
8 * Updates to make this generic:
9 * Copyright (C) IBM Corporation, 2010-2011
10 * Author: Srikar Dronamraju
12 #define pr_fmt(fmt) "trace_probe: " fmt
14 #include "trace_probe.h"
19 static const char *trace_probe_err_text[] = { ERRORS };
21 static const char *reserved_field_names[] = {
24 "common_preempt_count",
32 /* Printing in basic type function template */
33 #define DEFINE_BASIC_PRINT_TYPE_FUNC(tname, type, fmt) \
34 int PRINT_TYPE_FUNC_NAME(tname)(struct trace_seq *s, void *data, void *ent)\
36 trace_seq_printf(s, fmt, *(type *)data); \
37 return !trace_seq_has_overflowed(s); \
39 const char PRINT_TYPE_FMT_NAME(tname)[] = fmt;
41 DEFINE_BASIC_PRINT_TYPE_FUNC(u8, u8, "%u")
42 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, u16, "%u")
43 DEFINE_BASIC_PRINT_TYPE_FUNC(u32, u32, "%u")
44 DEFINE_BASIC_PRINT_TYPE_FUNC(u64, u64, "%Lu")
45 DEFINE_BASIC_PRINT_TYPE_FUNC(s8, s8, "%d")
46 DEFINE_BASIC_PRINT_TYPE_FUNC(s16, s16, "%d")
47 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, s32, "%d")
48 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, s64, "%Ld")
49 DEFINE_BASIC_PRINT_TYPE_FUNC(x8, u8, "0x%x")
50 DEFINE_BASIC_PRINT_TYPE_FUNC(x16, u16, "0x%x")
51 DEFINE_BASIC_PRINT_TYPE_FUNC(x32, u32, "0x%x")
52 DEFINE_BASIC_PRINT_TYPE_FUNC(x64, u64, "0x%Lx")
54 int PRINT_TYPE_FUNC_NAME(symbol)(struct trace_seq *s, void *data, void *ent)
56 trace_seq_printf(s, "%pS", (void *)*(unsigned long *)data);
57 return !trace_seq_has_overflowed(s);
59 const char PRINT_TYPE_FMT_NAME(symbol)[] = "%pS";
61 /* Print type function for string type */
62 int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s, void *data, void *ent)
64 int len = *(u32 *)data >> 16;
67 trace_seq_puts(s, "(fault)");
69 trace_seq_printf(s, "\"%s\"",
70 (const char *)get_loc_data(data, ent));
71 return !trace_seq_has_overflowed(s);
74 const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
76 /* Fetch type information table */
77 static const struct fetch_type probe_fetch_types[] = {
79 __ASSIGN_FETCH_TYPE("string", string, string, sizeof(u32), 1,
81 __ASSIGN_FETCH_TYPE("ustring", string, string, sizeof(u32), 1,
84 ASSIGN_FETCH_TYPE(u8, u8, 0),
85 ASSIGN_FETCH_TYPE(u16, u16, 0),
86 ASSIGN_FETCH_TYPE(u32, u32, 0),
87 ASSIGN_FETCH_TYPE(u64, u64, 0),
88 ASSIGN_FETCH_TYPE(s8, u8, 1),
89 ASSIGN_FETCH_TYPE(s16, u16, 1),
90 ASSIGN_FETCH_TYPE(s32, u32, 1),
91 ASSIGN_FETCH_TYPE(s64, u64, 1),
92 ASSIGN_FETCH_TYPE_ALIAS(x8, u8, u8, 0),
93 ASSIGN_FETCH_TYPE_ALIAS(x16, u16, u16, 0),
94 ASSIGN_FETCH_TYPE_ALIAS(x32, u32, u32, 0),
95 ASSIGN_FETCH_TYPE_ALIAS(x64, u64, u64, 0),
96 ASSIGN_FETCH_TYPE_ALIAS(symbol, ADDR_FETCH_TYPE, ADDR_FETCH_TYPE, 0),
101 static const struct fetch_type *find_fetch_type(const char *type)
106 type = DEFAULT_FETCH_TYPE_STR;
108 /* Special case: bitfield */
112 type = strchr(type, '/');
117 if (kstrtoul(type, 0, &bs))
122 return find_fetch_type("u8");
124 return find_fetch_type("u16");
126 return find_fetch_type("u32");
128 return find_fetch_type("u64");
134 for (i = 0; probe_fetch_types[i].name; i++) {
135 if (strcmp(type, probe_fetch_types[i].name) == 0)
136 return &probe_fetch_types[i];
143 static struct trace_probe_log trace_probe_log;
145 void trace_probe_log_init(const char *subsystem, int argc, const char **argv)
147 trace_probe_log.subsystem = subsystem;
148 trace_probe_log.argc = argc;
149 trace_probe_log.argv = argv;
150 trace_probe_log.index = 0;
153 void trace_probe_log_clear(void)
155 memset(&trace_probe_log, 0, sizeof(trace_probe_log));
158 void trace_probe_log_set_index(int index)
160 trace_probe_log.index = index;
163 void __trace_probe_log_err(int offset, int err_type)
166 int i, len = 0, pos = 0;
168 if (!trace_probe_log.argv)
171 /* Recalcurate the length and allocate buffer */
172 for (i = 0; i < trace_probe_log.argc; i++) {
173 if (i == trace_probe_log.index)
175 len += strlen(trace_probe_log.argv[i]) + 1;
177 command = kzalloc(len, GFP_KERNEL);
181 /* And make a command string from argv array */
183 for (i = 0; i < trace_probe_log.argc; i++) {
184 len = strlen(trace_probe_log.argv[i]);
185 strcpy(p, trace_probe_log.argv[i]);
191 tracing_log_err(NULL, trace_probe_log.subsystem, command,
192 trace_probe_err_text, err_type, pos + offset);
197 /* Split symbol and offset. */
198 int traceprobe_split_symbol_offset(char *symbol, long *offset)
206 tmp = strpbrk(symbol, "+-");
208 ret = kstrtol(tmp, 0, offset);
218 /* @buf must has MAX_EVENT_NAME_LEN size */
219 int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
220 char *buf, int offset)
222 const char *slash, *event = *pevent;
225 slash = strchr(event, '/');
227 if (slash == event) {
228 trace_probe_log_err(offset, NO_GROUP_NAME);
231 if (slash - event + 1 > MAX_EVENT_NAME_LEN) {
232 trace_probe_log_err(offset, GROUP_TOO_LONG);
235 strlcpy(buf, event, slash - event + 1);
236 if (!is_good_name(buf)) {
237 trace_probe_log_err(offset, BAD_GROUP_NAME);
242 offset += slash - event + 1;
247 trace_probe_log_err(offset, NO_EVENT_NAME);
249 } else if (len > MAX_EVENT_NAME_LEN) {
250 trace_probe_log_err(offset, EVENT_TOO_LONG);
253 if (!is_good_name(event)) {
254 trace_probe_log_err(offset, BAD_EVENT_NAME);
260 #define PARAM_MAX_STACK (THREAD_SIZE / sizeof(unsigned long))
262 static int parse_probe_vars(char *arg, const struct fetch_type *t,
263 struct fetch_insn *code, unsigned int flags, int offs)
269 if (strcmp(arg, "retval") == 0) {
270 if (flags & TPARG_FL_RETURN) {
271 code->op = FETCH_OP_RETVAL;
273 trace_probe_log_err(offs, RETVAL_ON_PROBE);
276 } else if ((len = str_has_prefix(arg, "stack"))) {
277 if (arg[len] == '\0') {
278 code->op = FETCH_OP_STACKP;
279 } else if (isdigit(arg[len])) {
280 ret = kstrtoul(arg + len, 10, ¶m);
283 } else if ((flags & TPARG_FL_KERNEL) &&
284 param > PARAM_MAX_STACK) {
285 trace_probe_log_err(offs, BAD_STACK_NUM);
288 code->op = FETCH_OP_STACK;
289 code->param = (unsigned int)param;
293 } else if (strcmp(arg, "comm") == 0) {
294 code->op = FETCH_OP_COMM;
295 #ifdef CONFIG_HAVE_FUNCTION_ARG_ACCESS_API
296 } else if (((flags & TPARG_FL_MASK) ==
297 (TPARG_FL_KERNEL | TPARG_FL_FENTRY)) &&
298 (len = str_has_prefix(arg, "arg"))) {
299 ret = kstrtoul(arg + len, 10, ¶m);
302 } else if (!param || param > PARAM_MAX_STACK) {
303 trace_probe_log_err(offs, BAD_ARG_NUM);
306 code->op = FETCH_OP_ARG;
307 code->param = (unsigned int)param - 1;
315 trace_probe_log_err(offs, BAD_VAR);
319 /* Recursive argument parser */
321 parse_probe_arg(char *arg, const struct fetch_type *type,
322 struct fetch_insn **pcode, struct fetch_insn *end,
323 unsigned int flags, int offs)
325 struct fetch_insn *code = *pcode;
327 int deref = FETCH_OP_DEREF;
334 ret = parse_probe_vars(arg + 1, type, code, flags, offs);
337 case '%': /* named register */
338 ret = regs_query_register_offset(arg + 1);
340 code->op = FETCH_OP_REG;
341 code->param = (unsigned int)ret;
344 trace_probe_log_err(offs, BAD_REG_NAME);
347 case '@': /* memory, file-offset or symbol */
348 if (isdigit(arg[1])) {
349 ret = kstrtoul(arg + 1, 0, ¶m);
351 trace_probe_log_err(offs, BAD_MEM_ADDR);
355 code->op = FETCH_OP_IMM;
356 code->immediate = param;
357 } else if (arg[1] == '+') {
358 /* kprobes don't support file offsets */
359 if (flags & TPARG_FL_KERNEL) {
360 trace_probe_log_err(offs, FILE_ON_KPROBE);
363 ret = kstrtol(arg + 2, 0, &offset);
365 trace_probe_log_err(offs, BAD_FILE_OFFS);
369 code->op = FETCH_OP_FOFFS;
370 code->immediate = (unsigned long)offset; // imm64?
372 /* uprobes don't support symbols */
373 if (!(flags & TPARG_FL_KERNEL)) {
374 trace_probe_log_err(offs, SYM_ON_UPROBE);
377 /* Preserve symbol for updating */
378 code->op = FETCH_NOP_SYMBOL;
379 code->data = kstrdup(arg + 1, GFP_KERNEL);
383 trace_probe_log_err(offs, TOO_MANY_OPS);
386 code->op = FETCH_OP_IMM;
389 /* These are fetching from memory */
391 trace_probe_log_err(offs, TOO_MANY_OPS);
395 code->op = FETCH_OP_DEREF;
396 code->offset = offset;
399 case '+': /* deref memory */
402 deref = FETCH_OP_UDEREF;
407 arg++; /* Skip '+', because kstrtol() rejects it. */
408 tmp = strchr(arg, '(');
410 trace_probe_log_err(offs, DEREF_NEED_BRACE);
414 ret = kstrtol(arg, 0, &offset);
416 trace_probe_log_err(offs, BAD_DEREF_OFFS);
419 offs += (tmp + 1 - arg) + (arg[0] != '-' ? 1 : 0);
421 tmp = strrchr(arg, ')');
423 trace_probe_log_err(offs + strlen(arg),
427 const struct fetch_type *t2 = find_fetch_type(NULL);
430 ret = parse_probe_arg(arg, t2, &code, end, flags, offs);
433 if (code->op == FETCH_OP_COMM) {
434 trace_probe_log_err(offs, COMM_CANT_DEREF);
438 trace_probe_log_err(offs, TOO_MANY_OPS);
444 code->offset = offset;
448 if (!ret && code->op == FETCH_OP_NOP) {
449 /* Parsed, but do not find fetch method */
450 trace_probe_log_err(offs, BAD_FETCH_ARG);
456 #define BYTES_TO_BITS(nb) ((BITS_PER_LONG * (nb)) / sizeof(long))
458 /* Bitfield type needs to be parsed into a fetch function */
459 static int __parse_bitfield_probe_arg(const char *bf,
460 const struct fetch_type *t,
461 struct fetch_insn **pcode)
463 struct fetch_insn *code = *pcode;
464 unsigned long bw, bo;
470 bw = simple_strtoul(bf + 1, &tail, 0); /* Use simple one */
472 if (bw == 0 || *tail != '@')
476 bo = simple_strtoul(bf, &tail, 0);
478 if (tail == bf || *tail != '/')
481 if (code->op != FETCH_OP_NOP)
485 code->op = FETCH_OP_MOD_BF;
486 code->lshift = BYTES_TO_BITS(t->size) - (bw + bo);
487 code->rshift = BYTES_TO_BITS(t->size) - bw;
488 code->basesize = t->size;
490 return (BYTES_TO_BITS(t->size) < (bw + bo)) ? -EINVAL : 0;
493 /* String length checking wrapper */
494 static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
495 struct probe_arg *parg, unsigned int flags, int offset)
497 struct fetch_insn *code, *scode, *tmp = NULL;
502 if (len > MAX_ARGSTR_LEN) {
503 trace_probe_log_err(offset, ARG_TOO_LONG);
505 } else if (len == 0) {
506 trace_probe_log_err(offset, NO_ARG_BODY);
510 parg->comm = kstrdup(arg, GFP_KERNEL);
514 t = strchr(arg, ':');
517 t2 = strchr(++t, '[');
520 t3 = strchr(t2, ']');
522 offset += t2 + strlen(t2) - arg;
523 trace_probe_log_err(offset,
526 } else if (t3[1] != '\0') {
527 trace_probe_log_err(offset + t3 + 1 - arg,
532 if (kstrtouint(t2, 0, &parg->count) || !parg->count) {
533 trace_probe_log_err(offset + t2 - arg,
537 if (parg->count > MAX_ARRAY_LEN) {
538 trace_probe_log_err(offset + t2 - arg,
545 /* Since $comm can not be dereferred, we can find $comm by strcmp */
546 if (strcmp(arg, "$comm") == 0) {
547 /* The type of $comm must be "string", and not an array. */
548 if (parg->count || (t && strcmp(t, "string")))
550 parg->type = find_fetch_type("string");
552 parg->type = find_fetch_type(t);
554 trace_probe_log_err(offset + (t ? (t - arg) : 0), BAD_TYPE);
557 parg->offset = *size;
558 *size += parg->type->size * (parg->count ?: 1);
561 len = strlen(parg->type->fmttype) + 6;
562 parg->fmt = kmalloc(len, GFP_KERNEL);
565 snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype,
569 code = tmp = kcalloc(FETCH_INSN_MAX, sizeof(*code), GFP_KERNEL);
572 code[FETCH_INSN_MAX - 1].op = FETCH_OP_END;
574 ret = parse_probe_arg(arg, parg->type, &code, &code[FETCH_INSN_MAX - 1],
579 /* Store operation */
580 if (!strcmp(parg->type->name, "string") ||
581 !strcmp(parg->type->name, "ustring")) {
582 if (code->op != FETCH_OP_DEREF && code->op != FETCH_OP_UDEREF &&
583 code->op != FETCH_OP_IMM && code->op != FETCH_OP_COMM) {
584 trace_probe_log_err(offset + (t ? (t - arg) : 0),
589 if ((code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM) ||
592 * IMM and COMM is pointing actual address, those must
593 * be kept, and if parg->count != 0, this is an array
594 * of string pointers instead of string address itself.
597 if (code->op != FETCH_OP_NOP) {
598 trace_probe_log_err(offset, TOO_MANY_OPS);
603 /* If op == DEREF, replace it with STRING */
604 if (!strcmp(parg->type->name, "ustring") ||
605 code->op == FETCH_OP_UDEREF)
606 code->op = FETCH_OP_ST_USTRING;
608 code->op = FETCH_OP_ST_STRING;
609 code->size = parg->type->size;
610 parg->dynamic = true;
611 } else if (code->op == FETCH_OP_DEREF) {
612 code->op = FETCH_OP_ST_MEM;
613 code->size = parg->type->size;
614 } else if (code->op == FETCH_OP_UDEREF) {
615 code->op = FETCH_OP_ST_UMEM;
616 code->size = parg->type->size;
619 if (code->op != FETCH_OP_NOP) {
620 trace_probe_log_err(offset, TOO_MANY_OPS);
624 code->op = FETCH_OP_ST_RAW;
625 code->size = parg->type->size;
628 /* Modify operation */
630 ret = __parse_bitfield_probe_arg(t, parg->type, &code);
632 trace_probe_log_err(offset + t - arg, BAD_BITFIELD);
636 /* Loop(Array) operation */
638 if (scode->op != FETCH_OP_ST_MEM &&
639 scode->op != FETCH_OP_ST_STRING &&
640 scode->op != FETCH_OP_ST_USTRING) {
641 trace_probe_log_err(offset + (t ? (t - arg) : 0),
647 if (code->op != FETCH_OP_NOP) {
648 trace_probe_log_err(offset, TOO_MANY_OPS);
652 code->op = FETCH_OP_LP_ARRAY;
653 code->param = parg->count;
656 code->op = FETCH_OP_END;
658 /* Shrink down the code buffer */
659 parg->code = kcalloc(code - tmp + 1, sizeof(*code), GFP_KERNEL);
663 memcpy(parg->code, tmp, sizeof(*code) * (code - tmp + 1));
667 for (code = tmp; code < tmp + FETCH_INSN_MAX; code++)
668 if (code->op == FETCH_NOP_SYMBOL)
676 /* Return 1 if name is reserved or already used by another argument */
677 static int traceprobe_conflict_field_name(const char *name,
678 struct probe_arg *args, int narg)
682 for (i = 0; i < ARRAY_SIZE(reserved_field_names); i++)
683 if (strcmp(reserved_field_names[i], name) == 0)
686 for (i = 0; i < narg; i++)
687 if (strcmp(args[i].name, name) == 0)
693 int traceprobe_parse_probe_arg(struct trace_probe *tp, int i, char *arg,
696 struct probe_arg *parg = &tp->args[i];
699 /* Increment count for freeing args in error case */
702 body = strchr(arg, '=');
704 if (body - arg > MAX_ARG_NAME_LEN) {
705 trace_probe_log_err(0, ARG_NAME_TOO_LONG);
707 } else if (body == arg) {
708 trace_probe_log_err(0, NO_ARG_NAME);
711 parg->name = kmemdup_nul(arg, body - arg, GFP_KERNEL);
714 /* If argument name is omitted, set "argN" */
715 parg->name = kasprintf(GFP_KERNEL, "arg%d", i + 1);
721 if (!is_good_name(parg->name)) {
722 trace_probe_log_err(0, BAD_ARG_NAME);
725 if (traceprobe_conflict_field_name(parg->name, tp->args, i)) {
726 trace_probe_log_err(0, USED_ARG_NAME);
729 /* Parse fetch argument */
730 return traceprobe_parse_probe_arg_body(body, &tp->size, parg, flags,
734 void traceprobe_free_probe_arg(struct probe_arg *arg)
736 struct fetch_insn *code = arg->code;
738 while (code && code->op != FETCH_OP_END) {
739 if (code->op == FETCH_NOP_SYMBOL)
749 int traceprobe_update_arg(struct probe_arg *arg)
751 struct fetch_insn *code = arg->code;
757 while (code && code->op != FETCH_OP_END) {
758 if (code->op == FETCH_NOP_SYMBOL) {
759 if (code[1].op != FETCH_OP_IMM)
762 tmp = strpbrk(code->data, "+-");
765 ret = traceprobe_split_symbol_offset(code->data,
771 (unsigned long)kallsyms_lookup_name(code->data);
774 if (!code[1].immediate)
776 code[1].immediate += offset;
783 /* When len=0, we just calculate the needed length */
784 #define LEN_OR_ZERO (len ? len - pos : 0)
785 static int __set_print_fmt(struct trace_probe *tp, char *buf, int len,
788 struct probe_arg *parg;
791 const char *fmt, *arg;
795 arg = "REC->" FIELD_STRING_IP;
797 fmt = "(%lx <- %lx)";
798 arg = "REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP;
801 pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", fmt);
803 for (i = 0; i < tp->nr_args; i++) {
805 pos += snprintf(buf + pos, LEN_OR_ZERO, " %s=", parg->name);
807 pos += snprintf(buf + pos, LEN_OR_ZERO, "{%s",
809 for (j = 1; j < parg->count; j++)
810 pos += snprintf(buf + pos, LEN_OR_ZERO, ",%s",
812 pos += snprintf(buf + pos, LEN_OR_ZERO, "}");
814 pos += snprintf(buf + pos, LEN_OR_ZERO, "%s",
818 pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg);
820 for (i = 0; i < tp->nr_args; i++) {
823 if (strcmp(parg->type->name, "string") == 0)
824 fmt = ", __get_str(%s[%d])";
826 fmt = ", REC->%s[%d]";
827 for (j = 0; j < parg->count; j++)
828 pos += snprintf(buf + pos, LEN_OR_ZERO,
831 if (strcmp(parg->type->name, "string") == 0)
832 fmt = ", __get_str(%s)";
835 pos += snprintf(buf + pos, LEN_OR_ZERO,
840 /* return the length of print_fmt */
845 int traceprobe_set_print_fmt(struct trace_probe *tp, bool is_return)
847 struct trace_event_call *call = trace_probe_event_call(tp);
851 /* First: called with 0 length to calculate the needed length */
852 len = __set_print_fmt(tp, NULL, 0, is_return);
853 print_fmt = kmalloc(len + 1, GFP_KERNEL);
857 /* Second: actually write the @print_fmt */
858 __set_print_fmt(tp, print_fmt, len + 1, is_return);
859 call->print_fmt = print_fmt;
864 int traceprobe_define_arg_fields(struct trace_event_call *event_call,
865 size_t offset, struct trace_probe *tp)
869 /* Set argument names as fields */
870 for (i = 0; i < tp->nr_args; i++) {
871 struct probe_arg *parg = &tp->args[i];
872 const char *fmt = parg->type->fmttype;
873 int size = parg->type->size;
879 ret = trace_define_field(event_call, fmt, parg->name,
880 offset + parg->offset, size,
881 parg->type->is_signed,
890 void trace_probe_cleanup(struct trace_probe *tp)
892 struct trace_event_call *call = trace_probe_event_call(tp);
895 for (i = 0; i < tp->nr_args; i++)
896 traceprobe_free_probe_arg(&tp->args[i]);
898 kfree(call->class->system);
900 kfree(call->print_fmt);
903 int trace_probe_init(struct trace_probe *tp, const char *event,
906 struct trace_event_call *call = trace_probe_event_call(tp);
908 if (!event || !group)
911 call->class = &tp->class;
912 call->name = kstrdup(event, GFP_KERNEL);
916 tp->class.system = kstrdup(group, GFP_KERNEL);
917 if (!tp->class.system) {
922 INIT_LIST_HEAD(&tp->files);
923 INIT_LIST_HEAD(&tp->class.fields);
928 int trace_probe_register_event_call(struct trace_probe *tp)
930 struct trace_event_call *call = trace_probe_event_call(tp);
933 ret = register_trace_event(&call->event);
937 ret = trace_add_event_call(call);
939 unregister_trace_event(&call->event);
944 int trace_probe_add_file(struct trace_probe *tp, struct trace_event_file *file)
946 struct event_file_link *link;
948 link = kmalloc(sizeof(*link), GFP_KERNEL);
953 INIT_LIST_HEAD(&link->list);
954 list_add_tail_rcu(&link->list, &tp->files);
955 trace_probe_set_flag(tp, TP_FLAG_TRACE);
959 struct event_file_link *trace_probe_get_file_link(struct trace_probe *tp,
960 struct trace_event_file *file)
962 struct event_file_link *link;
964 trace_probe_for_each_link(link, tp) {
965 if (link->file == file)
972 int trace_probe_remove_file(struct trace_probe *tp,
973 struct trace_event_file *file)
975 struct event_file_link *link;
977 link = trace_probe_get_file_link(tp, file);
981 list_del_rcu(&link->list);
985 if (list_empty(&tp->files))
986 trace_probe_clear_flag(tp, TP_FLAG_TRACE);