From: Ian Campbell Subject: Re: [hybrid] : mmap pfn space... Date: Mon, 16 Apr 2012 15:14:03 +0100 Message-ID: <1334585643.14560.199.camel@zakaz.uk.xensource.com> References: <20120323110144.4b2f1d45@mantra.us.oracle.com> <20120413184705.77b4d316@mantra.us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20120413184705.77b4d316@mantra.us.oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Mukesh Rathor Cc: "Xen-devel@lists.xensource.com" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Sat, 2012-04-14 at 02:47 +0100, Mukesh Rathor wrote: > On Mon, 26 Mar 2012 11:37:46 +0100 > Stefano Stabellini wrote: > > I think that we should explicitly allocate these pages/addresses and > > not rely on the fact that they are at a specific location that we deem > > safe for now. > > So if we explicitly introduce a new region at the end of the e820 that > > we mark as reserved and we use it for this, I would be OK with that. > > However we need to be careful because editing the e820 has proved to > > be challenging in the past. > > Also we would need to figure out a way to tell Linux that these > > reserved addresses are actually OK to be used. Maybe we need a new > > command line or hypercall for that. > > That sounds like reasonable approach. Lets do it as part of phase II. > I wanna get some basic code in. > > So, to give an update of where I am, good news, I've got guests > finally booting using hybrid dom0. So, that means I am almost there > now!!!! Yeay... Awesome news! > But, the pfn space management for privcmd mapping is still a hack. > Running into many issues. Basially, it is forcing me to write a slab > allocator for the resvd pfn space, that I am trying to avoid. During > guest creation, xl process maps about 10k foreign pgs, and xenstored 1. 10k simultaneously or over the life of a domain build? > I was thinking of just dividing my pfn space into say 10 chunks, each > with 10k pages, so 10 guest creations can happen simultaneously. But, > then xl is not the only process doing the mapping I found out. xenstored > also needs to map domU frames. Otherwise, I could just do one chunk > per process. Also, I am breaking mmap semantics somewhat by hooking > via privcmd_mmap, because the unmaps don't follow any order. So my last > unmap frees the entire 10k chunk it's using. Presumably that's mostly just an issue of doing more accounting/tracking in the privcmd driver (like the gntdev device does) so you can properly release things at the right time/place? > 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 using mmap makes > it harder, can't we just use ioctl to get the VA? Then, I could nicely > do something like: > xl: > - open(privcmd file) > - ioctl(get rsvd/e820 pfn handle) > - ioctl(get VA using above handle) /* alternate to mmap */ > - ioctl(get VA1 using above handle) /* alternate to mmap */ > ... > - ioctl(release handle) > - ioctl(release VA) > - close file > > Is that an option (to change mmap to ioctl)? > > Hope that makes sense, > > thanks, > Mukesh >