From: "Jan Beulich" Subject: Re: [PATCH v2 2/2] xen/arm: introduce XENFEAT_grant_map_identity Date: Thu, 24 Jul 2014 12:58:57 +0100 Message-ID: <53D111210200007800025823@mail.emea.novell.com> References: <1406135982-15487-2-git-send-email-stefano.stabellini@eu.citrix.com> <53D0C86802000078000255AF@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XAHfo-0006Kt-4C for xen-devel@lists.xenproject.org; Thu, 24 Jul 2014 11:59:00 +0000 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 , Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 24.07.14 at 12:47, wrote: > On Thu, 24 Jul 2014, Jan Beulich wrote: >> >>> On 23.07.14 at 19:19, wrote: >> > @@ -727,7 +727,7 @@ __gnttab_map_grant_ref( >> > >> > double_gt_lock(lgt, rgt); >> > >> > - if ( gnttab_need_iommu_mapping(ld) ) >> > + if ( gnttab_need_iommu_mapping(ld) || is_domain_direct_mapped(ld) ) >> >> This is bogus: On x86 the right part is always false, while on >> ARM the right part is already part of gnttab_need_iommu_mapping(). >> IOW no need to change anything here afaict. > > On ARM gnttab_need_iommu_mapping expands to > > #define gnttab_need_iommu_mapping(d) \ > (is_domain_direct_mapped(d) && need_iommu(d)) > > however we would need to do the second mapping even if need_iommu(d) > returns false. Changing gnttab_need_iommu_mapping(d) on ARM the way I > did in the previous version of the patch series seems wrong to me now, > because it is not an iommu mapping that gnttab needs, but a second > regular p2m mapping. > > This is way I decided to add the "|| is_domain_direct_mapped(ld)". I guessed that you did it for reasons along those lines. But unless we're certain the compiler will always fold the redundant expressions and unless you're certain the redundancy won't cause future similar questions by readers of the code, I'd suggest to drop the addition. Jan