* [RFC/PATCH for-perf-urgent] perf/core: Change to POLLERR for pinned events with error
@ 2025-04-22 22:33 Namhyung Kim
2025-04-23 7:46 ` [tip: perf/urgent] " tip-bot2 for Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2025-04-22 22:33 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar
Cc: Kan Liang, Mark Rutland, Alexander Shishkin,
Arnaldo Carvalho de Melo, LKML, Gabriel Marin
The commit f4b07fd62d4d11d5 ("perf/core: Use POLLHUP for pinned events
in error") started to emit POLLHUP for pinned events in an error state.
But the POLLHUP is also used to signal events that the attached task is
terminated. To distinguish pinned per-task events in the error state
it would need to check if the task is live.
If we can change it to POLLERR it should be clear.
Suggested-by: Gabriel Marin <gmx@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/events/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index e93c195659140d30..95e703891b24f8fc 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3943,7 +3943,7 @@ static int merge_sched_in(struct perf_event *event, void *data)
perf_event_set_state(event, PERF_EVENT_STATE_ERROR);
if (*perf_event_fasync(event))
- event->pending_kill = POLL_HUP;
+ event->pending_kill = POLL_ERR;
perf_event_wakeup(event);
} else {
@@ -6075,7 +6075,7 @@ static __poll_t perf_poll(struct file *file, poll_table *wait)
if (unlikely(READ_ONCE(event->state) == PERF_EVENT_STATE_ERROR &&
event->attr.pinned))
- return events;
+ return EPOLLERR;
/*
* Pin the event->rb by taking event->mmap_mutex; otherwise
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip: perf/urgent] perf/core: Change to POLLERR for pinned events with error
2025-04-22 22:33 [RFC/PATCH for-perf-urgent] perf/core: Change to POLLERR for pinned events with error Namhyung Kim
@ 2025-04-23 7:46 ` tip-bot2 for Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Namhyung Kim @ 2025-04-23 7:46 UTC (permalink / raw)
To: linux-tip-commits
Cc: Gabriel Marin, Namhyung Kim, Ingo Molnar, Alexander Shishkin,
Arnaldo Carvalho de Melo, Kan Liang, Mark Rutland,
Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: 0db61388b389f43c1ba2f1cee3613feb4fd12150
Gitweb: https://git.kernel.org/tip/0db61388b389f43c1ba2f1cee3613feb4fd12150
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Tue, 22 Apr 2025 15:33:18 -07:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 23 Apr 2025 09:39:06 +02:00
perf/core: Change to POLLERR for pinned events with error
Commit:
f4b07fd62d4d11d5 ("perf/core: Use POLLHUP for pinned events in error")
started to emit POLLHUP for pinned events in an error state.
But the POLLHUP is also used to signal events that the attached task is
terminated. To distinguish pinned per-task events in the error state
it would need to check if the task is live.
Change it to POLLERR to make it clear.
Suggested-by: Gabriel Marin <gmx@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250422223318.180343-1-namhyung@kernel.org
---
kernel/events/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index e93c195..95e7038 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3943,7 +3943,7 @@ static int merge_sched_in(struct perf_event *event, void *data)
perf_event_set_state(event, PERF_EVENT_STATE_ERROR);
if (*perf_event_fasync(event))
- event->pending_kill = POLL_HUP;
+ event->pending_kill = POLL_ERR;
perf_event_wakeup(event);
} else {
@@ -6075,7 +6075,7 @@ static __poll_t perf_poll(struct file *file, poll_table *wait)
if (unlikely(READ_ONCE(event->state) == PERF_EVENT_STATE_ERROR &&
event->attr.pinned))
- return events;
+ return EPOLLERR;
/*
* Pin the event->rb by taking event->mmap_mutex; otherwise
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-23 7:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-22 22:33 [RFC/PATCH for-perf-urgent] perf/core: Change to POLLERR for pinned events with error Namhyung Kim
2025-04-23 7:46 ` [tip: perf/urgent] " tip-bot2 for Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®