* [PATCH 2/2] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add()
2026-11-03 13:07 [PATCH 0/2] perf: Fix PERF_EVENT_IOC_REFRESH for tracepoints and breakpoints Paolo Bertinetti
@ 2026-11-03 13:07 ` Paolo Bertinetti
2026-11-03 13:12 ` sashiko-bot
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bertinetti @ 2026-11-03 13:07 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar
Cc: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Kan Liang, Leo Yan, Francesco Nigro,
Sumanth Korikkar, linux-perf-users, linux-trace-kernel,
linux-kernel, regressions
Since commit 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage"),
__perf_event_overflow() stops the event with pmu->stop() and disables
it when the PERF_EVENT_IOC_REFRESH limit is reached. When userspace
re-arms the event with PERF_EVENT_IOC_REFRESH, the event is enabled
again and pmu->add() is called with PERF_EF_START.
hw_breakpoint_add() sets PERF_HES_STOPPED when PERF_EF_START is
missing, but never clears it. The flag set by pmu->stop() stays, and
perf_bp_event() drops every later hit, so a breakpoint re-armed this
way delivers only its first overflow.
Set the state from PERF_EF_START on every add, as perf_swevent_add()
does.
Fixes: 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage")
Assisted-by: LLM
Signed-off-by: Paolo Bertinetti <paolobertinetti200f4@proton.me>
Cc: stable@vger.kernel.org
---
kernel/events/hw_breakpoint.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index 789add0c185a..7a606213f33d 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -968,8 +968,7 @@ static int hw_breakpoint_event_init(struct perf_event *bp)
static int hw_breakpoint_add(struct perf_event *bp, int flags)
{
- if (!(flags & PERF_EF_START))
- bp->hw.state = PERF_HES_STOPPED;
+ bp->hw.state = (flags & PERF_EF_START) ? 0 : PERF_HES_STOPPED;
if (is_sampling_event(bp)) {
bp->hw.last_period = bp->hw.sample_period;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add()
@ 2026-11-03 13:09 Paolo Bertinetti
2026-11-03 13:13 ` sashiko-bot
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bertinetti @ 2026-11-03 13:09 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar
Cc: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Kan Liang, Leo Yan, Francesco Nigro,
Sumanth Korikkar, linux-perf-users, linux-trace-kernel,
linux-kernel, regressions
Since commit 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage"),
__perf_event_overflow() stops the event with pmu->stop() and disables
it when the PERF_EVENT_IOC_REFRESH limit is reached. When userspace
re-arms the event with PERF_EVENT_IOC_REFRESH, the event is enabled
again and pmu->add() is called with PERF_EF_START.
hw_breakpoint_add() sets PERF_HES_STOPPED when PERF_EF_START is
missing, but never clears it. The flag set by pmu->stop() stays, and
perf_bp_event() drops every later hit, so a breakpoint re-armed this
way delivers only its first overflow.
Set the state from PERF_EF_START on every add, as perf_swevent_add()
does.
Fixes: 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage")
Assisted-by: LLM
Signed-off-by: Paolo Bertinetti <paolobertinetti200f4@proton.me>
Cc: stable@vger.kernel.org
---
kernel/events/hw_breakpoint.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index 789add0c185a..7a606213f33d 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -968,8 +968,7 @@ static int hw_breakpoint_event_init(struct perf_event *bp)
static int hw_breakpoint_add(struct perf_event *bp, int flags)
{
- if (!(flags & PERF_EF_START))
- bp->hw.state = PERF_HES_STOPPED;
+ bp->hw.state = (flags & PERF_EF_START) ? 0 : PERF_HES_STOPPED;
if (is_sampling_event(bp)) {
bp->hw.last_period = bp->hw.sample_period;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add()
2026-11-03 13:07 ` [PATCH 2/2] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add() Paolo Bertinetti
@ 2026-11-03 13:12 ` sashiko-bot
0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-03 13:12 UTC (permalink / raw)
To: Paolo Bertinetti; +Cc: linux-perf-users
> Since commit 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage"),
> __perf_event_overflow() stops the event with pmu->stop() and disables
> it when the PERF_EVENT_IOC_REFRESH limit is reached. When userspace
> re-arms the event with PERF_EVENT_IOC_REFRESH, the event is enabled
> again and pmu->add() is called with PERF_EF_START.
>
> hw_breakpoint_add() sets PERF_HES_STOPPED when PERF_EF_START is
> missing, but never clears it. The flag set by pmu->stop() stays, and
> perf_bp_event() drops every later hit, so a breakpoint re-armed this
> way delivers only its first overflow.
>
> Set the state from PERF_EF_START on every add, as perf_swevent_add()
> does.
>
> Fixes: 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage")
> Assisted-by: LLM
> Signed-off-by: Paolo Bertinetti <paolobertinetti200f4@proton.me>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103130732.764081-1-paolobertinetti200f4@proton.me?part=2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add()
2026-11-03 13:09 [PATCH 2/2] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add() Paolo Bertinetti
@ 2026-11-03 13:13 ` sashiko-bot
0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-03 13:13 UTC (permalink / raw)
To: Paolo Bertinetti; +Cc: linux-perf-users
> Since commit 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage"),
> __perf_event_overflow() stops the event with pmu->stop() and disables
> it when the PERF_EVENT_IOC_REFRESH limit is reached. When userspace
> re-arms the event with PERF_EVENT_IOC_REFRESH, the event is enabled
> again and pmu->add() is called with PERF_EF_START.
>
> hw_breakpoint_add() sets PERF_HES_STOPPED when PERF_EF_START is
> missing, but never clears it. The flag set by pmu->stop() stays, and
> perf_bp_event() drops every later hit, so a breakpoint re-armed this
> way delivers only its first overflow.
>
> Set the state from PERF_EF_START on every add, as perf_swevent_add()
> does.
>
> Fixes: 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage")
> Assisted-by: LLM
> Signed-off-by: Paolo Bertinetti <paolobertinetti200f4@proton.me>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103130859.764885-2-paolobertinetti200f4@proton.me?part=2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-03 13:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 13:09 [PATCH 2/2] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add() Paolo Bertinetti
2026-11-03 13:13 ` sashiko-bot
-- strict thread matches above, loose matches on Subject: below --
2026-11-03 13:07 [PATCH 0/2] perf: Fix PERF_EVENT_IOC_REFRESH for tracepoints and breakpoints Paolo Bertinetti
2026-11-03 13:07 ` [PATCH 2/2] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add() Paolo Bertinetti
2026-11-03 13:12 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.