Subject: Re: Request for comments: sharing memory between user/kernel space
To: Zeljko Vrba <zvrba@globalnet.hr>
From: Allen Briggs <briggs@netbsd.org>
List: tech-kern
Date: 03/21/2007 11:03:31
On Wed, Mar 21, 2007 at 03:57:51PM +0100, Zeljko Vrba wrote:
> I'm aware these problems.  But your 'usually' does not apply to my case: I'm
> willing to give up on the stream abstraction on the application level.  The
> kernel currently already does everything on the packet-level, and copies data
> to a contiguous user buffer.  Why not just return to the user-level an array
> of iovecs with proper <pointer,length> pairs referring to the TCP data
> payload.  It's the work that the kernel does anyway, I'd 'just' (quotes since

Sort of.  The main problem I can think of is that for this to work, I
think you'd have to have at least essentially all mbufs in memory that
is accessible from both the kernel and user space.  So your process
gets to see all network traffic.  Is that OK with you?

Obviously, this is not something that's general-purpose.

> > mbuf chains--which have the scatter/gather information you want for
> > this.  
> What is problematic in "exporting" mbuf chains, together with associated data
> payload, to the user-level?

I think just the address space differences.  Translation, mapping, and
hand-off.  It would be really easy, I think, for the user application
to crash or at least starve the kernel.

-allen

-- 
Allen Briggs  |  http://www.ninthwonder.com/~briggs/  |  briggs@ninthwonder.com