From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [V7 PATCH 5/7] pvh: change xsm_add_to_physmap Date: Mon, 10 Feb 2014 15:16:01 +0000 Message-ID: <52F8ED31.609@linaro.org> 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> <1390992026.31814.63.camel@kazak.uk.xensource.com> <20140129113846.GA54797@deinos.phlegethon.org> <1390995662.31814.76.camel@kazak.uk.xensource.com> <20140129114837.GB54797@deinos.phlegethon.org> <1390996295.31814.84.camel@kazak.uk.xensource.com> <20140129173315.592e593e@mantra.us.oracle.com> <52F7B213.3000302@linaro.org> <1392039724.5117.94.camel@kazak.uk.xensource.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 1WCsai-0000gP-FP for xen-devel@lists.xenproject.org; Mon, 10 Feb 2014 15:16:12 +0000 Received: by mail-ea0-f176.google.com with SMTP id h14so3062900eaj.7 for ; Mon, 10 Feb 2014 07:16:10 -0800 (PST) In-Reply-To: <1392039724.5117.94.camel@kazak.uk.xensource.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: Ian Campbell Cc: xen-devel , Tim Deegan , Jan Beulich , "stefano.stabellini@eu.citrix.com" List-Id: xen-devel@lists.xenproject.org Hi Ian, On 02/10/2014 01:42 PM, Ian Campbell wrote: > On Sun, 2014-02-09 at 16:51 +0000, Julien Grall wrote: >> Hello Mukesh, >> >> On 30/01/14 01:33, Mukesh Rathor wrote: >>>>> I'm not sure what you mean: >>>>> - the code that Mukesh is adding doesn't have a struct page, it's >>>>> just grabbing the foreign domid from the hypercall arg; >>>>> - if we did have a struct page, we'd just need to take a ref to >>>>> stop the owner changing underfoot; and >>>>> - get_pg_owner() takes a domid anyway. >>>> >>>> Sorry, I was confused/mislead by the name... >>>> >>>> rcu_lock_live_remote_domain_by_id does look like what is needed. >> >> Following the xentrace tread: >> http://www.gossamer-threads.com/lists/xen/devel/315883, >> rcu_lock_live_remote_domain_by_id will not correctly works. >> >> On Xen on ARM, xentrace is using this hypercall to map XEN page (via >> DOMID_XEN). In this case, rcu_lock_*domain* will always fails which will >> prevent xentrace to works on Xen on ARM (and on PVH). > > I'm not sure how that extends to add_to_physmap though -- doing add to > physmap of a DOMID_XEN owned page through the "back door" in this way > isn't supposed to work. Currently xentrace is using xc_map_foreign_page to map the trace buffer (with DOMID_XEN in argument). AFAIK, on x86 PV domain, this called is resulting by an HYPERVISOR_mmu_update which allow do map xen page on priviliged domain (with the dummy XSM policy). For ARM, a call to xc_map_foreign_page will end up to XENMEM_add_to_physmap_range(XENMAPSPACE_gmfn_foreign). For both architecture, you can look at the function xen_remap_map_domain_mfn_range (implemented differently on ARM and x86) which is the last function called before going to the hypervisor. If we don't modify the hypercall XENMEM_add_to_physmap, we will have a add a new way to map Xen page for xentrace & co. -- Julien Grall