Messages in this thread | | | Date | Mon, 10 Oct 2022 22:52:08 +0200 | From | Marco Elver <> | Subject | Re: [PATCH] perf: Fix missing SIGTRAPs |
| |
On Sat, Oct 08, 2022 at 02:41PM +0200, Peter Zijlstra wrote: > On Sat, Oct 08, 2022 at 10:41:28AM +0200, Marco Elver wrote: > > The below patch to the sigtrap_threads test can repro the issue (when > > run lots of them concurrently again). It also illustrates the original > > problem we're trying to solve, where the event never gets rearmed again > > and the test times out (doesn't happen with the almost-working fix). > > Excellent, that helps. Also, I'm an idiot ;-) > > The below seems to fix it for me. > > --- > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -3441,7 +3448,8 @@ static void perf_event_context_sched_out > perf_pmu_disable(pmu); > > /* PMIs are disabled; ctx->nr_pending is stable. */ > - if (local_read(&ctx->nr_pending)) { > + if (local_read(&ctx->nr_pending) || > + local_read(&next_ctx->nr_pending)) { > /* > * Must not swap out ctx when there's pending > * events that rely on the ctx->task relation.
Yup, that fixes it.
Can you send a v2 with all the fixups? Just to make sure I've tested the right thing.
I'll also send the patch for the selftest addition once I gave it a good spin.
Thanks, -- Marco
| |