Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1640407
| From | Chris Wilson <chris@chris-wilson.co.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] perf/core: Avoid removing shared pmu_context on unregister |
| Date | 2017-05-12 13:50 +0200 |
| Message-ID | <tGhf4-3Vf-9@gated-at.bofh.it> (permalink) |
| References | <tGgj0-3aJ-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, May 12, 2017 at 11:40:32AM +0100, Chris Wilson wrote:
> In commit 1fd7e4169954 ("perf/core: Remove perf_cpu_context::unique_pmu"),
> the search for another user of the pmu_cpu_context was removed, and so
> we unconditionally free it during perf_pmu_unregister. This leads to
> random corruption later and a BUG at mm/percpu.c:689.
>
> Fixes: 1fd7e4169954 ("perf/core: Remove perf_cpu_context::unique_pmu")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: David Carrillo-Cisneros <davidcc@google.com>
> Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: <stable@vger.kernel.org> # v4.11+
> ---
> kernel/events/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index aaefaa27e1a6..e62b6207925c 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -9005,7 +9005,8 @@ void perf_pmu_unregister(struct pmu *pmu)
> device_del(pmu->dev);
> put_device(pmu->dev);
> }
> - free_pmu_context(pmu);
> + if (!find_pmu_context(pmu->task_ctx_nr))
Bleh, that find should be under some guard, such as the mutex we held
ealier.
> + free_pmu_context(pmu);
> }
> EXPORT_SYMBOL_GPL(perf_pmu_unregister);
>
> --
> 2.11.0
>
--
Chris Wilson, Intel Open Source Technology Centre
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] perf/core: Avoid removing shared pmu_context on unregister Chris Wilson <chris@chris-wilson.co.uk> - 2017-05-12 12:50 +0200
[PATCH v2] perf/core: Avoid removing shared pmu_context on unregister Chris Wilson <chris@chris-wilson.co.uk> - 2017-05-12 13:50 +0200
Re: [PATCH v2] perf/core: Avoid removing shared pmu_context on unregister David Carrillo-Cisneros <davidcc@google.com> - 2017-05-12 22:50 +0200
Re: [PATCH v2] perf/core: Avoid removing shared pmu_context on unregister David Carrillo-Cisneros <davidcc@google.com> - 2017-05-12 22:50 +0200
Re: [PATCH v2] perf/core: Avoid removing shared pmu_context on unregister Chris Wilson <chris@chris-wilson.co.uk> - 2017-05-12 23:00 +0200
Re: [PATCH v2] perf/core: Avoid removing shared pmu_context on unregister David Carrillo-Cisneros <davidcc@google.com> - 2017-05-12 23:30 +0200
Re: [PATCH] perf/core: Avoid removing shared pmu_context on unregister Chris Wilson <chris@chris-wilson.co.uk> - 2017-05-12 13:50 +0200
csiph-web