Subject: In-kernel RAS
To: None <tech-kern@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-kern
Date: 11/12/2007 15:15:41
Hi all,
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.

The problem is that before returning to userland the code has to check
for pending interrupts. It also has to reenable interrupts and there's a
possible race involved. If all interrupt handlers check on exit if the
AST check is currently running based on the IP, that check can be
basically done without having to worry about interrupts.

Another application is read-mostly data structures. When the look up
path of the data structure is done as RAS (which is easy for read-only
code), changing the data structure can be done as copy of the necessary
parts or exploiting strict ordering of changes followed by an IPI or a
token passing mechanism for defered freeing. This is relatively easy to
implement and get correctly without having to worry too much about stale
operations. Most lock-free data structure issues are related to that
problem after all.

Do you think the additional overhead in interrupts outweights the
advantages?

Joerg