xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>,
	Tim Deegan <tim@xen.org>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH v1 2/8]: PVH mmu changes
Date: Thu, 4 Oct 2012 18:51:11 -0700	[thread overview]
Message-ID: <20121004185111.2742dd65@mantra.us.oracle.com> (raw)
In-Reply-To: <1349358887.866.40.camel@zakaz.uk.xensource.com>

On Thu, 4 Oct 2012 14:54:47 +0100
Ian Campbell <Ian.Campbell@citrix.com> wrote:

> On Fri, 2012-09-21 at 20:15 +0100, Mukesh Rathor wrote:
> > 
> > +int pvh_rem_xen_p2m(unsigned long spfn, int count)
> > +{
> > +       struct xen_remove_from_physmap xrp;
> > +       int i, rc;
> > +
> > +       for (i=0; i < count; i++) {
> > +               xrp.domid = DOMID_SELF;
> > +               xrp.gpfn = spfn+i;
> > +               rc =
> > HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &xrp);
> 
> It seems that the current implementation of this hypercall in the h/v
> doesn't handle unmapping of foreign pages, since it requires that the
> page be owned by the domain whose P2M it is manipulating.
> 
> How did you fix this on the hypervisor side? I'd like to make sure I
> do things consistently on the ARM side.
> 
> Talking with Tim it seems like having foreign mappings in a p2m is a
> bit tricky and needs a bit of careful thought WRT reference counting
> etc.

Hey Ian,

This is what I've (don't worry about "hybrid" word for now, i'll fix it):

casee XENMEM_remove_from_physmap:
    {
        struct xen_remove_from_physmap xrfp;
        struct page_info *page;
        struct domain *d;
        p2m_type_t p2mt;

        if ( copy_from_guest(&xrfp, arg, 1) )
            return -EFAULT;

        rc = rcu_lock_target_domain_by_id(xrfp.domid, &d);
        if ( rc != 0 )
            return rc;

        if ( xsm_remove_from_physmap(current->domain, d) )
        {
            rcu_unlock_domain(d);
            return -EPERM;
        }

        domain_lock(d);

        page = get_page_from_gfn(d, xrfp.gpfn, &p2mt, P2M_ALLOC);
        if ( page || (is_hybrid_vcpu(current) &&
                      (p2m_is_mmio(p2mt) || p2m_is_foreign(p2mt))) )
        {
            unsigned long argmfn = page ? page_to_mfn(page) : INVALID_MFN;
            guest_physmap_remove_page(d, xrfp.gpfn, argmfn, 0);
            if (page)
                put_page(page);
        }
        else {
            if ( is_hybrid_vcpu(current) )
                gdprintk(XENLOG_WARNING, "%s: Domain:%u gmfn:%lx invalid\n",
                         __FUNCTION__, current->domain->domain_id, xrfp.gpfn);
            rc = -ENOENT;
        }

        domain_unlock(d);

        rcu_unlock_domain(d);

        break;
    }

      reply	other threads:[~2012-10-05  1:51 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 19:15 [PATCH v1 2/8]: PVH mmu changes Mukesh Rathor
2012-09-24 11:55 ` Stefano Stabellini
2012-09-24 12:16   ` Ian Campbell
2012-09-24 12:24     ` Stefano Stabellini
2012-09-26  0:27       ` Mukesh Rathor
2012-09-26 11:10         ` George Dunlap
2012-09-26 11:16         ` Stefano Stabellini
2012-09-24 13:50   ` Konrad Rzeszutek Wilk
2012-09-26  0:09   ` Mukesh Rathor
2012-09-26 11:15     ` Stefano Stabellini
2012-10-01 21:32   ` Mukesh Rathor
2012-10-01 21:44     ` Mukesh Rathor
2012-10-02 11:23       ` Stefano Stabellini
2012-10-02 22:22         ` Mukesh Rathor
2012-10-02 10:46     ` Stefano Stabellini
2012-10-03 18:27   ` Mukesh Rathor
2012-10-04  8:18     ` Ian Campbell
2012-09-24 14:04 ` Stefano Stabellini
2012-09-24 14:13   ` Ian Campbell
2012-09-26  0:33   ` Mukesh Rathor
2012-09-26 11:25     ` Stefano Stabellini
2012-09-26 13:54 ` Konrad Rzeszutek Wilk
2012-10-02 10:49 ` Stefano Stabellini
2012-10-03 15:42 ` Ian Campbell
2012-10-03 22:29   ` Mukesh Rathor
2012-10-04  8:27     ` Ian Campbell
2012-10-04 18:27       ` Mukesh Rathor
2012-10-04 18:42         ` Konrad Rzeszutek Wilk
2012-10-05  9:25         ` Ian Campbell
2012-10-06  2:00       ` Mukesh Rathor
2012-10-08  9:31         ` Ian Campbell
2012-10-04  8:31     ` Ian Campbell
2012-10-05  1:17       ` Mukesh Rathor
2012-10-05  9:26         ` Ian Campbell
2012-10-04 13:54 ` Ian Campbell
2012-10-05  1:51   ` Mukesh Rathor [this message]

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=20121004185111.2742dd65@mantra.us.oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=konrad.wilk@oracle.com \
    --cc=tim@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).