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>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH v1 7/8]: PVH privcmd changes
Date: Thu, 4 Oct 2012 11:20:48 -0700	[thread overview]
Message-ID: <20121004112048.53767720@mantra.us.oracle.com> (raw)
In-Reply-To: <1349340642.650.227.camel@zakaz.uk.xensource.com>

On Thu, 4 Oct 2012 09:50:42 +0100
Ian Campbell <Ian.Campbell@citrix.com> wrote:

> On Wed, 2012-10-03 at 23:31 +0100, Mukesh Rathor wrote:
> > On Wed, 3 Oct 2012 14:21:35 +0100
> > Ian Campbell <Ian.Campbell@citrix.com> wrote:
> > 
> > > On Fri, 2012-09-21 at 20:21 +0100, Mukesh Rathor wrote:
> > > > +static int pvh_privcmd_resv_pfns(struct vm_area_struct *vma,
> > > > int numpgs)
> > > ...
> > > > +       pvhp->pi_num_pgs = numpgs;
> > > > +       BUG_ON(vma->vm_private_data != (void *)1);
> > > > +       vma->vm_private_data = pvhp; 
> > > 
> > > How does this interact with:
> > > 
> > > static int privcmd_enforce_singleshot_mapping(struct
> > > vm_area_struct *vma) {
> > > 	return (xchg(&vma->vm_private_data, (void *)1) == NULL);
> > > }
> > > 
> > > If someone tries to map a second time then won't this correct the
> > > pvhp in vm_private_data by resetting it to 1? Then when the
> > > original mapping is torn down things all fall apart?
> > > 
> > > Perhaps we need a cmpxchg here? Or to rework the callers a little
> > > bit perhaps.
> > 
> > Right, that's why I had it originally checking for auto xlated and
> > doing something different. I think that is better than to change
> > this and change again. I'll change it back to just putting the ptr
> > here.
> 
> Won't that break because on the second call you will pass in the
> freshly allocated pointer and overwrite the exiting (useful) one with
> it?

No, for xlate, I just check for NULL. I didn't think it was big 
deal to special case xlate in this case. We got so many if xlate 
cases already thru the code. It leaves the semantics easy to 
understand: NULL == avail. 1 == locked PV. PTR == Locked PVH. I'll add
a comment this time :).

thanks,
Mukesh

  reply	other threads:[~2012-10-04 18:20 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
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 [this message]
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=20121004112048.53767720@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 \
    /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).