kernel_thread creation bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux