xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Andrii Tseglytskyi <andrii.tseglytskyi@globallogic.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH v03 01/10] xen: implement guest_physmap_pin_range
Date: Wed, 10 Sep 2014 18:12:46 -0700	[thread overview]
Message-ID: <5410F70E.9040806@linaro.org> (raw)
In-Reply-To: <1409672770-23164-2-git-send-email-andrii.tseglytskyi@globallogic.com>

Hi Andrii,

On 02/09/14 08:46, Andrii Tseglytskyi wrote:
>   int guest_physmap_mark_populate_on_demand(struct domain *d,
>                                             unsigned long gfn,
>                                             unsigned int order)
> @@ -478,10 +551,18 @@ static int apply_one_level(struct domain *d,
>       struct p2m_domain *p2m = &d->arch.p2m;
>       lpae_t pte;
>       const lpae_t orig_pte = *entry;
> +    struct page_info *page = NULL;
>       int rc;
>
>       BUG_ON(level > 3);
>
> +    if ( guest_physmap_pinned_range(d, orig_pte.p2m.base, 0) )

This change is wrong, orig_pte.p2m.base may not be valid. I think you 
have to do this check only on REMOVE and INSERT op.

Also few general questions about this patch:
   - What about the destruction of the domain? Shouldn't you remove the 
flag?
   - In case of REMOVE, if the page is pinned, the error value will be 
ignored (this is because guest_physmap_remove_page is returning void). 
So the upper code (see guest_remove_page in common/memory.c) will think 
the mapping has effectively been removed and will put back the page to 
the memory allocator... This is because we don't take a reference when 
is mapped.

Overall, AFIU your usage in this patch, I don't think we care if the 
guest decides to remove the page from the P2M. The most important things 
is to avoid Xen using the page for another guest. I suspect this could 
be done by taking a reference on the page.

Regards,

-- 
Julien Grall

  parent reply	other threads:[~2014-09-11  1:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 15:46 [PATCH v03 00/10] arm: introduce remoteprocessor iommu module Andrii Tseglytskyi
2014-09-02 15:46 ` [PATCH v03 01/10] xen: implement guest_physmap_pin_range Andrii Tseglytskyi
2014-09-03  9:43   ` Jan Beulich
2014-09-11  1:12   ` Julien Grall [this message]
2014-09-02 15:46 ` [PATCH v03 02/10] domctl: introduce access_remote_pagetable call Andrii Tseglytskyi
2014-09-03  9:46   ` Jan Beulich
2014-09-02 15:46 ` [PATCH v03 03/10] xsm: arm: create domU_rpc_t security label Andrii Tseglytskyi
2014-09-02 15:46 ` [PATCH v03 04/10] arm: introduce remoteprocessor iommu module Andrii Tseglytskyi
2014-09-11  0:41   ` Julien Grall
2014-09-02 15:46 ` [PATCH v03 05/10] arm: omap: introduce iommu translation for IPU remoteproc Andrii Tseglytskyi
2014-09-02 15:46 ` [PATCH v03 06/10] arm: omap: introduce iommu translation for GPU remoteproc Andrii Tseglytskyi
2014-09-02 15:46 ` [PATCH v03 07/10] arm: introduce remoteproc_mmu_translate_pagetable mem subops call Andrii Tseglytskyi
2014-09-03  9:48   ` Jan Beulich
2014-09-13  0:04   ` Stefano Stabellini
2014-09-02 15:46 ` [PATCH v03 08/10] arm: add trap for remoteproc mmio accesses Andrii Tseglytskyi
2014-09-03  9:52   ` Jan Beulich
2014-09-02 15:46 ` [PATCH v03 09/10] arm: omap: introduce print pagetable function for IPU remoteproc Andrii Tseglytskyi
2014-09-02 15:46 ` [PATCH v03 10/10] arm: omap: introduce print pagetable function for GPU remoteproc Andrii Tseglytskyi

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=5410F70E.9040806@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=andrii.tseglytskyi@globallogic.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-devel@lists.xen.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).