linux-mips
[Top] [All Lists]

kernel_thread creation bug?

To: linux-mips@linux-mips.org
Subject: kernel_thread creation bug?
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Fri, 22 Oct 2004 17:07:58 +0900 (JST)
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
I'm encountering strange kernel lockup recently.  I noticed that
sometimes an interrupt happend in middle of RESTORE_SOME code.

RESTORE_SOME restores CP0_STATUS from stack.  But the value in the
stack did not contains EXL bit when the problem happens.

With recent change in kernel_thread(), initial cp0_status value comes
from current C0_STATUS (which does not include EXL bit).  Is this
correct?  The initial value should contain EXL bit to start the thread
up safely, shouldn't it?

Now I'm testing this patch and it seems to fix the problem.

diff -u linux-mips/arch/mips/kernel/process.c linux/arch/mips/kernel/
--- linux-mips/arch/mips/kernel/process.c       Wed Sep 22 13:27:59 2004
+++ linux/arch/mips/kernel/process.c    Fri Oct 22 16:49:39 2004
@@ -171,6 +171,9 @@
        regs.regs[5] = (unsigned long) fn;
        regs.cp0_epc = (unsigned long) kernel_thread_helper;
        regs.cp0_status = read_c0_status();
+#if !(defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX))
+       regs.cp0_status |= ST0_EXL;
+#endif
 
        /* Ok, create the new process.. */
        return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, 
NULL);

---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>