Skip to content

Commit

Permalink
tracing/fprobe: Remove nr_maxactive from fprobe
Browse files Browse the repository at this point in the history
Remove depercated fprobe::nr_maxactive. This involves fprobe events to
rejects the maxactive number.

Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Florent Revest <revest@chromium.org>
Cc: Martin KaFai Lau <martin.lau@linux.dev>
Cc: bpf <bpf@vger.kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Alan Maguire <alan.maguire@oracle.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/173519007257.391279.946804046982289337.stgit@devnote2
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
  • Loading branch information
Masami Hiramatsu (Google) authored and Steven Rostedt (Google) committed Dec 26, 2024
1 parent b5fa903 commit a222455
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 39 deletions.
2 changes: 0 additions & 2 deletions include/linux/fprobe.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ struct fprobe_hlist {
* @nmissed: The counter for missing events.
* @flags: The status flag.
* @entry_data_size: The private data storage size.
* @nr_maxactive: The max number of active functions. (*deprecated)
* @entry_handler: The callback function for function entry.
* @exit_handler: The callback function for function exit.
* @hlist_array: The fprobe_hlist for fprobe search from IP hash table.
Expand All @@ -63,7 +62,6 @@ struct fprobe {
unsigned long nmissed;
unsigned int flags;
size_t entry_data_size;
int nr_maxactive;

fprobe_entry_cb entry_handler;
fprobe_exit_cb exit_handler;
Expand Down
43 changes: 6 additions & 37 deletions kernel/trace/trace_fprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ static struct trace_fprobe *alloc_trace_fprobe(const char *group,
const char *symbol,
struct tracepoint *tpoint,
struct module *mod,
int maxactive,
int nargs, bool is_return)
{
struct trace_fprobe *tf;
Expand All @@ -445,7 +444,6 @@ static struct trace_fprobe *alloc_trace_fprobe(const char *group,

tf->tpoint = tpoint;
tf->mod = mod;
tf->fp.nr_maxactive = maxactive;

ret = trace_probe_init(&tf->tp, event, group, false, nargs);
if (ret < 0)
Expand Down Expand Up @@ -1098,12 +1096,11 @@ static int __trace_fprobe_create(int argc, const char *argv[])
* FETCHARG:TYPE : use TYPE instead of unsigned long.
*/
struct trace_fprobe *tf = NULL;
int i, len, new_argc = 0, ret = 0;
int i, new_argc = 0, ret = 0;
bool is_return = false;
char *symbol = NULL;
const char *event = NULL, *group = FPROBE_EVENT_SYSTEM;
const char **new_argv = NULL;
int maxactive = 0;
char buf[MAX_EVENT_NAME_LEN];
char gbuf[MAX_EVENT_NAME_LEN];
char sbuf[KSYM_NAME_LEN];
Expand All @@ -1126,33 +1123,13 @@ static int __trace_fprobe_create(int argc, const char *argv[])

trace_probe_log_init("trace_fprobe", argc, argv);

event = strchr(&argv[0][1], ':');
if (event)
event++;

if (isdigit(argv[0][1])) {
if (event)
len = event - &argv[0][1] - 1;
else
len = strlen(&argv[0][1]);
if (len > MAX_EVENT_NAME_LEN - 1) {
trace_probe_log_err(1, BAD_MAXACT);
goto parse_error;
}
memcpy(buf, &argv[0][1], len);
buf[len] = '\0';
ret = kstrtouint(buf, 0, &maxactive);
if (ret || !maxactive) {
if (argv[0][1] != '\0') {
if (argv[0][1] != ':') {
trace_probe_log_set_index(0);
trace_probe_log_err(1, BAD_MAXACT);
goto parse_error;
}
/* fprobe rethook instances are iterated over via a list. The
* maximum should stay reasonable.
*/
if (maxactive > RETHOOK_MAXACTIVE_MAX) {
trace_probe_log_err(1, MAXACT_TOO_BIG);
goto parse_error;
}
event = &argv[0][2];
}

trace_probe_log_set_index(1);
Expand All @@ -1162,12 +1139,6 @@ static int __trace_fprobe_create(int argc, const char *argv[])
if (ret < 0)
goto parse_error;

if (!is_return && maxactive) {
trace_probe_log_set_index(0);
trace_probe_log_err(1, BAD_MAXACT_TYPE);
goto parse_error;
}

trace_probe_log_set_index(0);
if (event) {
ret = traceprobe_parse_event_name(&event, &group, gbuf,
Expand Down Expand Up @@ -1235,7 +1206,7 @@ static int __trace_fprobe_create(int argc, const char *argv[])

/* setup a probe */
tf = alloc_trace_fprobe(group, event, symbol, tpoint, tp_mod,
maxactive, argc, is_return);
argc, is_return);
if (IS_ERR(tf)) {
ret = PTR_ERR(tf);
/* This must return -ENOMEM, else there is a bug */
Expand Down Expand Up @@ -1315,8 +1286,6 @@ static int trace_fprobe_show(struct seq_file *m, struct dyn_event *ev)
seq_putc(m, 't');
else
seq_putc(m, 'f');
if (trace_fprobe_is_return(tf) && tf->fp.nr_maxactive)
seq_printf(m, "%d", tf->fp.nr_maxactive);
seq_printf(m, ":%s/%s", trace_probe_group_name(&tf->tp),
trace_probe_name(&tf->tp));

Expand Down

0 comments on commit a222455

Please sign in to comment.