linux/arch/arm
Thomas Gleixner a051f220d6 ARM/imx/mmcd: Fix broken cpu hotplug handling
The cpu hotplug support of this perf driver is broken in several ways:

1) It adds a instance before setting up the state.

2) The state for the instance is different from the state of the
   callback. It's just a randomly chosen state.

3) The instance registration is not error checked so nobody noticed that
   the call can never succeed.

4) The state for the multi install callbacks is chosen randomly and
   overwrites existing state. This is now prevented by the core code so the
   call is guaranteed to fail.

5) The error exit path in the init function leaves the instance registered
   and then frees the memory which contains the enqueued hlist node.

6) The remove function is removing the state and not the instance.

Fix it by:

- Setting up the state before adding instances. Use a dynamically allocated
  state for it.

- Installing instances after the state has been set up

- Removing the instance in the error path before freeing memory

- Removing the instance not the state in the driver remove callback

While at is use raw_cpu_processor_id(), because cpu_processor_id() cannot
be used in preemptible context, and set the driver data after successful
registration of the pmu.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Frank Li <frank.li@nxp.com>
Cc: Zhengyu Shen <zhengyu.shen@nxp.com>
Link: http://lkml.kernel.org/r/20161221192111.596204211@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-12-25 10:47:40 +01:00
..
boot ARM: dts: hix5hd2: don't change the existing compatible string 2016-12-20 14:12:29 -05:00
common arch/arm: add option to skip sync on DMA map and unmap 2016-12-14 16:04:07 -08:00
configs ARM: SoC defconfig updates for v4.10 2016-12-15 15:41:04 -08:00
crypto crypto: arm/crc32 - accelerated support based on x86 SSE implementation 2016-12-07 20:01:24 +08:00
firmware
include Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2016-12-15 16:06:15 -08:00
kernel Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2016-12-15 16:06:15 -08:00
kvm ARM: KVM: Support vGICv3 ITS 2016-11-14 10:32:54 +00:00
lib Merge branches 'clkdev', 'fixes', 'misc' and 'sa1100-base' into for-linus 2016-12-14 11:13:46 +00:00
mach-alpine
mach-artpec ARM: ARTPEC-6: add select MFD_SYSCON to MACH_ARTPEC6 2016-11-26 00:06:34 +01:00
mach-asm9260
mach-aspeed
mach-at91 ARM: stop *MIGHT_HAVE_PCI* config from being selected redundantly 2016-09-21 22:45:05 +02:00
mach-axxia ARM: select PCI_DOMAINS config from ARCH_MULTIPLATFORM 2016-09-21 22:45:13 +02:00
mach-bcm ARM: BCM5301X: Add back handler ignoring external imprecise aborts 2016-11-16 12:39:05 -08:00
mach-berlin
mach-clps711x ARM: clps711x: remove extraneous files 2016-09-02 18:15:00 +02:00
mach-cns3xxx ARM: select PCI_DOMAINS config from ARCH_MULTIPLATFORM 2016-09-21 22:45:13 +02:00
mach-davinci ARM: SoC platform updates for v4.10 2016-12-15 15:39:02 -08:00
mach-digicolor
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx
mach-exynos ARM: SoC platform updates for v4.9 2016-10-07 21:18:42 -07:00
mach-footbridge
mach-gemini
mach-highbank
mach-hisi
mach-imx ARM/imx/mmcd: Fix broken cpu hotplug handling 2016-12-25 10:47:40 +01:00
mach-integrator ARM: SoC platform updates for v4.10 2016-12-15 15:39:02 -08:00
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx ARM: ixp4xx: drop duplicate header gpio.h 2016-11-26 00:21:50 +01:00
mach-keystone ARM: select PCI_DOMAINS config from ARCH_MULTIPLATFORM 2016-09-21 22:45:13 +02:00
mach-ks8695
mach-lpc18xx
mach-lpc32xx ARM: SoC platform updates for v4.10 2016-12-15 15:39:02 -08:00
mach-mediatek ARM: mediatek: clean up mach-mediatek/Makefile 2016-10-31 15:26:23 -06:00
mach-meson
mach-mmp
mach-moxart
mach-mv78xx0 ARM: mv78xx0: simplify ethernet device creation 2016-09-14 16:35:37 +02:00
mach-mvebu mvebu fixes for 4.8 (part 3) 2016-10-17 13:44:03 -07:00
mach-mxs
mach-netx
mach-nomadik ARM: nomadik: select MFD_SYSCON 2016-09-09 23:15:50 +02:00
mach-nspire
mach-omap1 ARM: OMAP2+: Remove legacy mux code 2016-11-10 12:42:49 -07:00
mach-omap2 ARM: SoC platform updates for v4.10 2016-12-15 15:39:02 -08:00
mach-orion5x ARM: orion5x: remove legacy support of ls-chl 2016-11-19 09:14:28 +01:00
mach-oxnas ARM: oxnas: Add OX820 config and makefile entry 2016-11-23 09:53:55 +01:00
mach-picoxcell
mach-prima2
mach-pxa ARM: SoC platform updates for v4.10 2016-12-15 15:39:02 -08:00
mach-qcom
mach-realview This deletes the realview boardfiles, consolidates a bit 2016-09-02 18:12:09 +02:00
mach-rockchip
mach-rpc
mach-s3c24xx mtd: s3c2410: make ecc mode configurable via platform data 2016-11-07 14:48:35 +01:00
mach-s3c64xx MTD updates for v4.10-rc1: 2016-12-17 16:41:10 -08:00
mach-s5pv210
mach-sa1100 Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2016-12-15 16:06:15 -08:00
mach-shmobile ARM: SoC driver updates for v4.10 2016-12-15 16:03:25 -08:00
mach-socfpga ARM: socfpga: fix spelling mistake in error message 2016-11-15 08:52:17 -06:00
mach-spear ARM: spear: Fix error handling 2016-11-07 19:19:35 -08:00
mach-sti reset: sti: Remove STiH415/6 reset support 2016-10-20 11:52:08 +02:00
mach-stm32 ARM: mach-stm32: Add a new SOC - STM32F746 2016-11-15 12:02:33 +01:00
mach-sunxi ARM: sunxi: Support the Nextthing GR8 2016-09-08 14:32:23 +02:00
mach-tango
mach-tegra
mach-u300
mach-uniphier ARM: uniphier: select ARCH_HAS_RESET_CONTROLLER 2016-10-22 18:25:35 +09:00
mach-ux500
mach-versatile ARM: stop *MIGHT_HAVE_PCI* config from being selected redundantly 2016-09-21 22:45:05 +02:00
mach-vexpress ARM: vexpress: refine MCPM smp operations override criteria 2016-10-17 14:27:54 +01:00
mach-vt8500
mach-w90x900
mach-zx ARM: zx: Fix error handling 2016-11-07 19:19:35 -08:00
mach-zynq ARM: zynq: Reserve correct amount of non-DMA RAM 2016-11-14 16:07:58 +01:00
mm Merge branches 'clkdev', 'fixes', 'misc' and 'sa1100-base' into for-linus 2016-12-14 11:13:46 +00:00
net
nwfpe
oprofile
plat-iop
plat-omap ARM: OMAP2+: Remove legacy mux code 2016-11-10 12:42:49 -07:00
plat-orion ARM/orion/gpio: Replace three seq_printf() calls by seq_puts() in orion_gpio_dbg_show() 2016-10-17 17:40:24 +02:00
plat-pxa
plat-samsung virtio, vhost: new device, fixes, speedups 2016-12-15 18:13:41 -08:00
plat-versatile
probes
tools Merge branch 'syscalls' into for-linus 2016-12-14 11:14:00 +00:00
vdso
vfp ARM: 8629/1: vfp: properly tag assembly function declarations in C code 2016-11-22 11:45:09 +00:00
xen xen: features and fixes for 4.10 rc0 2016-12-13 16:07:55 -08:00
Kconfig ARM: SoC platform updates for v4.10 2016-12-15 15:39:02 -08:00
Kconfig-nommu
Kconfig.debug Renesas ARM Based SoC Updates for v4.9 2016-09-15 00:27:27 +02:00
Makefile Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2016-12-15 16:06:15 -08:00