From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Tim Deegan <tim@xen.org>, Jan Beulich <JBeulich@suse.com>,
"stefano.stabellini@eu.citrix.com"
<stefano.stabellini@eu.citrix.com>
Subject: Re: [V7 PATCH 5/7] pvh: change xsm_add_to_physmap
Date: Mon, 10 Feb 2014 15:33:18 +0000 [thread overview]
Message-ID: <52F8F13E.1070308@linaro.org> (raw)
In-Reply-To: <1392046038.26657.19.camel@kazak.uk.xensource.com>
On 02/10/2014 03:27 PM, Ian Campbell wrote:
> On Mon, 2014-02-10 at 15:16 +0000, Julien Grall wrote:
>> 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).
>
> Sorry, I misunderstood, I thought you were suggesting that rcu_lock_...
> didn't work for xentrace and so couldn't work for add_to_physmap either
> -- but actually xentrace ends up using add_to_physmap itself.
>
>> 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.
>
> Wouldn't it be incorrect to generically return OK for mapping a
> DOMID_XEN owned page -- at least something needs to validate that the
> particular mfn being mapped is supposed to be shared with the guest in
> question.
It's already the case. By default a xen heap page doesn't belong to
DOMID_XEN. Xen has to explicitly call share_xen_page_with_privileged
guess (see an example in xen/common/trace.c:244) to set DOMID_XEN to the
given page.
>
> TBH, it doesn't seem that this mechanism for sharing xenpages with
> guests is a good fit for PVH or HVM guests/dom0. Perhaps a specific
> mapspace would be more appropriate?
Following my explanation just above, I don't think we need to have a
specific mapspace. XSM and DOMID_XEN will already protect correctly the
mapping of xen heap page.
--
Julien Grall
next prev parent reply other threads:[~2014-02-10 15:33 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 2:38 [V7 PATCH 0/7]: PVH dom0 Mukesh Rathor
2013-12-17 2:38 ` [V7 PATCH 1/7] pvh dom0: move some pv specific code to static functions Mukesh Rathor
2013-12-17 2:38 ` [V7 PATCH 2/7] pvh dom0: construct_dom0 changes Mukesh Rathor
2013-12-17 2:38 ` [V7 PATCH 3/7] pvh dom0: implement XENMEM_add_to_physmap_range for x86 Mukesh Rathor
2013-12-17 13:07 ` Jan Beulich
2013-12-17 13:59 ` Ian Campbell
2013-12-17 14:36 ` Jan Beulich
2013-12-17 14:40 ` Ian Campbell
2013-12-17 15:11 ` Jan Beulich
2013-12-17 15:34 ` Ian Campbell
2013-12-18 7:55 ` Jan Beulich
2013-12-18 10:07 ` Ian Campbell
2013-12-18 10:34 ` Jan Beulich
2013-12-18 10:41 ` Ian Campbell
2013-12-18 10:55 ` Jan Beulich
2013-12-17 23:57 ` Mukesh Rathor
2013-12-18 10:00 ` Ian Campbell
2013-12-17 16:56 ` Jan Beulich
2013-12-17 2:38 ` [V7 PATCH 4/7] pvh dom0: Introduce p2m_map_foreign Mukesh Rathor
2013-12-17 2:38 ` [V7 PATCH 5/7] pvh: change xsm_add_to_physmap Mukesh Rathor
2013-12-17 8:32 ` Jan Beulich
2013-12-18 0:19 ` Mukesh Rathor
2013-12-18 8:07 ` Jan Beulich
2013-12-19 15:50 ` Daniel De Graaf
2013-12-19 19:55 ` Mukesh Rathor
2014-01-28 1:55 ` Mukesh Rathor
2014-01-28 10:31 ` Jan Beulich
2014-01-29 2:08 ` Mukesh Rathor
2014-01-29 10:40 ` Ian Campbell
2014-01-29 11:38 ` Tim Deegan
2014-01-29 11:41 ` Ian Campbell
2014-01-29 11:48 ` Tim Deegan
2014-01-29 11:51 ` Ian Campbell
2014-01-30 1:33 ` Mukesh Rathor
2014-02-09 16:51 ` Julien Grall
2014-02-10 13:42 ` Ian Campbell
2014-02-10 15:16 ` Julien Grall
2014-02-10 15:27 ` Ian Campbell
2014-02-10 15:33 ` Julien Grall [this message]
2014-02-10 15:37 ` Ian Campbell
2014-02-20 2:37 ` Mukesh Rathor
2014-02-20 8:31 ` Jan Beulich
2014-02-12 16:47 ` Julien Grall
2014-02-20 2:22 ` Mukesh Rathor
2014-02-20 13:49 ` Julien Grall
2014-02-21 1:22 ` Mukesh Rathor
2014-02-21 23:53 ` Mukesh Rathor
2014-02-22 0:20 ` Julien Grall
2013-12-17 2:38 ` [V7 PATCH 6/7] pvh dom0: Add and remove foreign pages Mukesh Rathor
2013-12-17 2:38 ` [V7 PATCH 7/7] pvh dom0: add opt_dom0pvh to setup.c Mukesh Rathor
2013-12-17 14:46 ` [V7 PATCH 0/7]: PVH dom0 Konrad Rzeszutek Wilk
2013-12-18 0:14 ` Mukesh Rathor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52F8F13E.1070308@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=JBeulich@suse.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).