Subject: Re: In-kernel RAS
To: None <tech-kern@netbsd.org>
From: Andrew Doran <ad@netbsd.org>
List: tech-kern
Date: 11/12/2007 15:07:13
On Mon, Nov 12, 2007 at 03:15:41PM +0100, Joerg Sonnenberger wrote:

> currently the return to userland code on x86 is quite expensive because
> the AST check has to use cli/sti which are not cheap. I've been
> wondering whether we could use RAS to handle this case better and other
> situations as well.

I tried it with a RAS and it didn't save much. I can't remember exactly but
it was somewhere around 30 clock cycles on a P4. It's not actually a big
deal because cli is followed by iret/sysexit/sysret which are serializing
and mask cli's presence.

The big win is using sysenter/sysexit. Doing that requires a 4GB segment
limit which breaks our non-executable stack protection. The NX bit can
be used, but it's only available on newer processors and requires that
the pmap uses the multi-level PAE pagetable format like amd64.
 
Thanks,
Andrew