Subject: Re: UVM - Kernel & User access question
To: None <tech-kern@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 10/16/2003 19:24:03
>> I don't recall what process your code is creating userland memory for.
> I would like to allocate memory remotely (using kernel land) I did
> (with your help) the network kernel layer and now I would like to
> allocate large memory page inside a kernel process and read/write
> data.

Well, if you want userland memory, it has to be for some process;
without a process, there is no userland.

> Unfortunately it is in the same kthread and copyout cause a page
> fault too in my test...

kthread as in something created with kthread_create1()?  I'm not sure
whether they _have_ userland in the sense necessary to support
allocating userland memory; I don't know enough about them.

>> It sounds to me as though what you really want is pageable kernel
>> memory.  I don't know whether that exists at present.
> Hehe here we are, This is what I would like to have.
> Any idea how can I produce such a thing?

Uh...redesign and reimplement the VM subsystem? :-/  As I understand
it, the current design simply does not have any such thing.

If I might draw an analogy, there is something similar with NFS
daemons: they want threads of control, which in some systems don't
exist without processes.  So there's nfsd, which basically makes a
syscall inside which it spends the rest of its existence.  Perhaps
something similar would work for you?  Rather than using a kernel
thread, have a userland process which makes a syscall which amounts to
what you're now using a kernel thread for.  Then you have a real
userland available to do whatever you need with.  All the real work is
still done in the kernel (it's still not clear to me why you wanted all
the processing to be in the kernel), but you have a userland available
when you need it.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B