Subject: Re: per-cpu TSS
To: Frank van der Linden <fvdl@netbsd.org>
From: Charles M. Hannum <abuse@spamalicious.com>
List: port-i386
Date: 11/13/2003 17:37:03
On Thursday 13 November 2003 11:43 am, Frank van der Linden wrote:
> On Wed, Nov 12, 2003 at 06:10:23PM +0000, Charles M. Hannum wrote:
> > Such as using JMP TSS to do task switches, which avoids manually saving
> > state and patching the GDT, and is faster.  And as I mentioned some time
> > ago, will eventually allow switching directly to user-level without
> > needing a kernel stack.
>
> What exactly is the latter about? Sure, you can store the register state
> in a TSS (though I doubt it's faster, it seems like TSS supoort has
> bitrotted a bit in later CPUs, as nobody seems to use it). However, I don't
> understand the "without needing a kernel stack" part. Yes, the register
> state will not be on the kernel stack in that case, but obviously you
> do need a kernel stack in general.

Uh, "sort of".  You only need a kernel stack *per process* because we always 
store state on the state when we switch.  We can arrange (cf. later versions 
of Mach) to not do so in many cases, and instead have a kernel stack per CPU 
most of the time.  This would be especially beneficial for threads, as would 
it remove 8k of per-LWP overhead.

We pretty much have the choice of either doing this ourselves, or waiting till 
someone else does it and posts embarrassing benchmarks.  :-P