[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231207163458.5554-2-khuey@kylehuey.com>
Date: Thu, 7 Dec 2023 08:34:56 -0800
From: Kyle Huey <me@...ehuey.com>
To: Kyle Huey <khuey@...ehuey.com>, linux-kernel@...r.kernel.org,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Marco Elver <elver@...gle.com>,
Yonghong Song <yonghong.song@...ux.dev>
Cc: Robert O'Callahan <robert@...llahan.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-perf-users@...r.kernel.org
Subject: [PATCH v2 1/3] perf: Reorder overflow handler ahead of event_limit/sigtrap
The perf subsystem already allows an overflow handler to clear pending_kill
to suppress a fasync signal (although nobody currently does this). Allow an
overflow handler to suppress the other visible side effects of an overflow,
namely event_limit accounting and SIGTRAP generation.
Signed-off-by: Kyle Huey <khuey@...ehuey.com>
---
kernel/events/core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index b704d83a28b2..19fddfc27a4a 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9541,6 +9541,12 @@ static int __perf_event_overflow(struct perf_event *event,
*/
event->pending_kill = POLL_IN;
+
+ READ_ONCE(event->overflow_handler)(event, data, regs);
+
+ if (!event->pending_kill)
+ return ret;
+
if (events && atomic_dec_and_test(&event->event_limit)) {
ret = 1;
event->pending_kill = POLL_HUP;
@@ -9584,9 +9590,7 @@ static int __perf_event_overflow(struct perf_event *event,
irq_work_queue(&event->pending_irq);
}
- READ_ONCE(event->overflow_handler)(event, data, regs);
-
- if (*perf_event_fasync(event) && event->pending_kill) {
+ if (*perf_event_fasync(event)) {
event->pending_wakeup = 1;
irq_work_queue(&event->pending_irq);
}
--
2.34.1
Powered by blists - more mailing lists