From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 6 02:38:20 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 D6D1E10656BC for ; Mon, 6 Sep 2010 02:38:20 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from agogare.doit.wisc.edu (agogare.doit.wisc.edu [144.92.197.211]) by mx1.freebsd.org (Postfix) with ESMTP id AB6CE8FC12 for ; Mon, 6 Sep 2010 02:38:20 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from avs-daemon.smtpauth2.wiscmail.wisc.edu by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0L8A00700XVVEH00@smtpauth2.wiscmail.wisc.edu> for freebsd-hackers@freebsd.org; Sun, 05 Sep 2010 20:38:19 -0500 (CDT) Received: from comporellon.tachypleus.net ([unknown] [76.210.68.10]) by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0L8A003ATXVUHL10@smtpauth2.wiscmail.wisc.edu> for freebsd-hackers@freebsd.org; Sun, 05 Sep 2010 20:38:18 -0500 (CDT) Date: Sun, 05 Sep 2010 20:38:17 -0500 From: Nathan Whitehorn To: freebsd-hackers@freebsd.org Message-id: <4C844609.9050505@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.68.10 X-Spam-PmxInfo: Server=avs-14, Version=5.6.0.2009776, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2010.9.6.13015, SenderIP=76.210.68.10 X-Enigmail-Version: 1.0.1 User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.11) Gecko/20100729 Thunderbird/3.0.6 Subject: UMA allocations from a specific physical range 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: Mon, 06 Sep 2010 02:38:21 -0000 PowerPC hypervisors typically provided a restricted range on memory when the MMU is disabled, as it is when initially handling exceptions. In order to restore virtual memory, the powerpc64 code needs to read a data structure called the SLB cache, which is currently allocated out of a UMA zone, and must be mapped into wired memory, ideally 1:1 physical->virtual address. Since this must be accessible in real mode, it must have a physical address in a certain range. I am trying to figure out the best way to do this. My first run at this code uses a custom UMA allocator that calls vm_phys_alloc_contig() to get a memory page. The trouble I have run into is that I cannot figure out a way to free the page. Marking the zone NOFREE is a bad solution, vm_page_free() panics the kernel due to inconsistent tracking of page wiring, and vm_phys_free_pages() causes panics in vm_page_alloc() later on ("page is not free"). What is the correct way to deallocate these pages? Or is there a different approach I should adopt? -Nathan