[PATCH] perf ftrace latency: Do not read trace files when BPF is used
From: Namhyung Kim
Date: Wed Aug 26 2026 - 14:58:33 EST
I've realized that it didn't set up the tracing files when BPF is used
so poll() just returns immediately. It ends up with calling poll()
unnecessarily in a loop.
BPF still needs the loop to wait for the target process exiting or a
signal from users. Let's sleep for 1 msec and check that.
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/builtin-ftrace.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 4f881a40c311ae52..e61b9de11e1e41c7 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -1146,6 +1146,11 @@ static int __cmd_latency(struct perf_ftrace *ftrace)
line[0] = '\0';
while (!done) {
+ if (ftrace->target.use_bpf) {
+ usleep(1000);
+ continue;
+ }
+
if (poll(&pollfd, 1, -1) < 0)
break;
--
2.55.0.897.gb25b4bd76c-goog