powerpc: prep stack walkers for THREAD_INFO_IN_TASK
authorChristophe Leroy <christophe.leroy@c-s.fr>
Thu, 31 Jan 2019 10:08:52 +0000 (10:08 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 23 Feb 2019 11:31:40 +0000 (22:31 +1100)
commit018cce33c5e62dda265df8ae0ddf7f3a3357ad1f
tree2e441439ad12b6bbf76c0e9d00bc6f0a59a24e0d
parent054860897cd35a4e9cec953ae955b429e31e74f7
powerpc: prep stack walkers for THREAD_INFO_IN_TASK

[text copied from commit 9bbd4c56b0b6
("arm64: prep stack walkers for THREAD_INFO_IN_TASK")]

When CONFIG_THREAD_INFO_IN_TASK is selected, task stacks may be freed
before a task is destroyed. To account for this, the stacks are
refcounted, and when manipulating the stack of another task, it is
necessary to get/put the stack to ensure it isn't freed and/or re-used
while we do so.

This patch reworks the powerpc stack walking code to account for this.
When CONFIG_THREAD_INFO_IN_TASK is not selected these perform no
refcounting, and this should only be a structural change that does not
affect behaviour.

Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Move try_get_task_stack() below tsk == NULL check in show_stack()]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/process.c
arch/powerpc/kernel/stacktrace.c