From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 10 12:11:53 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39DF8106564A for ; Wed, 10 Mar 2010 12:11:53 +0000 (UTC) (envelope-from ryu.planka@gmail.com) Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mx1.freebsd.org (Postfix) with ESMTP id C46AF8FC19 for ; Wed, 10 Mar 2010 12:11:52 +0000 (UTC) Received: by bwz8 with SMTP id 8so4176433bwz.3 for ; Wed, 10 Mar 2010 04:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=r4LdHKk4P7No/9GSI3u0B/oYmCVejykO6b9D3NaaSCo=; b=hOL3Vv1DzJZdoB04l0Mw/PinJcqj4PnsE7O688DoojcF45reuY6kZ3rY4Civml6QEV CEWO8XYkwLCF9VeLCPGs8ci89ZO56Lz10yg1lr+jopORsQ8DJAWgwn+dZ5QQLkMExsG/ Rn2CZswv69z7x0ww0HW8Ba6yS75oJC1FqRRJQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=F6wVU92Hg1q4HPXB2yE8IFM+CYYSQBmKMRrSG4g0SQDmYcvRYTUld2rUQFI9iwu+QP jvDAoRz2xJdsIo40hUL+RsIS5WHNunkQAOafK37qTQC5HGRyz6Mn+eMC5XkgA2nRLbbs POYv8i0OMIRs+ByoKLAZnuSwr0pZP5TBX24U0= MIME-Version: 1.0 Received: by 10.204.131.210 with SMTP id y18mr1496680bks.100.1268221218576; Wed, 10 Mar 2010 03:40:18 -0800 (PST) Date: Wed, 10 Mar 2010 13:40:18 +0200 Message-ID: From: son goku To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: physio and vmapbuf X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2010 12:11:53 -0000 Hi hackers, I have some experience with other UNIX kernels but none with FreeBSD. FreeBSD interests me for a potential project I might be involved in , and therefore I started researching it. Browsing through the I/O layer code, I stumbled upon something that looked strange, and perhaps you guys can help me with it. Mainly, when reading the physio path, when the I/O buffer is from user-mode, physio calls vmapbuf. The comments says that vmapbuf actually maps the user-buffer into kernel address space. From my experience, such mapping is needed only for very old devices that use PIO. Newer device just use DMA for data copy, and therefore don't need the mapping, instead they just need to pin the memory. Checking out vmapbuf only confused me further, I couldn't find where such kernel mapping was taken place, nevertheless I did saw that the buf->b_data was updated according to buf->b_saveaddr in some weird offset calculation. Adding to this confusion, there is a buf field called b_kvabase which supposedly stores the kernel virtual address which wasn't touched at all!! Any help with understanding the flow and the usage of those fields/variables will be greatly appreciated!!