From: Aaron Tomlin Date: Fri, 12 Jun 2026 22:56:10 +0000 (-0400) Subject: perf trace: Fix noise and signed formatting of __probe_ip in bare dynamic probes X-Git-Tag: v7.2-rc1~60^2~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd355f6dc70503191249c5147e2f2e8f3c8838bd;p=thirdparty%2Flinux.git perf trace: Fix noise and signed formatting of __probe_ip in bare dynamic probes When a dynamic probe is created without explicitly requested arguments via perf probe --add, the Ftrace subsystem automatically appends "__probe_ip" to the tracepoint format to record the instruction pointer. Currently, perf trace prints this implicit field by default. Furthermore, because the formatting logic defaults to a standard signed integer representation, the kernel space memory address is erroneously displayed as a meaningless negative integer. ❯ sudo ./perf trace --event probe:proc_sys_open --max-events 1 0.000 ps/1316543 probe:proc_sys_open(__probe_ip: -1406056956) This patch addresses the user experience by combining two refinements: 1. "__probe_ip" is now hidden from the standard output, as its presence adds no contextual value for a bare probe. 2. If the user explicitly requests verbose output (--verbose), "__probe_ip" is intercepted and properly formatted as a hexadecimal kernel address, restoring its utility for debugging inline function hits. ❯ sudo ./perf trace --event probe:proc_sys_open --max-events 1 0.000 ps/1314074 probe:proc_sys_open() ❯ sudo ./perf trace --verbose --event probe:proc_sys_open --max-events 1 Using CPUID GenuineIntel-6-8E-C mmap size 528384B 0.000 ps/1314366 probe:proc_sys_open(__probe_ip: 0xffffffffac314604) Reviewed-by: James Clark Signed-off-by: Aaron Tomlin Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Daniel Vacek Cc: Howard Chu Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Sean Ashe Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 377f0a18b00e3..a8492da23a9cc 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -3261,6 +3261,27 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct perf_sample * if (val == 0 && !trace->show_zeros && !arg->show_zero && arg->strtoul != STUL_BTF_TYPE) continue; + /* + * __probe_ip is implicitly added to bare dynamic probes. + * Suppress it by default to avoid cluttering the output. + * If verbose mode is enabled, ensure it is formatted as a + * hexadecimal memory address rather than a signed integer. + */ + if (!strcmp(field->name, "__probe_ip")) { + if (!verbose) + continue; + + printed += scnprintf(bf + printed, size - printed, + "%s", printed ? ", " : ""); + if (trace->show_arg_names) + printed += scnprintf(bf + printed, size - printed, + "%s: ", field->name); + + printed += scnprintf(bf + printed, size - printed, "%#016llx", + (unsigned long long)val); + continue; + } + printed += scnprintf(bf + printed, size - printed, "%s", printed ? ", " : ""); if (trace->show_arg_names)