linux/arch/arm/mach-imx
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
..
devices ARM: imx: remove platform-mxc_rnga 2016-08-16 13:59:15 +08:00
3ds_debugboard.c ARM: imx: use endian-safe readl/readw/writel/writew 2016-02-02 13:24:17 +08:00
3ds_debugboard.h
anatop.c ARM: imx: Add msl code support for imx6qp 2016-02-14 11:07:17 +08:00
avic.c ARM: i.MX: Fix FIQ interrupt handling for TZIC 2016-06-21 15:57:05 +08:00
board-mx31lilly.h
board-mx31lite.h
board-mx31moboard.h
common.h ARM: clk: imx31: properly init clocks for machines with DT 2016-11-01 16:44:46 +08:00
cpu-imx5.c ARM: imx: remove last call to cpu_is_mx5* 2016-06-28 10:26:42 +08:00
cpu-imx25.c
cpu-imx27.c ARM: imx: use endian-safe readl/readw/writel/writew 2016-02-02 13:24:17 +08:00
cpu-imx31.c ARM: imx: use endian-safe readl/readw/writel/writew 2016-02-02 13:24:17 +08:00
cpu-imx35.c ARM: imx: use endian-safe readl/readw/writel/writew 2016-02-02 13:24:17 +08:00
cpu.c ARM: imx: remove cpu_is_mx*() 2016-06-28 10:26:45 +08:00
cpuidle-imx5.c
cpuidle-imx6q.c ARM: imx: rename imx6q_set_int_mem_clk_lpm() function 2016-08-29 22:39:27 +08:00
cpuidle-imx6sl.c
cpuidle-imx6sx.c ARM: imx: add cpuidle support for i.mx6ul 2016-08-29 22:39:28 +08:00
cpuidle.h
crmregs-imx3.h
devices-imx21.h
devices-imx27.h
devices-imx31.h
devices-imx35.h
ehci-imx27.c
ehci-imx31.c
ehci-imx35.c
ehci.h
epit.c ARM: imx: use endian-safe readl/readw/writel/writew 2016-02-02 13:24:17 +08:00
gpc.c Merge branch 'pm-domains' 2016-12-12 20:43:19 +01:00
hardware.h ARM: imx: (trivial) fix typo and grammar 2016-09-05 10:36:19 +08:00
headsmp.S ARM: imx: enable big endian mode 2016-02-02 13:31:19 +08:00
hotplug.c
iim.h
imx27-dt.c ARM: imx: rework mx27_pm_init() call 2016-06-28 10:26:40 +08:00
imx31-dt.c ARM: clk: imx31: properly init clocks for machines with DT 2016-11-01 16:44:46 +08:00
imx35-dt.c ARM: i.MX: Do not explicitly call l2x0_of_init() 2016-06-21 20:40:47 +08:00
iomux-imx31.c ARM: imx: use endian-safe readl/readw/writel/writew 2016-02-02 13:24:17 +08:00
iomux-mx2x.h
iomux-mx3.h ARM: i.MX31 iomux: remove duplicates with alternate name 2016-08-08 21:41:17 +08:00
iomux-mx21.h
iomux-mx27.h
iomux-mx35.h
iomux-v1.c ARM: imx: use endian-safe readl/readw/writel/writew 2016-02-02 13:24:17 +08:00
iomux-v1.h
iomux-v3.c ARM: imx: use endian-safe readl/readw/writel/writew 2016-02-02 13:24:17 +08:00
iomux-v3.h
irq-common.c ARM: i.MX: Fix FIQ interrupt handling for TZIC 2016-06-21 15:57:05 +08:00
irq-common.h
Kconfig ARM: imx: Drop errata 769419 for Vybrid 2016-11-14 14:57:47 +08:00
mach-armadillo5x0.c ARM: imx legacy: armadillo5x0: move peripheral initialization to .init_late 2016-09-20 22:35:08 +08:00
mach-bug.c
mach-imx1.c ARM: i.MX: Move SOC_IMX1 into 'Device tree only' 2016-08-09 22:47:29 +08:00
mach-imx6q.c ARM: imx: mach-imx6q: Fix the PHY ID mask for AR8031 2016-10-24 21:26:01 +08:00
mach-imx6sl.c ARM: SoC cleanups for v4.8 2016-08-01 18:21:13 -04:00
mach-imx6sx.c ARM: SoC cleanups for v4.8 2016-08-01 18:21:13 -04:00
mach-imx6ul.c ARM: imx: mach-imx6ul: add imx6ull support 2016-11-15 08:58:43 +08:00
mach-imx7d.c ARM: SoC platform updates for v4.8 2016-08-01 18:27:08 -04:00
mach-imx25.c ARM: mx25: Add basic suspend/resume support 2016-02-14 11:24:18 +08:00
mach-imx27_visstrim_m10.c ARM: imx legacy: imx27-visstrim-m10: move peripheral initialization to .init_late 2016-09-20 22:35:17 +08:00
mach-imx50.c ARM: imx: Use IRQCHIP_DECLARE for TZIC 2016-06-12 19:47:18 +08:00
mach-imx51.c ARM: SoC platform updates for v4.8 2016-08-01 18:27:08 -04:00
mach-imx53.c ARM: SoC cleanups for v4.8 2016-08-01 18:21:13 -04:00
mach-kzm_arm11_01.c ARM: SoC platform updates for v4.9 2016-10-07 21:18:42 -07:00
mach-ls1021a.c
mach-mx21ads.c ARM: imx legacy: mx21ads: move peripheral initialization to .init_late 2016-09-20 22:39:06 +08:00
mach-mx27_3ds.c ARM: imx legacy: mx27-3ds: move peripheral initialization to .init_late 2016-09-20 22:35:20 +08:00
mach-mx27ads.c ARM: imx legacy: mx27ads: move peripheral initialization to .init_late 2016-09-20 22:39:07 +08:00
mach-mx31_3ds.c ARM: imx legacy: mx31-3ds: move peripheral initialization to .init_late 2016-09-20 22:35:00 +08:00
mach-mx31ads.c ARM: imx legacy: mx31ads: move peripheral initialization to .init_late 2016-09-20 22:34:51 +08:00
mach-mx31lilly.c ARM: imx legacy: mx31lilly: move peripheral initialization to .init_late 2016-09-20 22:34:54 +08:00
mach-mx31lite.c ARM: imx legacy: mx31lite: move peripheral initialization to .init_late 2016-09-20 22:34:47 +08:00
mach-mx31moboard.c ARM: imx legacy: mx31moboard: move peripheral initialization to .init_late 2016-09-20 22:35:11 +08:00
mach-mx35_3ds.c ARM: imx legacy: mx35-3ds: move peripheral initialization to .init_late 2016-09-20 22:35:23 +08:00
mach-pca100.c ARM: imx legacy: pca100: move peripheral initialization to .init_late 2016-09-20 22:39:07 +08:00
mach-pcm037_eet.c
mach-pcm037.c ARM: SoC platform updates for v4.9 2016-10-07 21:18:42 -07:00
mach-pcm043.c ARM: imx legacy: pcm043: move peripheral initialization to .init_late 2016-09-20 22:39:06 +08:00
mach-qong.c ARM: imx legacy: qong: move peripheral initialization to .init_late 2016-09-20 22:35:04 +08:00
mach-vf610.c
mach-vpr200.c ARM: imx legacy: vpr200: move peripheral initialization to .init_late 2016-09-20 22:35:14 +08:00
Makefile Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
Makefile.boot
mm-imx3.c ARM: imx: deconstruct mx3_idle 2016-06-28 10:26:37 +08:00
mm-imx21.c
mm-imx27.c ARM: imx: rework mx27_pm_init() call 2016-06-28 10:26:40 +08:00
mmdc.c ARM/imx/mmcd: Fix broken cpu hotplug handling 2016-12-25 10:47:40 +01:00
mx2x.h
mx3x.h
mx21.h
mx27.h
mx31.h
mx31lilly-db.c ARM: imx legacy: mx31lilly: move peripheral initialization to .init_late 2016-09-20 22:34:54 +08:00
mx31lite-db.c ARM: imx legacy: mx31lite: move peripheral initialization to .init_late 2016-09-20 22:34:47 +08:00
mx31moboard-devboard.c
mx31moboard-marxbot.c
mx31moboard-smartbot.c
mx35.h
mxc.h ARM: imx: remove cpu_is_mx*() 2016-06-28 10:26:45 +08:00
pcm037.h
platsmp.c
pm-imx5.c ARM: imx: use endian-safe readl/readw/writel/writew 2016-02-02 13:24:17 +08:00
pm-imx6.c ARM: SoC platform updates for v4.9 2016-10-07 21:18:42 -07:00
pm-imx25.c ARM: mx25: Add basic suspend/resume support 2016-02-14 11:24:18 +08:00
pm-imx27.c ARM: imx: rework mx27_pm_init() call 2016-06-28 10:26:40 +08:00
src.c ARM: imx: Make reset_control_ops const 2016-02-29 10:37:44 +08:00
ssi-fiq-ksym.c Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
ssi-fiq.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
suspend-imx6.S
suspend-imx53.S
system.c ARM: imx: remove cpu_is_mx1 check 2016-06-28 10:26:20 +08:00
tzic.c ARM: SoC platform updates for v4.8 2016-08-01 18:27:08 -04:00
ulpi.h