linux/arch/arm64
Will Deacon 7596abf2e5 arm64: irq: fix walking from irq stack to task stack
Running with CONFIG_DEBUG_SPINLOCK=y can trigger a BUG with the new IRQ
stack code:

  BUG: spinlock lockup suspected on CPU#1

This is due to the IRQ_STACK_TO_TASK_STACK macro incorrectly retrieving
the task stack pointer stashed at the top of the IRQ stack.

Sayeth James:

| Yup, this is what is happening. Its an off-by-one due to broken
| thinking about how the stack works. My broken thinking was:
|
| >   top ------------
| >       | dummy_lr | <- irq_stack_ptr
| >       ------------
| >       |   x29    |
| >       ------------
| >       |   x19    | <- irq_stack_ptr - 0x10
| >       ------------
| >       |   xzr    |
| >       ------------
|
| But the stack-pointer is decreased before use. So it actually looks
| like this:
|
| >       ------------
| >       |          |  <- irq_stack_ptr
| >   top ------------
| >       | dummy_lr |
| >       ------------
| >       |   x29    | <- irq_stack_ptr - 0x10
| >       ------------
| >       |   x19    |
| >       ------------
| >       |   xzr    | <- irq_stack_ptr - 0x20
| >       ------------
|
| The value being used as the original stack is x29, which in all the
| tests is sp but without the current frames data, hence there are no
| missing frames in the output.
|
| Jungseok Lee picked it up with a 32bit user space because aarch32
| can't use x29, so it remains 0 forever. The fix he posted is correct.

This patch fixes the macro and adds some of this wisdom to a comment,
so that the layout of the IRQ stack is well understood.

Cc: James Morse <james.morse@arm.com>
Reported-by: Jungseok Lee <jungseoklee85@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2015-12-09 13:59:09 +00:00
..
boot ARM: DT updates for v4.4 2015-11-10 15:06:26 -08:00
configs arm64 fixes and clean-ups: 2015-11-12 15:33:11 -08:00
crypto arm64: crypto: reduce priority of core AES cipher 2015-11-18 12:09:08 +00:00
include arm64: irq: fix walking from irq stack to task stack 2015-12-09 13:59:09 +00:00
kernel arm64: irq: fix walking from irq stack to task stack 2015-12-09 13:59:09 +00:00
kvm arm64: kvm: report original PAR_EL1 upon panic 2015-11-24 18:20:58 +01:00
lib arm64: add KASAN support 2015-10-12 17:46:36 +01:00
mm arm64: add __init/__initdata section marker to some functions/variables 2015-12-02 12:17:11 +00:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-11-17 13:52:59 -08:00
xen arm: xen: implement multicall hypercall support. 2014-04-24 13:09:46 +01:00
Kconfig arm64: enable HAVE_IRQ_TIME_ACCOUNTING 2015-12-03 19:37:10 +00:00
Kconfig.debug arm64: remove redundant FRAME_POINTER kconfig option and force to select it 2015-11-10 10:36:00 +00:00
Kconfig.platforms ARM: DT updates for v4.4 2015-11-10 15:06:26 -08:00
Makefile arm64 updates for 4.4: 2015-11-04 14:47:13 -08:00