ARM: Fix subtle race in CPU pen_release hotplug code
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 18 Dec 2010 10:53:12 +0000 (10:53 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 20 Dec 2010 15:09:13 +0000 (15:09 +0000)
commit3705ff6da538aff6dba535e2e9cbcbb9456d0d53
tree348fcec2be9d41e1839686a6c03f0b5479d7e4f9
parented3768a8d9dc2d345d4f27eb44ee1e4825056c08
ARM: Fix subtle race in CPU pen_release hotplug code

There is a subtle race in the CPU hotplug code, where a CPU which has
been offlined can online itself before being requested, which results
in things going astray on the next online/offline cycle.

What happens in the normal online/offline/online cycle is:

CPU0 CPU3
requests boot of CPU3
pen_release = 3
flush cache line
checks pen_release, reads 3
starts boot
pen_release = -1
... requests CPU3 offline ...
... dies ...
checks pen_release, reads -1
requests boot of CPU3
pen_release = 3
flush cache line
checks pen_release, reads 3
starts boot
pen_release = -1

However, as the write of -1 of pen_release is not fully flushed back to
memory, and the checking of pen_release is done with caches disabled,
this allows CPU3 the opportunity to read the old value of pen_release:

CPU0 CPU3
requests boot of CPU3
pen_release = 3
flush cache line
checks pen_release, reads 3
starts boot
pen_release = -1
... requests CPU3 offline ...
... dies ...
checks pen_release, reads 3
starts boot
pen_release = -1
requests boot of CPU3
pen_release = 3
flush cache line

Fix this by grouping the write of pen_release along with its cache line
flushing code to ensure that any update to pen_release is always pushed
out to physical memory.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-realview/platsmp.c
arch/arm/mach-s5pv310/platsmp.c
arch/arm/mach-ux500/platsmp.c
arch/arm/mach-vexpress/platsmp.c
This page took 0.030779 seconds and 5 git commands to generate.