From owner-freebsd-hackers Wed Jul 30 10:30:20 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id KAA18239 for hackers-outgoing; Wed, 30 Jul 1997 10:30:20 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.50]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id KAA18223 for ; Wed, 30 Jul 1997 10:30:14 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id KAA05314; Wed, 30 Jul 1997 10:27:15 -0700 From: Terry Lambert Message-Id: <199707301727.KAA05314@phaeton.artisoft.com> Subject: Re: Location of copyin() and copyout().. To: msmith@atrad.adelaide.edu.au (Michael Smith) Date: Wed, 30 Jul 1997 10:27:15 -0700 (MST) Cc: vinay@agni.nuko.com, dg@root.com, terry@lambert.org, freebsd-hackers@FreeBSD.ORG In-Reply-To: <199707300311.MAA17635@genesis.atrad.adelaide.edu.au> from "Michael Smith" at Jul 30, 97 12:41:26 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > 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.