Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing: Wake up poll waiters for hist files when removing an event

The event_hist_poll() function attempts to verify whether an event file is
being removed, but this check may not occur or could be unnecessarily
delayed. This happens because hist_poll_wakeup() is currently invoked only
from event_hist_trigger() when a hist command is triggered. If the event
file is being removed, no associated hist command will be triggered and a
waiter will be woken up only after an unrelated hist command is triggered.

Fix the issue by adding a call to hist_poll_wakeup() in
remove_event_file_dir() after setting the EVENT_FILE_FL_FREED flag. This
ensures that a task polling on a hist file is woken up and receives
EPOLLERR.

Cc: stable@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Tom Zanussi <zanussi@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Link: https://patch.msgid.link/20260219162737.314231-3-petr.pavlu@suse.com
Fixes: 1bd13edbbed6 ("tracing/hist: Add poll(POLLIN) support on hist file")
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Petr Pavlu and committed by
Steven Rostedt (Google)
9678e531 f0a0da1f

+8
+5
include/linux/trace_events.h
··· 683 683 684 684 #define hist_poll_wait(file, wait) \ 685 685 poll_wait(file, &hist_poll_wq, wait) 686 + 687 + #else 688 + static inline void hist_poll_wakeup(void) 689 + { 690 + } 686 691 #endif 687 692 688 693 #define __TRACE_EVENT_FLAGS(name, value) \
+3
kernel/trace/trace_events.c
··· 1311 1311 free_event_filter(file->filter); 1312 1312 file->flags |= EVENT_FILE_FL_FREED; 1313 1313 event_file_put(file); 1314 + 1315 + /* Wake up hist poll waiters to notice the EVENT_FILE_FL_FREED flag. */ 1316 + hist_poll_wakeup(); 1314 1317 } 1315 1318 1316 1319 /*