twx-linux/include
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
..
acpi LoongArch: Fix warnings during S3 suspend 2025-02-08 09:52:27 +01:00
asm-generic mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear() 2025-03-13 12:58:38 +01:00
clocksource x86/hyperv: Fix hv tsc page based sched_clock for hibernation 2025-01-10 14:31:36 +01:00
crypto crypto: ecc - Prevent ecc_digits_from_bytes from reading too many bytes 2025-01-09 13:31:52 +01:00
drm drm/dp_mst: Fix drm RAD print 2025-04-10 14:37:27 +02:00
dt-bindings dt-bindings: clock: sunxi: Export PLL_VIDEO_2X and PLL_MIPI 2025-02-08 09:51:55 +01:00
keys
kunit
kvm
linux tracing/hist: Add poll(POLLIN) support on hist file 2025-04-10 14:37:41 +02:00
math-emu
media media: v4l2-core: v4l2-dv-timings: check cvt/gtf result 2024-12-09 10:32:51 +01:00
memory
misc
net Bluetooth: hci_event: Fix connection regression between LE and non-LE adapters 2025-03-28 21:59:53 +01:00
pcmcia
ras
rdma RDMA/core: Don't expose hw_counters outside of init net namespace 2025-04-10 14:37:30 +02:00
rv rv: Reset per-task monitors also for idle tasks 2025-02-17 09:40:32 +01:00
scsi scsi: Remove scsi device no_start_on_resume flag 2024-10-17 15:24:11 +02:00
soc net: mscc: ocelot: be resilient to loss of PTP packets during transmission 2024-12-19 18:11:29 +01:00
sound ASoC: ops: Consistently treat platform_max as control value 2025-03-22 12:50:48 -07:00
target
trace net/ipv4: add tracepoint for icmp_send 2025-03-07 16:45:39 +01:00
uapi IB/core: Add support for XDR link speed 2025-03-07 16:45:37 +01:00
ufs scsi: ufs: core: Add UFS RTC support 2025-03-07 16:45:35 +01:00
vdso
video
xen