* [PATCH 01/10] tracing/probes: Remove duplicate MAX_ARRAY_LEN macro definition
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
@ 2026-07-20 10:43 ` Masami Hiramatsu (Google)
2026-07-20 10:43 ` [PATCH 02/10] tracing/probes: Remove redundant boolean conversion in trace_probe_has_single_file() Masami Hiramatsu (Google)
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:43 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
MAX_ARRAY_LEN is defined twice in trace_probe.h. Remove the redundant
definition.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_probe.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index ebdc706e7cb6..b3571c85abb1 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -220,7 +220,6 @@ DECLARE_BASIC_PRINT_TYPE_FUNC(symbol);
_ASSIGN_FETCH_TYPE(#ptype, ptype, ftype, sizeof(ftype), sign, atype)
#define ASSIGN_FETCH_TYPE_END {}
-#define MAX_ARRAY_LEN 64
#ifdef CONFIG_KPROBE_EVENTS
bool trace_kprobe_on_func_entry(struct trace_event_call *call);
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 02/10] tracing/probes: Remove redundant boolean conversion in trace_probe_has_single_file()
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
2026-07-20 10:43 ` [PATCH 01/10] tracing/probes: Remove duplicate MAX_ARRAY_LEN macro definition Masami Hiramatsu (Google)
@ 2026-07-20 10:43 ` Masami Hiramatsu (Google)
2026-07-20 10:43 ` [PATCH 03/10] tracing/probes: Remove redundant bounds check in trace_probe_compare_arg_type() Masami Hiramatsu (Google)
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:43 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
list_is_singular() returns a boolean value, so the double negation (!!)
in trace_probe_has_single_file() is redundant. Remove it.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_probe.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index b3571c85abb1..c0f05763811c 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -360,7 +360,7 @@ static inline int trace_probe_unregister_event_call(struct trace_probe *tp)
static inline bool trace_probe_has_single_file(struct trace_probe *tp)
{
- return !!list_is_singular(&tp->event->files);
+ return list_is_singular(&tp->event->files);
}
int trace_probe_init(struct trace_probe *tp, const char *event,
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 03/10] tracing/probes: Remove redundant bounds check in trace_probe_compare_arg_type()
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
2026-07-20 10:43 ` [PATCH 01/10] tracing/probes: Remove duplicate MAX_ARRAY_LEN macro definition Masami Hiramatsu (Google)
2026-07-20 10:43 ` [PATCH 02/10] tracing/probes: Remove redundant boolean conversion in trace_probe_has_single_file() Masami Hiramatsu (Google)
@ 2026-07-20 10:43 ` Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 04/10] tracing/probes: Remove unused parameter from parse_probe_var_retval() Masami Hiramatsu (Google)
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:43 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
In trace_probe_compare_arg_type(), prior to entering the comparison loop,
a->nr_args and b->nr_args are checked for equality. Since the loop
condition is i < a->nr_args, i is guaranteed to be less than b->nr_args
inside the loop.
Remove the redundant (b->nr_args <= i) check.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_probe.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 7568f5e68de7..91ba4490937b 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -2770,10 +2770,9 @@ int trace_probe_compare_arg_type(struct trace_probe *a, struct trace_probe *b)
return b->nr_args + 1;
for (i = 0; i < a->nr_args; i++) {
- if ((b->nr_args <= i) ||
- ((a->args[i].type != b->args[i].type) ||
- (a->args[i].count != b->args[i].count) ||
- strcmp(a->args[i].name, b->args[i].name)))
+ if ((a->args[i].type != b->args[i].type) ||
+ (a->args[i].count != b->args[i].count) ||
+ strcmp(a->args[i].name, b->args[i].name))
return i + 1;
}
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 04/10] tracing/probes: Remove unused parameter from parse_probe_var_retval()
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
` (2 preceding siblings ...)
2026-07-20 10:43 ` [PATCH 03/10] tracing/probes: Remove redundant bounds check in trace_probe_compare_arg_type() Masami Hiramatsu (Google)
@ 2026-07-20 10:44 ` Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 05/10] tracing/probes: Cleanup pointer arithmetic in store_trace_entry_data() Masami Hiramatsu (Google)
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:44 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
The parameter 'arg' in parse_probe_var_retval() is unused. Remove it
and update its caller accordingly.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_probe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 91ba4490937b..eb7be3725e85 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -1262,7 +1262,7 @@ NOKPROBE_SYMBOL(store_trace_entry_data)
#define PARAM_MAX_STACK (THREAD_SIZE / sizeof(unsigned long))
-static int parse_probe_var_retval(char *orig_arg, char *arg,
+static int parse_probe_var_retval(char *orig_arg,
struct fetch_insn **pcode,
struct fetch_insn *end,
struct traceprobe_parse_context *ctx)
@@ -1415,7 +1415,7 @@ static int parse_probe_vars(char *orig_arg, const struct fetch_type *t,
goto inval;
if (str_has_prefix(arg, "retval"))
- return parse_probe_var_retval(orig_arg, arg, pcode, end, ctx);
+ return parse_probe_var_retval(orig_arg, pcode, end, ctx);
len = str_has_prefix(arg, "stack");
if (len)
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 05/10] tracing/probes: Cleanup pointer arithmetic in store_trace_entry_data()
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
` (3 preceding siblings ...)
2026-07-20 10:44 ` [PATCH 04/10] tracing/probes: Remove unused parameter from parse_probe_var_retval() Masami Hiramatsu (Google)
@ 2026-07-20 10:44 ` Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 06/10] tracing/probes: Simplify BTF_KIND_PTR case in fetch_type_from_btf_type() Masami Hiramatsu (Google)
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:44 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
In store_trace_entry_data(), edata is cast to unsigned long for pointer
offset arithmetic before being cast back to unsigned long *. Cast edata
to u8 * instead.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_probe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index eb7be3725e85..4899aa5f9230 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -1246,7 +1246,7 @@ void store_trace_entry_data(void *edata, struct trace_probe *tp, struct pt_regs
val = regs_get_kernel_argument(regs, code->param);
break;
case FETCH_OP_ST_EDATA:
- *(unsigned long *)((unsigned long)edata + code->offset) = val;
+ *(unsigned long *)((u8 *)edata + code->offset) = val;
break;
case FETCH_OP_END:
goto end;
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 06/10] tracing/probes: Simplify BTF_KIND_PTR case in fetch_type_from_btf_type()
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
` (4 preceding siblings ...)
2026-07-20 10:44 ` [PATCH 05/10] tracing/probes: Cleanup pointer arithmetic in store_trace_entry_data() Masami Hiramatsu (Google)
@ 2026-07-20 10:44 ` Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 07/10] tracing/fprobe: Remove redundant snprintf in trace_fprobe_match_command_head() Masami Hiramatsu (Google)
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:44 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Use a ternary operator for checking IS_ENABLED(CONFIG_64BIT) in the
BTF_KIND_PTR case of fetch_type_from_btf_type() to simplify the code.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_probe.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 4899aa5f9230..fc62d09ea535 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -495,10 +495,7 @@ static const char *fetch_type_from_btf_type(struct btf *btf,
return "s64";
case BTF_KIND_PTR:
/* pointer will be converted to "x??" */
- if (IS_ENABLED(CONFIG_64BIT))
- return "x64";
- else
- return "x32";
+ return IS_ENABLED(CONFIG_64BIT) ? "x64" : "x32";
case BTF_KIND_INT:
intdata = btf_type_int(type);
if (BTF_INT_ENCODING(intdata) & BTF_INT_SIGNED) {
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 07/10] tracing/fprobe: Remove redundant snprintf in trace_fprobe_match_command_head()
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
` (5 preceding siblings ...)
2026-07-20 10:44 ` [PATCH 06/10] tracing/probes: Simplify BTF_KIND_PTR case in fetch_type_from_btf_type() Masami Hiramatsu (Google)
@ 2026-07-20 10:44 ` Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 08/10] tracing/fprobe: Remove redundant memset in fentry_perf_func() Masami Hiramatsu (Google)
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:44 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
trace_fprobe_match_command_head() copies trace_fprobe_symbol(tf) into a
local buffer 'buf' of size MAX_COMMON_HEAD_LEN + 1 using snprintf before
comparing with argv[0].
Since trace_fprobe_symbol(tf) already returns a null-terminated string,
comparing it directly with argv[0] via strcmp() avoids stack buffer usage
and potential symbol truncation at MAX_COMMON_HEAD_LEN.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_fprobe.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
index 5638a90e61cc..566b64853c61 100644
--- a/kernel/trace/trace_fprobe.c
+++ b/kernel/trace/trace_fprobe.c
@@ -238,13 +238,10 @@ static bool trace_fprobe_is_busy(struct dyn_event *ev)
static bool trace_fprobe_match_command_head(struct trace_fprobe *tf,
int argc, const char **argv)
{
- char buf[MAX_COMMON_HEAD_LEN + 1];
-
if (!argc)
return true;
- snprintf(buf, sizeof(buf), "%s", trace_fprobe_symbol(tf));
- if (strcmp(buf, argv[0]))
+ if (strcmp(trace_fprobe_symbol(tf), argv[0]))
return false;
argc--; argv++;
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 08/10] tracing/fprobe: Remove redundant memset in fentry_perf_func()
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
` (6 preceding siblings ...)
2026-07-20 10:44 ` [PATCH 07/10] tracing/fprobe: Remove redundant snprintf in trace_fprobe_match_command_head() Masami Hiramatsu (Google)
@ 2026-07-20 10:44 ` Masami Hiramatsu (Google)
2026-07-20 10:44 ` [PATCH 09/10] tracing/kprobe: Remove redundant memset in kprobe_perf_func() Masami Hiramatsu (Google)
2026-07-20 10:45 ` [PATCH 10/10] tracing/probes: Fix extra whitespace in trace_probe_kernel.h Masami Hiramatsu (Google)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:44 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
fentry_perf_func() calls memset(&entry[1], 0, dsize) prior to calling
store_trace_args(). store_trace_args() populates the entry buffer and
handles dynamic data fields.
Furthermore, passing dsize (the dynamic data byte length) to memset at
&entry[1] (the start of fixed trace arguments) is inaccurate as it zeroes
from the fixed args area rather than the dynamic data region.
Remove this redundant memset call to align with fexit_perf_func() and other
probe perf functions.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_fprobe.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
index 566b64853c61..ec9105fca4a6 100644
--- a/kernel/trace/trace_fprobe.c
+++ b/kernel/trace/trace_fprobe.c
@@ -471,7 +471,6 @@ static int fentry_perf_func(struct trace_fprobe *tf, unsigned long entry_ip,
regs = ftrace_fill_perf_regs(fregs, regs);
entry->ip = entry_ip;
- memset(&entry[1], 0, dsize);
store_trace_args(&entry[1], &tf->tp, fregs, NULL, sizeof(*entry), dsize);
perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs,
head, NULL);
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 09/10] tracing/kprobe: Remove redundant memset in kprobe_perf_func()
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
` (7 preceding siblings ...)
2026-07-20 10:44 ` [PATCH 08/10] tracing/fprobe: Remove redundant memset in fentry_perf_func() Masami Hiramatsu (Google)
@ 2026-07-20 10:44 ` Masami Hiramatsu (Google)
2026-07-20 10:45 ` [PATCH 10/10] tracing/probes: Fix extra whitespace in trace_probe_kernel.h Masami Hiramatsu (Google)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:44 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
kprobe_perf_func() calls memset(&entry[1], 0, dsize) prior to calling
store_trace_args(). store_trace_args() populates the entry buffer and
handles dynamic data fields.
Remove this redundant memset call to align with kretprobe_perf_func() and
other probe perf functions.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_kprobe.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index cc24e992732c..c25f902aa1a6 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1721,7 +1721,6 @@ kprobe_perf_func(struct trace_kprobe *tk, struct pt_regs *regs)
return 0;
entry->ip = (unsigned long)tk->rp.kp.addr;
- memset(&entry[1], 0, dsize);
store_trace_args(&entry[1], &tk->tp, regs, NULL, sizeof(*entry), dsize);
perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs,
head, NULL);
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 10/10] tracing/probes: Fix extra whitespace in trace_probe_kernel.h
2026-07-20 10:43 [PATCH 00/10] tracing/probes: Cleanup probe event code Masami Hiramatsu (Google)
` (8 preceding siblings ...)
2026-07-20 10:44 ` [PATCH 09/10] tracing/kprobe: Remove redundant memset in kprobe_perf_func() Masami Hiramatsu (Google)
@ 2026-07-20 10:45 ` Masami Hiramatsu (Google)
9 siblings, 0 replies; 11+ messages in thread
From: Masami Hiramatsu (Google) @ 2026-07-20 10:45 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Clean up extra space after '=' in fetch_store_strlen_user().
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace_probe_kernel.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_probe_kernel.h b/kernel/trace/trace_probe_kernel.h
index bb723eefd7b7..4eb4acfa09ba 100644
--- a/kernel/trace/trace_probe_kernel.h
+++ b/kernel/trace/trace_probe_kernel.h
@@ -12,7 +12,7 @@
static nokprobe_inline int
fetch_store_strlen_user(unsigned long addr)
{
- const void __user *uaddr = (__force const void __user *)addr;
+ const void __user *uaddr = (__force const void __user *)addr;
return strnlen_user_nofault(uaddr, MAX_STRING_SIZE);
}
^ permalink raw reply related [flat|nested] 11+ messages in thread