kernel upcall documentation

Konstantinos Boukis konstantinos.boukis at kcl.ac.uk
Fri Oct 21 16:57:43 PDT 2005


I tried not to bombard you with all the information of what I am doing but it
seems inevitable ;-). I am working on a theoretical research project and the
goal is to develop a mobile terminal (e.g. one that changes network
continuously) that will be able to adapt to the offered mobility protocols
(i.e. like Mobile IP) offered by the network. In my implementation the kernel
identifies the offered protocol and installs the appropriate modules. 

>From my perspective I am more concerned for preserving the theoretical
constrains (i.e. the model of computation) than the practical ones. Of course I
understand your perspective as well; you are developing an operating system and
your concern is to make it as stable as possible. But let’s assume that a
userland stack does exist and is valid and mapped, can a kernel thread suspend,
call the function pointed by ku_func in userland and then resume in kernel
space? At the end of the day it is interesting and good fun to play around with
those things, which I guess is our concern in common.

Quoting Daniel Eischen <deischen at freebsd.org>:

> On Fri, 21 Oct 2005, Konstantinos Boukis wrote:
> 
> > In Clark’s and Kohler’s definition for upcall, the function that initiates
> 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
> kernel
> > after wakeup() will continue its operation without waiting the userland
> process
> > 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 invoke
> 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.
> 
> -- 
> DE
> 
> 


-- 
Konstantinos Boukis
konstantinos.boukis at kcl.ac.uk
 



More information about the freebsd-threads mailing list