Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1504522
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [4.9-rc1+] intel_uncore builtin + CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic |
| Date | 2016-10-20 07:50 +0200 |
| Message-ID | <sueoN-3mL-1@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <sqKQi-2WG-19@gated-at.bofh.it> <sqMyJ-412-15@gated-at.bofh.it> <sqNl8-4wk-11@gated-at.bofh.it> <su0lQ-2yX-47@gated-at.bofh.it> <su4IO-5Ai-39@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Oct 19, 2016 at 09:19:43PM +0200, Jiri Olsa wrote:
> I think the reason here is that presume pmu devices are always added,
> but we add them only if pmu_bus_running (in perf_event_sysfs_init)
> is set which might happen after uncore initcall
>
> attached patch fixes the issue for me
Right, we never expected to be unloaded before userspace runs.
Strictly speaking we should only read pmu_bus_running while holding
pmus_lock, that way we're serialized against perf_event_sysfs_init()
flipping it while we're being removed etc..
With the current setup the introduced race is harmless, but who knows
what other crazy these device people will come up with ;-)
> ---
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index c6e47e97b33f..c2099b799d16 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -8871,8 +8871,10 @@ void perf_pmu_unregister(struct pmu *pmu)
> idr_remove(&pmu_idr, pmu->type);
> if (pmu->nr_addr_filters)
> device_remove_file(pmu->dev, &dev_attr_nr_addr_filters);
> - device_del(pmu->dev);
> - put_device(pmu->dev);
> + if (pmu_bus_running) {
> + device_del(pmu->dev);
> + put_device(pmu->dev);
> + }
> free_pmu_context(pmu);
> }
> EXPORT_SYMBOL_GPL(perf_pmu_unregister);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[4.9-rc1+] intel_uncore builtin + CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic CAI Qian <caiqian@redhat.com> - 2016-10-19 16:50 +0200
Re: [4.9-rc1+] intel_uncore builtin + CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic Jiri Olsa <jolsa@redhat.com> - 2016-10-19 21:30 +0200
Re: [4.9-rc1+] intel_uncore builtin + CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic CAI Qian <caiqian@redhat.com> - 2016-10-19 22:20 +0200
Re: [4.9-rc1+] intel_uncore builtin + CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic Peter Zijlstra <peterz@infradead.org> - 2016-10-20 07:50 +0200
Re: [4.9-rc1+] intel_uncore builtin + CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic Jiri Olsa <jolsa@redhat.com> - 2016-10-20 11:00 +0200
Re: [4.9-rc1+] intel_uncore builtin + CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic Peter Zijlstra <peterz@infradead.org> - 2016-10-20 11:10 +0200
Re: [4.9-rc1+] intel_uncore builtin + CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic Jiri Olsa <jolsa@redhat.com> - 2016-10-20 11:50 +0200
[PATCH] perf: Protect pmu device removal with pmu_bus_running check CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic Jiri Olsa <jolsa@redhat.com> - 2016-10-20 13:20 +0200
Re: [PATCH] perf: Protect pmu device removal with pmu_bus_running check CONFIG_DEBUG_TEST_DRIVER_REMOVE kernel panic CAI Qian <caiqian@redhat.com> - 2016-10-20 16:40 +0200
csiph-web