ARM: hw_breakpoint: disable preemption during debug exception handling
commit7e20269647169e7ea08a62bdc4979a3ba32e615c
authorWill Deacon <will.deacon@arm.com>
Sun, 28 Nov 2010 14:57:24 +0000 (28 14:57 +0000)
committerWill Deacon <will.deacon@arm.com>
Mon, 6 Dec 2010 11:55:56 +0000 (6 11:55 +0000)
treeb66a6c5e893a34ee9659403f66f44841dfb34232
parent6ee33c2712fcdff2568d9bbadb25c8e5a7c36212
ARM: hw_breakpoint: disable preemption during debug exception handling

On ARM, debug exceptions occur in the form of data or prefetch aborts.
One difference is that debug exceptions require access to per-cpu banked
registers and data structures which are not saved in the low-level exception
code. For kernels built with CONFIG_PREEMPT, there is an unlikely scenario
that the debug handler ends up running on a different CPU from the one
that originally signalled the event, resulting in random data being read
from the wrong registers.

This patch adds a debug_entry macro to the low-level exception handling
code which checks whether the taken exception is a debug exception. If
it is, the preempt count for the faulting process is incremented. After
the debug handler has finished, the count is decremented.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm/kernel/entry-armv.S
arch/arm/kernel/entry-header.S
arch/arm/kernel/hw_breakpoint.c