parisc: make interrupt and interruption stack allocation reentrant
authorJohn David Anglin <dave.anglin@bell.net>
Mon, 20 May 2013 16:42:53 +0000 (16:42 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jun 2013 17:38:42 +0000 (10:38 -0700)
commitec62e8914c5994ab7c7873b6522691b70458bfa1
tree1270107aacd56801d3fab37deb5b2abf39ef8cf5
parent495a903504ed9a9bcfe85b60fd33d9df97f7df4c
parisc: make interrupt and interruption stack allocation reentrant

commit b63a2bbc0b9b106a93e11952ab057e2408f2eb02 upstream.

The get_stack_use_cr30 and get_stack_use_r30 macros allocate a stack
frame for external interrupts and interruptions requiring a stack frame.
They are currently not reentrant in that they save register context
before the stack is set or adjusted.

I have observed a number of system crashes where there was clear
evidence of stack corruption during interrupt processing, and as a
result register corruption. Some interruptions can still occur during
interruption processing, however external interrupts are disabled and
data TLB misses don't occur for absolute accesses. So, it's not entirely
clear what triggers this issue. Also, if an interruption occurs when
Q=0, it is generally not possible to recover as the shadowed registers
are not copied.

The attached patch reworks the get_stack_use_cr30 and get_stack_use_r30
macros to allocate stack before doing register saves. The new code is a
couple of instructions shorter than the old implementation. Thus, it's
an improvement even if it doesn't fully resolve the stack corruption
issue. Based on limited testing, it improves SMP system stability.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/parisc/include/asm/assembly.h
arch/parisc/kernel/entry.S