[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-mips-cvs
Subject:    MIPS: irqflags.h: make funcs preempt-safe for non-mipsr2
From:       linux-mips () linux-mips ! org
Date:       2012-08-29 13:42:02
Message-ID: S1903334Ab2H2NmF/20120829134205Z+178 () eddie ! linux-mips ! org
[Download RAW message or body]

Author: Jim Quinlan <jim2101024@gmail.com> Sun Aug 26 17:56:49 2012 -0700
Comitter: Ralf Baechle <ralf@linux-mips.org> Wed Aug 29 13:35:28 2012 +0200
Commit: db942f27307853712d507779183bbdb388a8da05
Gitweb: http://git.linux-mips.org/g/ralf/linux/db942f273078
Branch: linux-2.6.34-stable

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.

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.

It is better to use the preemption functions declared in <linux/preempt.h>
rather than defining new ones as is done in this commit.  However,
including that file from irqflags effected many compiler errors.

irqflags.h depends on asm-offsets.h, but asm-offsets.h depends on irqflags.h
when generating asm-offsets.h.  Adding a definition to the top of
asm-offsets.c allows us to break this circle.  There is a similar define in
bounds.c.

[ralf@linux-mips.org: I've rewritten the code to get away without any new
macro assembler.  The remainder of irqflags.h is still using macro assembler
for historic reasons.]

Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/4296/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
(cherry picked from commit cc3fc200620fe61506b86aa44aded6d77057a9a4)

---

 arch/mips/include/asm/irqflags.h |   80 +++++++++++++++++++++++++++++++++++++-
 arch/mips/kernel/asm-offsets.c   |    1 
 2 files changed, 79 insertions(+), 2 deletions(-)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic