Subject: gmcgarry_ctxsw problems
To: None <firstname.lastname@example.org>
From: Jason R Thorpe <email@example.com>
Date: 01/02/2003 13:37:22
I've been looking at Greg's new context switch code on the above-mentioned
branch, and have identified some problems with it:
1. sched_lock is released too early. Specifically, it is released
before having completely switched away from the outgoing proc.
This is a race condition that will break MP systems (and has
in the past, until cpu_switch() was fixed on i386 and alpha).
2. It does not properly handle switching to an idle context. On
UP systems, this means proc0's PCB. On MP systems, this means
the CPU's idle PCB. On the VAX, this means the CPU's interrupt
3. It doesn't not have any way to communicate the info that can
currently be passed between cpu_switch() and idle(). For the
most part, that means "remembering if we're switching to the
same process again" -- this is more complicated in MP systems.
For this reason, I think the approach taken by Greg's new code needs
to be reexamined. I think probably a better way to handle it is for
cpu_switch() to actually call an MI C function to get the new process
to switch to. That is, leave it mostly the same as it is now, just
replace the code that looks at the run queues with a function call.
-- Jason R. Thorpe <firstname.lastname@example.org>