linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf/ring_buffer: Trigger FASYNC signals for watermark wakeups
@ 2024-02-21 17:52 Kyle Huey
  2024-02-21 17:52 ` [PATCH 2/2] perf test: Test FASYNC with " Kyle Huey
  0 siblings, 1 reply; 15+ messages in thread
From: Kyle Huey @ 2024-02-21 17:52 UTC (permalink / raw)
  To: Kyle Huey, Robert O'Callahan, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, linux-perf-users, linux-kernel

perf_output_wakeup() already marks the perf event fd available for polling.
Add code to trigger IO signals with FASYNC too.

Signed-off-by: Kyle Huey <khuey@kylehuey.com>
---
 include/linux/perf_event.h  | 8 ++++++++
 kernel/events/core.c        | 8 --------
 kernel/events/ring_buffer.c | 3 +++
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c8bd5bb6610c..c077968d7e52 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1914,4 +1914,12 @@ static inline void perf_lopwr_cb(bool mode)
 }
 #endif
 
+static inline struct fasync_struct **perf_event_fasync(struct perf_event *event)
+{
+	/* only the parent has fasync state */
+	if (event->parent)
+		event = event->parent;
+	return &event->fasync;
+}
+
 #endif /* _LINUX_PERF_EVENT_H */
diff --git a/kernel/events/core.c b/kernel/events/core.c
index a329bec42c4d..36b5fbdf8e6e 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6684,14 +6684,6 @@ static const struct file_operations perf_fops = {
  * to user-space before waking everybody up.
  */
 
-static inline struct fasync_struct **perf_event_fasync(struct perf_event *event)
-{
-	/* only the parent has fasync state */
-	if (event->parent)
-		event = event->parent;
-	return &event->fasync;
-}
-
 void perf_event_wakeup(struct perf_event *event)
 {
 	ring_buffer_wakeup(event);
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 60ed43d1c29e..033e54bb5c62 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -22,6 +22,9 @@ static void perf_output_wakeup(struct perf_output_handle *handle)
 	atomic_set(&handle->rb->poll, EPOLLIN);
 
 	handle->event->pending_wakeup = 1;
+	if (*perf_event_fasync(handle->event) && !handle->event->pending_kill)
+		handle->event->pending_kill = POLL_IN;
+
 	irq_work_queue(&handle->event->pending_irq);
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-24 15:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21 17:52 [PATCH 1/2] perf/ring_buffer: Trigger FASYNC signals for watermark wakeups Kyle Huey
2024-02-21 17:52 ` [PATCH 2/2] perf test: Test FASYNC with " Kyle Huey
2024-02-21 18:35   ` Ian Rogers
2024-02-22 17:55     ` Kyle Huey
2024-02-22 18:32       ` Ian Rogers
2024-02-22 18:41         ` Kyle Huey
2024-02-22 19:44           ` Ian Rogers
2024-02-22 19:54       ` Arnaldo Carvalho de Melo
2024-02-23 17:35         ` Kyle Huey
2024-02-23 17:59           ` Arnaldo Carvalho de Melo
2024-02-23 21:43             ` Robert O'Callahan
2024-02-24  2:27               ` Namhyung Kim
2024-02-24 15:58               ` Arnaldo Carvalho de Melo
2024-02-23 18:01           ` Ian Rogers
2024-02-23 18:17             ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).