From: "Jan Beulich" Subject: Re: [PATCH 2/4] xen: introduce grant_map_exists Date: Thu, 02 Oct 2014 12:45:55 +0100 Message-ID: <542D5713020000780003BF29@mail.emea.novell.com> References: <1412244158-12124-2-git-send-email-stefano.stabellini@eu.citrix.com> <20141002101741.GC43394@deinos.phlegethon.org> <542D5386020000780003BE78@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: 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: Stefano Stabellini Cc: julien.grall@citrix.com, xen-devel@lists.xensource.com, Tim Deegan , Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 02.10.14 at 13:37, wrote: > On Thu, 2 Oct 2014, Jan Beulich wrote: >> >>> On 02.10.14 at 12:42, wrote: >> > On Thu, 2 Oct 2014, Tim Deegan wrote: >> >> At 11:02 +0100 on 02 Oct (1412244156), Stefano Stabellini wrote: >> >> > Check whether an mfn has been granted to a given domain on a target >> >> > grant table. >> >> >> >> The implementation looks good but I'm concerned about the need for it, >> >> since linear scans of busy grant tables could get fairly expensive. >> >> >> >> I see in patch 3/4 you add a hypercall to flush caches, taking an mfn >> >> range. Should that not take a gfn range? That would be the idiomatic >> >> interface, and the p2m lookup would tell you whether the guest had >> >> appropiate rights. >> >> >> >> I suspect, from reading 0/4, that I'm missing something about the >> >> tangle of non-IOMMU dom0 operations on ARM. :) >> > >> > The hypercall is going to be used to flush foreign pages grant mapped in >> > Dom0. Unfortunately dom0 doesn't know the gfn, only the dma address >> > (==mfn). >> >> Don't grant maps get entered into the P2M as they get established? > > Yes, they do. Still dom0 only has an mfn in its hands. Tracking the mfn > to pfn relationship in Linux has been tried unsuccessfully before. Not > only it is slow but it is also difficult as the same page can be granted > multiple times simultaneously. It can't be that difficult for Dom0 to track at which PFN is maps a particular grant. And as long as Dom0 serializes properly wrt unmaps, which GFN of the perhaps multiple ones it picks for doing the cache flush doesn't even matter. Jan