2.3.13 doesn't boot in a 8-way SMP. I tracked this down to kernel_thread
entering the kernel, forking a child and rescheduling the child while
returning from the fork in entry.S. The child will go into start_secondary
so the master CPU will lockup waiting for the callout. At first sight it
was really an odd lockup ;).
Everybody can reproduce in every SMP hardware simply by adding a:
current->need_resched = 1;
current->counter = 0; /* tell goodness that we are not good */
before the:
kernel_thread(start_secondary, NULL, CLONE_PID);
call at line 950 of arch/i386/kernel/smp.c.
BTW, if it would been a `kernel_thread(NULL, NULL, CLONE_PID)' it would
been less misleading since it would have oopsed in kernel_thread ;).
Here it is my fix against 2.3.13:
--- 2.3.13/arch/i386/kernel/smp.c Thu Aug 12 02:53:17 1999
+++ 2.3.13-tmp/arch/i386/kernel/smp.c Tue Aug 17 18:22:54 1999
@@ -935,6 +935,14 @@
unsigned short ss;
} stack_start;
+static int __init fork_by_hand(void)
+{
+ struct pt_regs regs;
+ /* don't care about the eip and regs settings since we'll never
+ reschedule the forked task. */
+ return do_fork(CLONE_VM|CLONE_PID, 0, ®s);
+}
+
static void __init do_boot_cpu(int i)
{
unsigned long cfg;
@@ -944,11 +952,11 @@
int timeout, num_starts, j;
unsigned long start_eip;
- /*
- * We need an idle process for each processor.
- */
- kernel_thread(start_secondary, NULL, CLONE_PID);
cpucount++;
+ /* We can't use kernel_thread since we must _avoid_ to reschedule
+ the child. */
+ if (fork_by_hand() < 0)
+ panic("failed fork for CPU %d", i);
/*
* We remove it from the pidhash and the runqueue
The only thing we want from fork is to create a proper task, we don't care
about the regs initialization since we'll never ret_from_fork but we'll
redo all the regs initializations by hand in the SMP trampoline and
startup32 in the secondary cpus.
The bug is present as well in 2.2.x (I am not sure if it triggers or not
there though). The patch just applyes cleanly to the 2.2.12-final tree
too.
Andrea
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]