xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: Tim Deegan <tim@xen.org>
Cc: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>
Subject: Re: [PATCH 14/18 V2]: PVH xen: add xenmem_add_foreign_to_pmap()
Date: Mon, 8 Apr 2013 17:17:58 -0700	[thread overview]
Message-ID: <20130408171758.006e8761@mantra.us.oracle.com> (raw)
In-Reply-To: <20130321174146.GQ12338@ocelot.phlegethon.org>

On Thu, 21 Mar 2013 17:41:46 +0000
Tim Deegan <tim@xen.org> wrote:

> > diff --git a/xen/common/memory.c b/xen/common/memory.c
> > index 68501d1..91a56b6 100644
> > --- a/xen/common/memory.c
> > +++ b/xen/common/memory.c
> > +        /* PVH note: if PVH, the gfn could be mapped to a mfn from
> > foreign
> > +         * domain by the user space tool during domain creation.
> > We need to
> > +         * check for that, free it up from the p2m, and release
> > refcnt on it.
> > +         * In such a case, page would be NULL. */
> > +
> > +        page = get_page_from_gfn(d, xrfp.gpfn, &p2mt, P2M_ALLOC);
> > +        valid_pvh_pg = is_curr_pvh && 
> > +                       (p2m_is_mmio(p2mt) || p2m_is_foreign(p2mt));
> 

Actually, looking at this again, I can't find reason why I can't just change
get_page_from_gfn_p2m() to return page for foreign also:

    if ( likely(!p2m_locked_by_me(p2m)) )
    {   
        /* Fast path: look up and get out */
        p2m_read_lock(p2m);
        mfn = __get_gfn_type_access(p2m, gfn, t, a, 0, NULL, 0);
        if ( (p2m_is_ram(*t) || p2m_is_grant(*t) || p2m_is_foreign(*t)) <====
             && mfn_valid(mfn)
             && !((q & P2M_UNSHARE) && p2m_is_shared(*t)) )
        {
            page = mfn_to_page(mfn);
            if ( !get_page(page, d)
                 /* Page could be shared */
                 && !get_page(page, dom_cow) )
                page = NULL;
        }
......

    /* Slow path: take the write lock and do fixups */
    mfn = get_gfn_type_access(p2m, gfn, t, a, q, NULL);
    if ( p2m_is_ram(*t) && mfn_valid(mfn) ) <=======  Add p2m_is_foreign HERE
    {

Please lmk if you forsee any issues with above.
BTW, in the slow path, why doesn't it check for grant?

Also, I removed the mmio from map, so I can remove from here also.

thanks,
Mukesh

  parent reply	other threads:[~2013-04-09  0:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-16  0:58 [PATCH 14/18 V2]: PVH xen: add xenmem_add_foreign_to_pmap() Mukesh Rathor
2013-03-21 17:41 ` Tim Deegan
2013-04-06  2:07   ` Mukesh Rathor
2013-04-09  0:17   ` Mukesh Rathor [this message]
2013-04-09  1:58     ` 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=20130408171758.006e8761@mantra.us.oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=Xen-devel@lists.xensource.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).