Skip to content

perf: Fix warning from concurrent read/write of perf_event_pmu_context

James Clark linux-perf-users lkml 1 version Applied

Status from this message: The following commit has been merged into the perf/urgent branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/1perf: Fix warning from concurrent read/write of perf_event_pmu_contextkernel/events/core.c+20 -224 replies

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by.

PatchRavi Bangoria
1/1R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/1] perf: Fix warning from concurrent read/write of perf_event_pmu_context

Hi Peter and Ravi,

I came across this issue, and I also found there was a syzbot report for it and linked it on the commit. I have one question about the fix, where I had to remove the if (epc->ctx) from put_pmu_ctx(). I assume this was added for a reason, but I can't see where it's not ever set? Unless it's removed, the function got a lot more complicated to take the lock before the reference decrement.

Also now I think the atomic type for epc->refcount is redundant, because everything is always done with the lock held. Except for get_pmu_ctx(), but that is just a read for a warning. So unless you think the scope of my extra locking can be reduced, I would probably also send a commit to remove that as well.

Thanks
James

James Clark (1):
perf: Fix warning from concurrent read/write of perf_event_pmu_context

 kernel/events/core.c | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

base-commit: 5912e15f25d6d584f3b8449e0b6a244a0f4f0903

Signature · 1 line
2.39.1