From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 21 12:20:03 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CB81837B401 for ; Mon, 21 Apr 2003 12:20:03 -0700 (PDT) Received: from k6.locore.ca (k6.locore.ca [198.96.117.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F21243FA3 for ; Mon, 21 Apr 2003 12:20:02 -0700 (PDT) (envelope-from jake@k6.locore.ca) Received: from k6.locore.ca (localhost.locore.ca [127.0.0.1]) by k6.locore.ca (8.12.8/8.12.8) with ESMTP id h3LJM5xS054963; Mon, 21 Apr 2003 15:22:05 -0400 (EDT) (envelope-from jake@k6.locore.ca) Received: (from jake@localhost) by k6.locore.ca (8.12.8/8.12.8/Submit) id h3LJM4C5054962; Mon, 21 Apr 2003 15:22:04 -0400 (EDT) Date: Mon, 21 Apr 2003 15:22:04 -0400 From: Jake Burkholder To: Marcel Moolenaar Message-ID: <20030421192204.GH50754@locore.ca> References: <20030421055332.GA4680@dhcp01.pn.xcllnt.net> <20030421132449.GA50754@locore.ca> <20030421183322.GA557@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030421183322.GA557@dhcp01.pn.xcllnt.net> User-Agent: Mutt/1.4i cc: freebsd-hackers@freebsd.org Subject: Re: Is pmap_kextract() allowed to fault? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Apr 2003 19:20:04 -0000 Apparently, On Mon, Apr 21, 2003 at 11:33:22AM -0700, Marcel Moolenaar said words to the effect of; > On Mon, Apr 21, 2003 at 09:24:49AM -0400, Jake Burkholder wrote: > > Apparently, On Sun, Apr 20, 2003 at 10:53:32PM -0700, > > Marcel Moolenaar said words to the effect of; > > > > > Gang, > > > > > > On ia64 pmap_kextract() uses the tpa instruction which given a > > > virtual address returns the physical address based on the > > > translation registers and cache (ie TLB). This can fault when > > > there's currently no mapping for the virtual address. > > > > > > Since all other architectures have a non-faulting implementation > > > (AFAICT), I'm a bit worried that we might get into trouble on > > > ia64. I couldn't find anything about pmap_kextract(), so maybe > > > anybody can enlighten me: > > > > > > 1. Is pmap_kextract() allowed to fault? > > > > It depends what kind of fault. Will tpa fail if it causes a tlb fault > > and the page is not in the vhpt (or whatever the fault handler searches), > > or will it end up calling vm_fault and actually trying to fault in the > > page? > > It will end up calling vm_fault() if so required. Yes, this is very bad. Especially for things like /dev/kmem, where you want to validate an address passed from userland. Jake > > > > 2. Is pmap_kextract() used often enough that using the cpu's TLB > > > is a possible performance speedup even if there are costly faults > > > that can sometimes happen? > > > > I doubt it. > > Ok, thanks. I think I'll use a non-trapping implementation then. > There's just too much circumstantiality... > > -- > Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net