From: Ian Campbell Subject: Re: [V7 PATCH 5/7] pvh: change xsm_add_to_physmap Date: Wed, 29 Jan 2014 10:40:26 +0000 Message-ID: <1390992026.31814.63.camel@kazak.uk.xensource.com> References: <1387247911-28846-1-git-send-email-mukesh.rathor@oracle.com> <1387247911-28846-6-git-send-email-mukesh.rathor@oracle.com> <20140127175550.4cc67171@mantra.us.oracle.com> <52E7951802000078001177F6@nat28.tlf.novell.com> <20140128180802.152b3f8d@mantra.us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1W8SZL-0000dV-0I for xen-devel@lists.xenproject.org; Wed, 29 Jan 2014 10:40:31 +0000 In-Reply-To: <20140128180802.152b3f8d@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 , Jan Beulich , "stefano.stabellini@eu.citrix.com" List-Id: xen-devel@lists.xenproject.org On Tue, 2014-01-28 at 18:08 -0800, Mukesh Rathor wrote: > On Tue, 28 Jan 2014 10:31:36 +0000 > "Jan Beulich" wrote: > > > >>> On 28.01.14 at 02:55, Mukesh Rathor > > >>> wrote: > > > --- a/xen/common/memory.c > > > +++ b/xen/common/memory.c > .... > > The only think x86-specific here is that {get,put}_pg_owner() may > > not exist on ARM. But the general operation isn't x86-specific, so > > there shouldn't be any CONFIG_X86 dependency here. Instead > > you ought to work out with the ARM maintainers whether to stub > > out those two functions, or whether the functionality is useful > > there too (and hence proper implementations would be needed). > > > > In the latter case I would then also wonder whether the x86 > > implementation shouldn't be moved into common code. > > Stefano/Ian: > > If you have use for get_pg_owner() I can stub it out for now and > have it return 1, as NULL would result in error. Otherwise, I can > change the function prototype to return rc with ARM always returning > 0 and not doing anything, like: > > if ( xatpb.space == XENMAPSPACE_gmfn_foreign ) > { > if ( (rc = get_pg_owner(xatpb.foreign_domid, &fd)) ) > { > rcu_unlock_domain(d); > return rc; > } > } > > which on ARM would always return 0, setting fd to NULL. > > If you think it would be needed in ARM, I can just leave the function > prototype the same and you guys can implement whenever as I don't have the > insight into ARM, and if it looks the same as x86 you can commonise it too. Yes, please just make get/put_pg_owner common. The only required change would be to: if ( unlikely(paging_mode_translate(curr)) ) { MEM_LOG("Cannot mix foreign mappings with translated domains"); goto out; } which is not needed for ARM, and I suspect needs adjusting for PVH too (ah, there it is in the next patch). I think the best solution there would be a new predicate e.g. paging_mode_supports_foreign(curr) (or some better name, I don't especially like my suggestion) on ARM: #define paging_mode_supports_foreign(d) (1) on x86: #define paging_mode_support_foreign(d) (is_pvh_domain(curr) || !(paging_mode_translate(curr)) Thanks, Ian.