Subject: Per-thread user <-> kernel communication area
To: None <tech-kern@netbsd.org>
From: Andrew Doran <ad@netbsd.org>
List: tech-kern
Date: 11/08/2007 22:41:37
Hi all,

The below diff provides a wired-down, per-LWP area that is shared between a
user process and the kernel. It's not implemented as a commpage, because I
want to be able to send information in both directions, meaning the user
part has to be mapped read/write. Also, one advantage to having the kernel
allocate single blocks on behalf of the user process is that we can add to
the block later without backward compatibility concerns.

	http://www.netbsd.org/~ad/_lwp_ctl.diff

I haven't gone through the interaction with fork() yet. Currently it only
tracks which CPU an LWP is running on, whether or not the LWP is running,
and provides a hint when the LWP exits. The last item can be used to reclaim
the LWP's user stack without using _lwp_kill() to check for its continued
existence.

In the future the block could be used for other interesting stuff, like
maintaining the signal mask in userspace, which would allow us to eliminate
most calls to sigprocmask().

Comments?

Thanks,
Andrew