From: Ian Campbell Subject: Re: [hybrid] : mmap pfn space... Date: Mon, 16 Apr 2012 17:26:10 +0100 Message-ID: <1334593570.14560.230.camel@zakaz.uk.xensource.com> References: <20120323110144.4b2f1d45@mantra.us.oracle.com> <20120413184705.77b4d316@mantra.us.oracle.com> <1334585643.14560.199.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: "Xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Mon, 2012-04-16 at 17:22 +0100, Stefano Stabellini wrote: > On Mon, 16 Apr 2012, Ian Campbell wrote: > > > In a nutshell, I am still trying to figure how to allocate rsvd pfn's > > > for privcmd without writing a slab allocator. > > > > Can't you just use the core get_page function (or > > alloc_xenballooned_pages) and move the associated mfn aside temporarily > > (or not if using alloc_xenballooned_pages)? > > I think that is a good suggestion: if we are trying to get in something > that works but might not be the best solution, then using > alloc_xenballooned_pages to get some pages and then changing the p2m is > the best option: it wastes a non-trivial amount of memory in dom0 but at > least it is known to work well and it wouldn't be an "hack". I don't think it wastes all that much -- even 10k pages is only a few 10s of megabytes for the duration of the build. Also free_xenballooned_pages does the right thing if alloc_xenballooned_pages had to explicitly free some pages to satisfy the allocation. i.e. it will shrink the balloon and re-add those pages to the allocator, it won't leave them in the balloon or something. Ian. > > Give a look at gntdev_alloc_map, gnttab_map_refs and m2p_add_override > for an example.