Subject: Re: yamt-idlelwp: setting curlwp in MI code.
To: None <ad@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 04/08/2007 03:27:42
> >> > how about having set_curlwp() which can be overridden by MD
> >> definition?
> >>
> >> Did you envision a new place where it would be used?
> >
> > - MI switching code. (namely mi_switch and lwp_startup)
> > - main for boot cpu.  MD cpu startup code for other cpus.
> >
> > i want to make asm code minimal.
> 
> Understood. I wanted to put it in the MD arena because:
> 
> - the places where it is set are few
> - curlwp could be a register or memory variable
> - curlwp could be defined as curcpu->ci_curlwp, or curcpu as curlwp->l_cpu
> - early initialization before main() may want to take locks

i think we all agree that some MD operations can be necessary when
setting curlwp.  the disagreement here is if combine it with
cpu_switchto or not.
i prefer to have them separate because, in that way, it's easier to write
it in C and use the same code for cpu initialization and context switching.
(assuming the entire cpu_switchto is written in asm.)
probably just a matter of preference.  so i don't argue much.

> There are other things that I would like to see purely MI and per-CPU,
> like the need_resched flags.

i agree.

YAMAMOTO Takashi