Subject: Re: yamt-idlelwp: setting curlwp in MI code.
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Andrew Doran <ad@netbsd.org>
List: tech-kern
Date: 04/07/2007 11:48:09
>> > 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

There are other things that I would like to see purely MI and per-CPU,
like the need_resched flags. IIRC vax and sparc don't implement per-CPU
flags or IPIs for that.

Andrew