kernel upcall documentation
deischen at freebsd.org
Fri Oct 21 12:38:32 PDT 2005
On Fri, 21 Oct 2005, Konstantinos Boukis wrote:
> In Clark=92s and Kohler=92s definition for upcall, the function that init=
> waits for the upcalled function to finish its operation so as to resume. =
> could indeed employ a mechanism with signals between the kernel and the
> userland process but that would break the above definition since the kern=
> after wakeup() will continue its operation without waiting the userland p=
> to finish (OK, I could then put the kernel thread to sleep and resume it =
> the userland, but this seems to me very sloppy programming).
I think it would be better to have userland (daemon) initiate things
if you indeed need to have userland do stuff. What you want to do
seems very much worse. How do you know there is a userland process
waiting to do anything unless the userland first calls into the
kernel? If that's the case, then just put the userland process
(thread) to sleep via either read(), write(), ioctl(), kqueue(),
or whatever until your event happens. Why is abusing the KSE
functions any better?
> Anyway, just out of curiosity, is there a way for a kernel thread to invo=
> userland function pointed by ku_func? (provided that a mailbox is already
> assigned to the kse from a userland kse_create invocation)
There is not necessarily a userland stack if it is a pure kernel
thread. If you are trying to pass a stack from another userland
process (thread), there is no guarantee that the process still
exists and the stack is valid, mapped, and valid for the kernel
thread to use.
I'm not sure what it is you are trying to do, but I think you're
looking at it the wrong way.
More information about the freebsd-threads