perf: Fix the POLL_HUP delivery breakage
Subsystems (2)
PATCH 1/1 perf: Fix the POLL_HUP delivery breakage
From: Kan Liang <[email protected]>
The event_limit can be set by the PERF_EVENT_IOC_REFRESH to limit the number of events. When the event_limit reaches 0, the POLL_HUP signal should be sent. But it's missed.
The corresponding counter should be stopped when the event_limit reaches
0. It was implemented in the ARCH-specific code. However, since the commit 9734e25fbf5a ("perf: Fix the throttle logic for a group"), all the ARCH-specific code has been moved to the generic code. The code to handle the event_limit was lost.
Add the event->pmu->stop(event, 0); back.
--- kernel/events/core.c | 1 + 1 file changed, 1 insertion(+)
kernel/events/core.c +1 -0
@@ -10378,6 +10378,7 @@ static int __perf_event_overflow(struct perf_event *event, ret =1 ; event->pending_kill =POLL_HUP ;perf_event_disable_inatomic (event); + event->pmu->stop (event,0 ); }if (event->attr.sigtrap) {
Signature · 1 line
2.38.1
Quoted 38 lines · On Mon, Aug 11, 2025 at 11:26:44AM -0700, [email protected] wrote:
From: Kan Liang <[email protected]>
The
event_limitcan be set by thePERF_EVENT_IOC_REFRESHto limit the number of events. When theevent_limitreaches 0, thePOLL_HUPsignal should be sent. But it's missed.The corresponding counter should be stopped when the
event_limitreaches
0. It was implemented in the ARCH-specific code. However, since the commit9734e25fbf5a("perf: Fix the throttle logic for a group"), all the ARCH-specific code has been moved to the generic code. The code to handle theevent_limitwas lost.Add the
event->pmu->stop(event, 0); back.Fixes 9734e25fbf5a ("perf: Fix the throttle logic for a group")Reported-by Sumanth Korikkar <[email protected]>Tested-by Sumanth Korikkar <[email protected]>Signed-off-by Kan Liang <[email protected]>--- kernel/events/core.c | 1 + 1 file changed, 1 insertion(+)kernel/events/core.c +1
-0@@ -10378,6 +10378,7 @@ static int __perf_event_overflow(struct perf_event *event, ret =1 ; event->pending_kill =POLL_HUP ;perf_event_disable_inatomic (event); + event->pmu->stop (event,0 ); }if (event->attr.sigtrap) {Signature · 1 line
2.38.1
Hi All,
It would be great, if this patch can be integrated soon.
Thank you
Peter Zijlstra
maintainerQuoted 28 lines · On Mon, Aug 11, 2025 at 11:26:44AM -0700, [email protected] wrote:
From: Kan Liang <[email protected]>
The
event_limitcan be set by thePERF_EVENT_IOC_REFRESHto limit the number of events. When theevent_limitreaches 0, thePOLL_HUPsignal should be sent. But it's missed.The corresponding counter should be stopped when the
event_limitreaches
0. It was implemented in the ARCH-specific code. However, since the commit9734e25fbf5a("perf: Fix the throttle logic for a group"), all the ARCH-specific code has been moved to the generic code. The code to handle theevent_limitwas lost.Add the
event->pmu->stop(event, 0); back.Fixes 9734e25fbf5a ("perf: Fix the throttle logic for a group")Reported-by Sumanth Korikkar <[email protected]>Tested-by Sumanth Korikkar <[email protected]>Signed-off-by Kan Liang <[email protected]>--- kernel/events/core.c | 1 + 1 file changed, 1 insertion(+)kernel/events/core.c +0
-0
kernel/events/core.c static int __perf_event_overflow(struct perf_event *event, · line 10384
Quoted 7 lines
kernel/events/core.c +1
-0@@ -10378,6 +10378,7 @@ static int __perf_event_overflow(struct perf_event *event, ret =1 ; event->pending_kill =POLL_HUP ;perf_event_disable_inatomic (event); + event->pmu->stop (event,0 ); }if (event->attr.sigtrap) {
Right. I've queued the patch, but should we take a hard look at anybody still consuming the return value of perf_event_overflow?
The following commit has been merged into the perf/urgent branch of tip:
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: 18dbcbfabfffc4a5d3ea10290c5ad27f22b0d240 Gitweb: https://git.kernel.org/tip/18dbcbfabfffc4a5d3ea10290c5ad27f22b0d240 Author: Kan Liang <[email protected]> AuthorDate: Mon, 11 Aug 2025 11:26:44 -07:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 03 Sep 2025 10:10:59 +02:00
perf: Fix the POLL_HUP delivery breakage
The event_limit can be set by the PERF_EVENT_IOC_REFRESH to limit the number of events. When the event_limit reaches 0, the POLL_HUP signal should be sent. But it's missed.
The corresponding counter should be stopped when the event_limit reaches
0. It was implemented in the ARCH-specific code. However, since the commit 9734e25fbf5a ("perf: Fix the throttle logic for a group"), all the ARCH-specific code has been moved to the generic code. The code to handle the event_limit was lost.
Add the event->pmu->stop(event, 0); back.
--- kernel/events/core.c | 1 + 1 file changed, 1 insertion(+)
kernel/events/core.c +1 -0
@@ -10330,6 +10330,7 @@ static int __perf_event_overflow(struct perf_event *event, ret =1 ; event->pending_kill =POLL_HUP ;perf_event_disable_inatomic (event); + event->pmu->stop (event,0 ); }if (event->attr.sigtrap) {