From owner-freebsd-hackers Tue Oct 21 19:30:34 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id TAA27547 for hackers-outgoing; Tue, 21 Oct 1997 19:30:34 -0700 (PDT) (envelope-from owner-freebsd-hackers) Received: from pluto.plutotech.com (root@mail.plutotech.com [206.168.67.137]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id TAA27542 for ; Tue, 21 Oct 1997 19:30:31 -0700 (PDT) (envelope-from durian@plutotech.com) Received: from shane.plutotech.com (shane.plutotech.com [206.168.67.149]) by pluto.plutotech.com (8.8.5/8.8.5) with ESMTP id UAA15838; Tue, 21 Oct 1997 20:30:28 -0600 (MDT) Message-Id: <199710220230.UAA15838@pluto.plutotech.com> From: "Mike Durian" To: "Mike Durian" cc: hackers@FreeBSD.ORG Subject: Re: user vm addr to kernel vm addr In-reply-to: Your message of "Mon, 20 Oct 1997 20:01:11 MDT." Date: Tue, 21 Oct 1997 20:30:28 -0600 Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Mon, 20 Oct 1997 20:01:11 MDT, "Mike Durian" wrote: > In my virtual file system I'd like to speed up reads and writes >by copying directly from the uio structure to a vm address of >a buffer in the user process running on behalf of the filesystem. >I'm currently shoving all the data through a socket that the >user process reads from and copies into a buffer. I'd like to >go direct and skip the socket writing part. Does that make sense? > Anyway, I want to copy from a uio to a different process's vm space. >I can get the vm address of the destination buffer over a socket and >think I can use vm_fault_wire to make sure it stays accessable, but >I don't know how to convert that user space vm address into a >kernel space vm address that I can then use with copyout. > Is there an easy (or any) way to do this? I'm following up to my own post. I should mention that the user process containing the vm buffer that I want to convert is *not* curproc. I want to go between that buffer and a struct uio in my VOP_READ and VOP_WRITE functions. I did find something that works, but perhaps someone has a better/cleaner way of doing it. I don't think I need to do the vm_fault_wire either. for each page in the vm buffer vm_map_lookup to get the vm object vm_page_lookup to get the page for the object kmem_alloc_pageable to allocate kernel vm space pmap_qenter to map the pages into the kernel vm address uiomove copy from the new kernel address to uio pmap_qremove to unmap the pages kmem_free to release the kernel vm space mike