Re: [patch 00/13] Syslets, "Threadlets", generic AIO support, v3

Davide Libenzi
2007-03-03T09:02:31Z

On Sat, 3 Mar 2007, Ingo Molnar wrote:

> * Davide Libenzi <davidel@xmailserver.org> wrote:
>
> > [...] Status word and control bits should not be changed from
> > underneath userspace AFAIK. [...]
>
> Note that the control bits do not just magically change during normal
> FPU use. It's a bit like sys_setsid()/iopl/etc., it makes little sense
> to change those per-thread anyway. This is a non-issue anyway - what is
> important is that the big bulk of 512 (or more) bytes of FPU state /are/
> callee-saved (both on 32-bit and on 64-bit), hence there's no need to
> unlazy anything or to do expensive FPU state saves or other FPU juggling
> around threadlet (or even syslet) use.

Well, the unlazy/sync happen in any case later when we switch (given
TS_USEDFPU set). We'd avoid a copy of it given the above conditions true.
Wouldn't it makes sense to carry over only the status word and the control
bits eventually?
Also, if the caller saves the whole context, and if we're scheduled while
inside a system call (not totally unfrequent case), can't we implement a
smarter unlazy_fpu that avoids fxsave during schedule-out and frstor after
schedule-in (do not do stts on this condition, so the newly scheduled
task don't get a fault at all)? If the above conditions are true (no need
context-copy for new head in async_exec), this should be possible too.

- Davide