]> Pileus Git - ~andy/linux/commit
MIPS: Make irqflags.h functions preempt-safe for non-mipsr2 cpus
authorJim Quinlan <jim2101024@gmail.com>
Thu, 6 Sep 2012 15:36:56 +0000 (11:36 -0400)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 9 Nov 2012 09:59:21 +0000 (10:59 +0100)
commite97c5b609880d97313b13eb71830fca62cee50c2
treed43e3033f37cc9181dfe145b1019237429cfb418
parent92d11594f688c8b55b51e80f2eac4417396237a4
MIPS: Make irqflags.h functions preempt-safe for non-mipsr2 cpus

For non MIPSr2 processors, such as the BMIPS 5000, calls to
arch_local_irq_disable() and others may be preempted, and in doing
so a stale value may be restored to c0_status.  This fix disables
preemption for such processors prior to the call and enables it
after the call.

Those functions that needed this fix have been "outlined" to
mips-atomic.c, as they are no longer good candidates for inlining.

This bug was observed in a BMIPS 5000, occuring once every few hours
in a continuous reboot test.  It was traced to the write_lock_irq()
function which was being invoked in release_task() in exit.c.
By placing a number of "nops" inbetween the mfc0/mtc0 pair in
arch_local_irq_disable(), which is called by write_lock_irq(), we
were able to greatly increase the occurance of this bug.  Similarly,
the application of this commit silenced the bug.

Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: Kevin Cernekee cernekee@gmail.com
Cc: Jim Quinlan <jim2101024@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/4321/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/irqflags.h
arch/mips/lib/Makefile
arch/mips/lib/mips-atomic.c [new file with mode: 0644]