linux/arch
Russell King - ARM Linux a4841e39f7 ARM: introduce handle_IRQ() not to dump exception stack
On Mon, Jul 11, 2011 at 3:52 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:

...

> The __exception annotation on a function causes this to happen:
>
> [<c002406c>] (asm_do_IRQ+0x6c/0x8c) from [<c0024b84>]
> (__irq_svc+0x44/0xcc)
> Exception stack(0xc3897c78 to 0xc3897cc0)
> 7c60:                                                       4022d320 4022e000
> 7c80: 08000075 00001000 c32273c0 c03ce1c0 c2b49b78 4022d000 c2b420b4 00000001
> 7ca0: 00000000 c3897cfc 00000000 c3897cc0 c00afc54 c002edd8 00000013 ffffffff
>
> Where that stack dump represents the pt_regs for the exception which
> happened.  Any function found in while unwinding will cause this to
> be printed.
>
> If you insert a C function between the IRQ assembly and asm_do_IRQ,
> the
> dump you get from asm_do_IRQ will be the stack for your function,
> not
> the pt_regs.  That makes the feature useless.
>

When __irq_svc - or any of the other exception handling assembly code -
calls the C code, the stack pointer will be pointing at the pt_regs
structure.

All the entry points into C code from the exception handling code are
marked with __exception or __exception_irq_enter to indicate that they
are one of the functions which has pt_regs above them.

Normally, when you've entered asm_do_IRQ() you will have this stack
layout (higher address towards top):

       pt_regs
       asm_do_IRQ frame

If you insert a C function between the exception assembly code and
asm_do_IRQ, you end up with this stack layout instead:

       pt_regs
       your function frame
       asm_do_IRQ frame

This means when we unwind, we'll get to asm_do_IRQ, and rather than
dumping out the pt_regs, we'll dump out your functions stack frame
instead, because that's what is above the asm_do_IRQ stack frame
rather than the expected pt_regs structure.

The fix is to introduce handle_IRQ() for no exception stack dump, so
it can be called with MULTI_IRQ_HANDLER is selected and a C function
is between the assembly code and the actual IRQ handling code.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2011-07-12 19:42:40 +08:00
..
alpha Fix node_start/end_pfn() definition for mm/page_cgroup.c 2011-06-27 14:13:09 -07:00
arm ARM: introduce handle_IRQ() not to dump exception stack 2011-07-12 19:42:40 +08:00
avr32 rtc: fix build warnings in defconfigs 2011-06-15 20:04:02 -07:00
blackfin rtc: fix build warnings in defconfigs 2011-06-15 20:04:02 -07:00
cris Merge branch 'setns' 2011-05-28 10:51:01 -07:00
frv Merge branch 'setns' 2011-05-28 10:51:01 -07:00
h8300 Merge branch 'setns' 2011-05-28 10:51:01 -07:00
ia64 [IA64] wire up sendmmsg() syscall for Itanium 2011-05-31 10:09:24 -07:00
m32r Fix node_start/end_pfn() definition for mm/page_cgroup.c 2011-06-27 14:13:09 -07:00
m68k m68k: use kernel processor defines for conditional optimizations 2011-06-14 11:42:29 +10:00
microblaze Merge branch 'setns' 2011-05-28 10:51:01 -07:00
mips rtc: fix build warnings in defconfigs 2011-06-15 20:04:02 -07:00
mn10300 MN10300: asm/uaccess.h needs to #include linux/kernel.h for might_sleep() 2011-06-21 18:31:44 -07:00
parisc Fix node_start/end_pfn() definition for mm/page_cgroup.c 2011-06-27 14:13:09 -07:00
powerpc Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2011-06-29 11:03:27 -07:00
s390 [S390] allow setting of upper 32 bit in smp_ctl_set_bit 2011-06-22 16:24:20 +02:00
score arch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT} 2011-05-26 17:12:38 -07:00
sh Merge branch 'sh-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-3.x 2011-06-30 10:43:22 -07:00
sparc Fix node_start/end_pfn() definition for mm/page_cgroup.c 2011-06-27 14:13:09 -07:00
tile Fix node_start/end_pfn() definition for mm/page_cgroup.c 2011-06-27 14:13:09 -07:00
um um: add asm/percpu.h 2011-06-27 18:00:12 -07:00
unicore32 unicore32: using generic-y format for one line asm-generic files 2011-06-09 16:29:52 +08:00
x86 Merge branch 'stable/bug.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen 2011-07-01 13:25:56 -07:00
xtensa Merge branch 'setns' 2011-05-28 10:51:01 -07:00
.gitignore
Kconfig mm, powerpc: move the RCU page-table freeing into generic code 2011-05-25 08:39:16 -07:00