On Fri, Jan 12, 2024 at 07:17:06PM +0900, Masami Hiramatsu (Google) wrote: SNIP > * Register @fp to ftrace for enabling the probe on the address given by @addrs. > @@ -298,23 +547,27 @@ EXPORT_SYMBOL_GPL(register_fprobe); > */ > int register_fprobe_ips(struct fprobe *fp, unsigned long *addrs, int num) > { > - int ret; > - > - if (!fp || !addrs || num <= 0) > - return -EINVAL; > - > - fprobe_init(fp); > + struct fprobe_hlist *hlist_array; > + int ret, i; > > - ret = ftrace_set_filter_ips(&fp->ops, addrs, num, 0, 0); > + ret = fprobe_init(fp, addrs, num); > if (ret) > return ret; > > - ret = fprobe_init_rethook(fp, num); > - if (!ret) > - ret = register_ftrace_function(&fp->ops); > + mutex_lock(&fprobe_mutex); > + > + hlist_array = fp->hlist_array; > + ret = fprobe_graph_add_ips(addrs, num); so fprobe_graph_add_ips registers the ftrace_ops and actually starts the tracing.. and in the code below we prepare fprobe data that is checked in the ftrace_ops callback.. should we do this this earlier before calling fprobe_graph_add_ips/register_ftrace_graph? jirka > + if (!ret) { > + add_fprobe_hash(fp); > + for (i = 0; i < hlist_array->size; i++) > + insert_fprobe_node(&hlist_array->array[i]); > + } > + mutex_unlock(&fprobe_mutex); > > if (ret) > fprobe_fail_cleanup(fp); > + > return ret; > } > EXPORT_SYMBOL_GPL(register_fprobe_ips); > @@ -352,14 +605,13 @@ EXPORT_SYMBOL_GPL(register_fprobe_syms); SNIP