Files
linux-cix/include/linux
Masami Hiramatsu (Google) 13edaf9979 tracing/hist: Add poll(POLLIN) support on hist file
[ Upstream commit 1bd13edbbed6e7e396f1aab92b224a4775218e68 ]

Add poll syscall support on the `hist` file. The Waiter will be waken
up when the histogram is updated with POLLIN.

Currently, there is no way to wait for a specific event in userspace.
So user needs to peek the `trace` periodicaly, or wait on `trace_pipe`.
But it is not a good idea to peek at the `trace` for an event that
randomly happens. And `trace_pipe` is not coming back until a page is
filled with events.

This allows a user to wait for a specific event on the `hist` file. User
can set a histogram trigger on the event which they want to monitor
and poll() on its `hist` file. Since this poll() returns POLLIN, the next
poll() will return soon unless a read() happens on that hist file.

NOTE: To read the hist file again, you must set the file offset to 0,
but just for monitoring the event, you may not need to read the
histogram.

Cc: Shuah Khan <shuah@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/173527247756.464571.14236296701625509931.stgit@devnote2
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Stable-dep-of: 0b4ffbe4888a ("tracing: Correct the refcount if the hist/hist_debug file fails to open")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-10 14:37:41 +02:00
..
2024-07-25 09:50:47 +02:00
2024-10-04 16:29:59 +02:00
2024-12-14 19:59:58 +01:00
2024-08-29 17:33:31 +02:00
2025-02-08 09:51:56 +01:00
2025-02-08 09:52:02 +01:00
2025-01-09 13:31:41 +01:00
2025-02-08 09:52:38 +01:00
2025-03-28 21:59:55 +01:00
2025-01-23 17:21:12 +01:00
2025-01-09 13:31:41 +01:00
2025-02-01 18:37:51 +01:00
2025-02-27 04:10:50 -08:00
2024-08-29 17:33:23 +02:00
2024-10-17 15:24:23 +02:00
2024-11-08 16:28:26 +01:00