From: "Jan Beulich" Subject: Re: [PATCH v5 1/4] xen: introduce a helper to allocate non-contiguous memory Date: Mon, 11 May 2015 14:19:54 +0100 Message-ID: <5550C89A0200007800078F90@mail.emea.novell.com> References: <1431095651-25935-1-git-send-email-roger.pau@citrix.com> <1431095651-25935-2-git-send-email-roger.pau@citrix.com> <555079810200007800078B9D@mail.emea.novell.com> <55507BEA.7030003@citrix.com> <5550A3790200007800078DC1@mail.emea.novell.com> <55509C78.8060807@citrix.com> 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 1Yrncl-0006KK-15 for xen-devel@lists.xenproject.org; Mon, 11 May 2015 13:19:59 +0000 In-Reply-To: <55509C78.8060807@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: =?UTF-8?Q?Roger=20Pau=20Monn=C3=A9?= Cc: Andrew Cooper , Tim Deegan , Stefano Stabellini , Ian Campbell , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 11.05.15 at 14:11, wrote: > El 11/05/15 a les 12.41, Jan Beulich ha escrit: >>>>> On 11.05.15 at 11:52, wrote: >>> El 11/05/15 a les 9.42, Jan Beulich ha escrit: >>>>>>> On 08.05.15 at 16:34, wrote: >>>> There actually is another problem here: You must not free the >>>> pages before having torn down the mapping. An option (to >>>> avoid the need for a memory allocation) might be to zap the >>>> present bits (or whatever their equivalent on ARM) in a first >>>> pass (making sure to flush TLBs), free, and then vunmap(). >>> >>> The aim of this is to catch reads/writes to those mappings while we are >>> tearing them down? >> >> No, that wouldn't be worth it. The aim is to avoid cache attribute >> conflicts between the to be torn down mapping and possible >> immediate re-uses of the pages elsewhere. > > After looking into this I think that this approach is complex to > implement on ARM. OTOH I've realized we could fetch all pages before > vunmap and add them to a temporary linked list (using pg->list) unless > there's a chance this page might be already member of a list. Then > vunmap and finally free all the pages. Does this sound sensible? Yes, of course - very good thought! Jan