linux_dsm_epyc7002/arch
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
..
alpha Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2016-12-14 14:09:48 -08:00
arc 2nd round of ARC udpates for 4.10rc1 2016-12-23 10:22:47 -08:00
arm ARM/imx/mmcd: Fix broken cpu hotplug handling 2016-12-25 10:47:40 +01:00
arm64 More ACPI updates for v4.10-rc1 2016-12-22 10:19:32 -08:00
avr32 arch/avr32: add option to skip sync on DMA map 2016-12-14 16:04:07 -08:00
blackfin Merge branch 'akpm' (patches from Andrew) 2016-12-14 17:25:18 -08:00
c6x arch/c6x: add option to skip sync on DMA map and unmap 2016-12-14 16:04:07 -08:00
cris Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2016-12-14 14:09:48 -08:00
frv arch/frv: add option to skip sync on DMA map 2016-12-14 16:04:07 -08:00
h8300 locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
hexagon arch/hexagon: Add option to skip DMA sync as a part of mapping 2016-12-14 16:04:07 -08:00
ia64 Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-18 11:12:53 -08:00
m32r m32r: fix build warning 2016-12-12 18:55:06 -08:00
m68k arch/m68k: add option to skip DMA sync as a part of mapping 2016-12-14 16:04:07 -08:00
metag arch/metag: add option to skip DMA sync as a part of map and unmap 2016-12-14 16:04:07 -08:00
microblaze Microblaze patches for 4.10-rc1 2016-12-20 15:16:00 -08:00
mips RTC for 4.10 2016-12-18 18:18:03 -08:00
mn10300 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
nios2 nios2 update for v4.10-rc1 2016-12-16 09:33:16 -08:00
openrisc arch/openrisc: add option to skip DMA sync as a part of mapping 2016-12-14 16:04:07 -08:00
parisc Merge branch 'parisc-4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2016-12-21 10:47:13 -08:00
powerpc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-12-20 15:48:34 -08:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2016-12-16 09:05:25 -08:00
score locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
sh Merge branch 'akpm' (patches from Andrew) 2016-12-14 17:25:18 -08:00
sparc sparc: implement watchdog_nmi_enable and watchdog_nmi_disable 2016-12-14 16:04:08 -08:00
tile Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2016-12-17 17:05:49 -08:00
um Merge branch 'for-linus-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml 2016-12-16 09:35:03 -08:00
unicore32 locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
x86 Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-23 16:54:46 -08:00
xtensa Xtensa improvements for 4.10: 2016-12-20 14:48:53 -08:00
.gitignore
Kconfig powerpc: ima: get the kexec buffer passed by the previous kernel 2016-12-20 09:48:40 -08:00