Date: Fri, 21 Oct 2005 15:38:30 -0400 (EDT) From: Daniel Eischen <deischen@freebsd.org> To: Konstantinos Boukis <konstantinos.boukis@kcl.ac.uk> Cc: freebsd-threads@freebsd.org Subject: Re: kernel upcall documentation Message-ID: <Pine.GSO.4.43.0510211526150.2605-100000@sea.ntplx.net> In-Reply-To: <1129922256.43593ed0727ef@impmail.kcl.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 21 Oct 2005, Konstantinos Boukis wrote: > In Clark=92s and Kohler=92s definition for upcall, the function that init= iates it > waits for the upcalled function to finish its operation so as to resume. = I > could indeed employ a mechanism with signals between the kernel and the > userland process but that would break the above definition since the kern= el > after wakeup() will continue its operation without waiting the userland p= rocess > to finish (OK, I could then put the kernel thread to sleep and resume it = from > 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= ke the > 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. --=20 DE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.43.0510211526150.2605-100000>