[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:44:27
Message-ID: S1903269Ab2H2Noa/20120829134430Z+228 () 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 12:55:16 2012 +0200
Commit: 413f4f5896d0639fbc3e92ee4559663340b4ca5d
Gitweb: http://git.linux-mips.org/g/ralf/linux/413f4f5896d0
Branch: linux-3.5-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 | 76 ++++++++++++++++++++++++++++++++++++++
arch/mips/kernel/asm-offsets.c | 1 +
2 files changed, 77 insertions(+), 0 deletions(-)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic