Revision 0933840acf7b65d6d30a5b6089d882afea57aca3 authored by Jiri Olsa on 20 October 2016, 11:10:11 UTC, committed by Ingo Molnar on 28 October 2016, 09:06:25 UTC
CAI Qian reported a crash in the PMU uncore device removal code,
enabled by the CONFIG_DEBUG_TEST_DRIVER_REMOVE=y option:

  https://marc.info/?l=linux-kernel&m=147688837328451

The reason for the crash is that perf_pmu_unregister() tries to remove
a PMU device which is not added at this point. We add PMU devices
only after pmu_bus is registered, which happens in the
perf_event_sysfs_init() call and sets the 'pmu_bus_running' flag.

The fix is to get the 'pmu_bus_running' flag state at the point
the PMU is taken out of the PMU list and remove the device
later only if it's set.

Reported-by: CAI Qian <caiqian@redhat.com>
Tested-by: CAI Qian <caiqian@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20161020111011.GA13361@krava
Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 889882b
History
File Mode Size
Kconfig -rw-r--r-- 17.2 KB
Makefile -rw-r--r-- 2.2 KB
ad7266.c -rw-r--r-- 13.2 KB
ad7291.c -rw-r--r-- 13.6 KB
ad7298.c -rw-r--r-- 9.1 KB
ad7476.c -rw-r--r-- 7.2 KB
ad7791.c -rw-r--r-- 11.4 KB
ad7793.c -rw-r--r-- 24.8 KB
ad7887.c -rw-r--r-- 8.7 KB
ad7923.c -rw-r--r-- 9.2 KB
ad799x.c -rw-r--r-- 21.1 KB
ad_sigma_delta.c -rw-r--r-- 13.0 KB
at91-sama5d2_adc.c -rw-r--r-- 14.6 KB
at91_adc.c -rw-r--r-- 39.7 KB
axp288_adc.c -rw-r--r-- 6.6 KB
bcm_iproc_adc.c -rw-r--r-- 18.0 KB
berlin2-adc.c -rw-r--r-- 10.5 KB
cc10001_adc.c -rw-r--r-- 11.2 KB
da9150-gpadc.c -rw-r--r-- 10.5 KB
exynos_adc.c -rw-r--r-- 24.1 KB
fsl-imx25-gcq.c -rw-r--r-- 10.1 KB
hi8435.c -rw-r--r-- 13.1 KB
imx7d_adc.c -rw-r--r-- 15.9 KB
ina2xx-adc.c -rw-r--r-- 18.4 KB
lp8788_adc.c -rw-r--r-- 5.9 KB
lpc18xx_adc.c -rw-r--r-- 5.5 KB
ltc2485.c -rw-r--r-- 3.6 KB
max1027.c -rw-r--r-- 12.4 KB
max1363.c -rw-r--r-- 49.1 KB
mcp320x.c -rw-r--r-- 10.7 KB
mcp3422.c -rw-r--r-- 10.3 KB
men_z188_adc.c -rw-r--r-- 3.8 KB
mt6577_auxadc.c -rw-r--r-- 7.6 KB
mxs-lradc.c -rw-r--r-- 47.8 KB
nau7802.c -rw-r--r-- 14.5 KB
palmas_gpadc.c -rw-r--r-- 23.0 KB
qcom-spmi-iadc.c -rw-r--r-- 13.6 KB
qcom-spmi-vadc.c -rw-r--r-- 24.7 KB
rockchip_saradc.c -rw-r--r-- 10.0 KB
stx104.c -rw-r--r-- 9.5 KB
ti-adc081c.c -rw-r--r-- 6.3 KB
ti-adc0832.c -rw-r--r-- 6.6 KB
ti-adc12138.c -rw-r--r-- 12.6 KB
ti-adc128s052.c -rw-r--r-- 4.9 KB
ti-adc161s626.c -rw-r--r-- 5.4 KB
ti-ads1015.c -rw-r--r-- 17.4 KB
ti-ads8688.c -rw-r--r-- 11.6 KB
ti_am335x_adc.c -rw-r--r-- 15.1 KB
twl4030-madc.c -rw-r--r-- 24.8 KB
twl6030-gpadc.c -rw-r--r-- 25.0 KB
vf610_adc.c -rw-r--r-- 24.1 KB
viperboard_adc.c -rw-r--r-- 3.7 KB
xilinx-xadc-core.c -rw-r--r-- 33.4 KB
xilinx-xadc-events.c -rw-r--r-- 5.8 KB
xilinx-xadc.h -rw-r--r-- 5.5 KB

back to top