Communications kernel -> userland
Pawel Jakub Dawidek
nick at garage.freebsd.pl
Mon Jul 21 12:01:38 PDT 2003
On Mon, Jul 21, 2003 at 02:20:40PM -0400, Robert Watson wrote:
+> For one of our research projects, here at NAI, we did a fair amount of
+> userland network code prototyping. We started out with IPDIVERT, then
+> pushed down to BPF using a partial network stack in userspace. We've
+> found it's a lot easier on competent network developers who are unfamiliar
+> with the FreeBSD kernel code, not to mention easier on debugging. We
+> never got so far on that project as to do shared memory between the kernel
+> and userspace, but I know that that's been done by at least a couple of
+> companies at various points to reduce copying and context switch costs for
+> userspace test frameworks. One of the things I'd really like to see if
+> some decent "throw packets between kernel and userspace" primitive bits,
+> such that the kernel has a useful and logical way to expose buffer data
+> into directly mapped user pages, and an appropriate notification and
+> management system to reuse memory, etc. Something that looks a bit like
+> the relationship between kernel device drivers and devices when it comes
+> to DMA management. Do you know if any such framework exists?
+> (Specifically targetted at exposing network packets...) (Ideally not
+> requiring privilege in the user process, nor involving nasty integrity or
+> confidentiality problems :-)
It will be cool to have something like this:
mark(vm_map_t map, vm_offset_t start, vm_offset_t end);
unmark(vm_map_t map, vm_offset_t start, vm_offset_t end);
It will be used instead of copyin()/copyout() functions.
For example syscall is marking some range with mark() function.
For now on this range isn't accessable from userland. If process will
try to write to this page, page is copied (copy-on-write).
If this page will be modified by kernel it will be marked as MODIFIED.
Now when syscall will call unmark() on this range we could get two
1. Page is marked as MODIFIED (by kernel) so userland copy
of this page (if it exists of course) is destroyed and
this page will be putted in its place.
This is replacement for copyin() and then copyout() or
2. Page isn't marked as MODIFIED, so kernel version of page
is destroyed (is there is userland version).
This is replacement for just copyin().
There could be other ways. Thread/process could be locked if it is trying
to access memory marked with mark() function. And this, I think, don't hit
performance, because this happends really rarely. So maybe it is better to
lock thread for a moment instead of doplicating page, but I don't think so.
Pawel Jakub Dawidek pawel at dawidek.net
UNIX Systems Programmer/Administrator http://garage.freebsd.pl
Am I Evil? Yes, I Am! http://cerber.sourceforge.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 305 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20030721/2cdd4fe8/attachment.bin
More information about the freebsd-hackers