]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc: Don't search for paca in freed memory
authorMilton Miller <miltonm@bga.com>
Tue, 10 May 2011 19:28:37 +0000 (19:28 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 19 May 2011 04:30:43 +0000 (14:30 +1000)
commitfeb891713837277edd3592ddafd859bb1f21aa9c
treefffb813155bbdd29ab6703fa8586d35ea1dba7c8
parent65db430d4f7ec27a8f6af2c15527033a998a23fe
powerpc: Don't search for paca in freed memory

Starting with 0ba00dd5f05fef8b3b1ef2de853fcc708ebb140f (powerpc:
Dynamically allocate pacas) we free the memory for pacas beyond
cpu_possible, but we failed to update the loop the secondary cpus use
to find their paca.  If the system has running cpu threads for which
the kernel did not allocate a paca for they will search the memory that
was freed.  For instance this could happen when the device tree for
a kdump kernel was not updated after a cpu hotplug, or the kernel is
running with more cpus than the kernel was configured.

Since 7896e4f4dd4ce85e11edf1dc3946d86ce0a84d6e (powerpc: Set nr_cpu_ids
early and use it to free PACAs) we set nr_cpu_ids before telling the
cpus to advance, so use that to limit the search.

We can't reference nr_cpu_ids without CONFIG_SMP because it is defined
as 1 instead of a memory location, but any extra threads should be sent
to kexec_wait in that case anyways, so make that explicit and remove
the search loop for UP.

Note to stable: The fix also requires
7896e4f4dd4ce85e11edf1dc3946d86ce0a84d6e (powerpc: Set
nr_cpu_ids early and use it to free PACAs) to function.  Also
856548164958aed43b349cbd943ff7b55242232c (Properly handshake CPUs going
out of boot spin loop) affects the second chunk, specifically the branch
target was 3b before and is 4b after that patch, and there was a blank
line before the #ifdef CONFIG_SMP that was removed

Cc: <stable@kernel.org> # .34.x: 7896e4f4dd powerpc: Set nr_cpu_ids early
Cc: <stable@kernel.org> # .34.x
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/head_64.S