From: Tim Deegan Subject: Re: [PATCH v4 1/4] xen: introduce a helper to allocate non-contiguous memory Date: Thu, 7 May 2015 16:32:23 +0100 Message-ID: <20150507153223.GK40948@deinos.phlegethon.org> References: <1431008976-20414-1-git-send-email-roger.pau@citrix.com> <1431008976-20414-2-git-send-email-roger.pau@citrix.com> <20150507152226.GH40948@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YqNmj-0007zG-SJ for xen-devel@lists.xenproject.org; Thu, 07 May 2015 15:32:25 +0000 Content-Disposition: inline In-Reply-To: <20150507152226.GH40948@deinos.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne Cc: xen-devel@lists.xenproject.org, Ian Campbell , Jan Beulich , Andrew Cooper List-Id: xen-devel@lists.xenproject.org At 16:22 +0100 on 07 May (1431015746), Tim Deegan wrote: > At 16:29 +0200 on 07 May (1431016173), Roger Pau Monne wrote: > > The allocator uses independent calls to alloc_heap_pages in order to get the > > desired amount of memory and then maps all the independent physical > > addresses into a contiguous virtual address space. > > > > In order to keep track of this regions a red-black tree is used. > > On x86, at least, the vmap apparatus should be able to tell you what > MFN is mapped by using the linear map to look at the l1e. On ARM, it > looks like we could walk the xen pagetable trie from xen_second[] for > the same effect. > > So I'd suggest adding a vmap_to_mfn() and usign that instead of > building the red-black tree. Also: does this need a clear_page() somewhere to scrub the allocation? If not here, I think it's needed in patches 2 and 3 where you're replacing xzalloc (unless you're sure that the loop will write every byte of the allocation, in which case xzalloc was overkill). Tim.