xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH v1 7/8]: PVH privcmd changes
Date: Tue, 25 Sep 2012 18:28:48 -0700	[thread overview]
Message-ID: <20120925182848.52978702@mantra.us.oracle.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1209241504410.29232@kaball.uk.xensource.com>

On Mon, 24 Sep 2012 15:24:16 +0100
Stefano Stabellini <stefano.stabellini@eu.citrix.com> wrote:

> On Fri, 21 Sep 2012, Mukesh Rathor wrote:
> > ---
> >  drivers/xen/privcmd.c |   77
> > ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed,
> > 70 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
> > index ccee0f1..195d89f 100644
> > -				       st->vma->vm_page_prot,
> > st->domain) < 0) {
> > +	if (xen_remap_domain_mfn_range(vma, st->va & PAGE_MASK,
> > *mfnp, 1,
> > +				       vma->vm_page_prot,
> > st->domain, 
> > +				       pvhp) < 0) {
> >  		*mfnp |= 0xf0000000U;
> >  		st->err++;
> >  	}
> 
> I don't like that a parameter like "xen_pvh_pfn_info" has been added
> to a generic arch-agnostic function like xen_remap_domain_mfn_range.
> 
> If you need to pass more parameters to xen_remap_domain_mfn_range, it
> should be done in a cross-architecture way. In fact, keep in mind that
> privcmd.c compiles on ARM (and IA64?) as well.
> 
> I think that in this particular case you are using pvh to actually
> specify auto_translate_physmap, am I correct?
> Maybe we just need to rename xen_pvh_pfn_info to xen_xlat_pfn_info.

Ok, I renamed it. And for the API, as I mentioned in prev email,
I changed xen_remap_domain_mfn_range to have last parameter be 
called void *arch_specific_info.

> 
> > @@ -274,6 +284,40 @@ static int mmap_return_errors(void *data, void
> > +		return -ENOMEM;
> > +	}
> > +
> > +	rc = alloc_xenballooned_pages(numpgs, pvhp->pi_paga, 0);
> > +	if (rc != 0) {
> > +		pr_warn("%s Could not alloc %d pfns rc:%d\n",
> > __FUNCTION__, 
> > +			numpgs, rc);
> > +		kfree(pvhp->pi_paga);
> > +		kfree(pvhp);
> > +		return -ENOMEM;
> > +	}
> > +	pvhp->pi_num_pgs = numpgs;
> > +	BUG_ON(vma->vm_private_data != (void *)1);
> 
> what?

See privcmd_enforce_singleshot_mapping().

> >  
> > +	if (xen_pv_domain() &&
> > xen_feature(XENFEAT_auto_translated_physmap)) {
> > +		if ((ret=pvh_privcmd_resv_pfns(vma, m.num))) {
> 
> I would change this into:
> 
>     if ((ret = pvh_privcmd_resv_pfns(vma, m.num)) < 0) {
> 

OK.


> > +	count = xen_unmap_domain_mfn_range(vma, pvhp);
> > +	while (count--)
> > +		free_xenballooned_pages(1, &pvhp->pi_paga[count]);
> > +	kfree(pvhp->pi_paga);
> > +	kfree(pvhp);
> 
> So xen_remap_domain_mfn_range adds the mappings to the vma, while
> xen_unmap_domain_mfn_range does not remove them. I take that somehow
> this is done by the generic Linux code that calls into this function?

Correct. The kernel MMU seems to do all cleanup before calling
privcmd_close.

  parent reply	other threads:[~2012-09-26  1:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 19:21 [PATCH v1 7/8]: PVH privcmd changes Mukesh Rathor
2012-09-24 14:24 ` Stefano Stabellini
2012-09-25 13:44   ` Ian Campbell
2012-09-26  1:28   ` Mukesh Rathor [this message]
2012-09-26 13:13     ` Konrad Rzeszutek Wilk
2012-09-25 13:46 ` Ian Campbell
2012-10-02 10:54 ` Stefano Stabellini
2012-10-03 13:21 ` Ian Campbell
2012-10-03 22:31   ` Mukesh Rathor
2012-10-04  8:50     ` Ian Campbell
2012-10-04 18:20       ` Mukesh Rathor
2012-10-05  9:21         ` Ian Campbell
2012-10-05 17:34           ` Mukesh Rathor
2012-10-05 21:22           ` Mukesh Rathor
2012-10-08  9:21             ` Ian Campbell
2012-10-08 19:10               ` Mukesh Rathor
2012-10-08 19:26                 ` Ian Campbell
2012-10-08 20:46                   ` 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=20120925182848.52978702@mantra.us.oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=konrad.wilk@oracle.com \
    --cc=stefano.stabellini@eu.citrix.com \
    /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).