2.5.8: preemption + SMP broken ?
My machine (4cpu x86) hangs while booting a kernel with SMP and preemption enabled. It hangs while executing one of the initcalls, probably BIO since that is where the next boot message comes from during a successful boot with SMP (or preemption) disabled.
Has anyone tried out preemption with SMP ?
Thanks
Signature · 2 lines
Dipankar Sarma <[email protected]> http://lse.sourceforge.net Linux Technology Center, IBM Software Lab, Bangalore, India.
Quoted 7 lines · Dipankar Sarma
My machine (4cpu x86) hangs while booting a kernel with SMP and preemption enabled. It hangs while executing one of the initcalls, probably BIO since that is where the next boot message comes from during a successful boot with SMP (or preemption) disabled.
Has anyone tried out preemption with SMP ?
Sure, all my testing is on SMP. The problem manifested itself in 2.5.8-pre when some changes where made to the migration code. The race is in the migration code - I am not sure it is preempts fault, per se, but the attached patch should fix it. It is pending with Linus for the next release.
Robert Love
kernel/sched.c +4 -1
@@ -1649,6 +1649,7 @@if (!new_mask)BUG (); +preempt_disable (); rq =task_rq_lock (p, &flags); p->cpus_allowed = new_mask;/*
@@ -1657,7 +1658,7 @@*/ if (new_mask & (1UL << p->thread_info->cpu)) {task_rq_unlock (rq, &flags); -return ; + goto out; }init_MUTEX_LOCKED (&req.sem);
@@ -1667,6 +1668,8 @@wake_up_process (rq->migration_thread);down (&req.sem); +out: +preempt_enable (); }static volatile unsigned long migration_mask;
Quoted 8 lines · Robert Love
Quoted 1 line · Dipankar Sarma
Has anyone tried out preemption with SMP ?
Sure, all my testing is on SMP. The problem manifested itself in 2.5.8-pre when some changes where made to the migration code. The race is in the migration code - I am not sure it is preempts fault, per se, but the attached patch should fix it. It is pending with Linus for the next release.
It worked! Thanks a lot, Robert.
Thanks
Signature · 2 lines
Dipankar Sarma <[email protected]> http://lse.sourceforge.net Linux Technology Center, IBM Software Lab, Bangalore, India.
Hi!
Quoted 6 lines
Quoted 6 lines
My machine (4cpu x86) hangs while booting a kernel with SMP and preemption enabled. It hangs while executing one of the initcalls, probably BIO since that is where the next boot message comes from during a successful boot with SMP (or preemption) disabled.
Quoted 7 lines
Quoted 1 line
Has anyone tried out preemption with SMP ?
Sure, all my testing is on SMP. The problem manifested itself in 2.5.8-pre when some changes where made to the migration code. The race is in the migration code - I am not sure it is preempts fault, per se, but the attached patch should fix it. It is pending with Linus for the next release.
Wel, if race is in migration code, you should fix migration, not add preempt_disable(), right? [Or is race preempt-onlly?]
Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt, details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
Quoted 2 lines · Pavel Machek
Wel, if race is in migration code, you should fix migration, not add
preempt_disable(), right? [Or is race preempt-onlly?]
I was not sure where the race was - I really did not see a preempt-only race there, but I could not pinpoint the cause for an SMP race. Since it was only showing itself as a preempt-related race, I disabled preemption.
Erich Focht later pointed out that interrupts should be disabled in migration_init and we sent a patch off to Linus. I will do some testing and see if this fixes it (I suspect it may) and subsequently remove the preempt code.
Robert Love