Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jul 1997 10:27:15 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        msmith@atrad.adelaide.edu.au (Michael Smith)
Cc:        vinay@agni.nuko.com, dg@root.com, terry@lambert.org, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Location of copyin() and copyout()..
Message-ID:  <199707301727.KAA05314@phaeton.artisoft.com>
In-Reply-To: <199707300311.MAA17635@genesis.atrad.adelaide.edu.au> from "Michael Smith" at Jul 30, 97 12:41:26 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> Vinay Bannai stands accused of saying:
> > 
> > So in a situation where I pin the user pages down (for DMA), it is okay to
> > use copyin()/copyout().
> 
> You don't have to pin them down for copyin/copyout, but it will work
> fine, yes.

Note: you can get a bigger win, depending on how you pin it.

If you pin it in the process of mmap()ing the device from user space,
then you create a bufer in KVM that you export to user space; this
is what the SVGA stuff does.

Because the memory exists in both kernel and user space, you can
use bcopy() to the kernel space address.  This saves the creation
and deletion (potentially) of mapping the target address of the
user process into and out of the kernel address space.

If you only allow one user space process at a time, you can further
cache the translation factor in the device instance data, and save
the lookup for the user->kernel address conversion when you are in
the kernel processing a user address request.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707301727.KAA05314>