From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: [PATCH v1 7/8]: PVH privcmd changes Date: Mon, 8 Oct 2012 13:46:54 -0700 Message-ID: <20121008134654.588b35ac@mantra.us.oracle.com> References: <20120921122123.33489ce1@mantra.us.oracle.com> <1349270495.650.144.camel@zakaz.uk.xensource.com> <20121003153106.65237f07@mantra.us.oracle.com> <1349340642.650.227.camel@zakaz.uk.xensource.com> <20121004112048.53767720@mantra.us.oracle.com> <1349428878.20946.18.camel@zakaz.uk.xensource.com> <20121005142240.340815be@mantra.us.oracle.com> <1349688102.18008.34.camel@zakaz.uk.xensource.com> <20121008121059.60094d43@mantra.us.oracle.com> <1349724405.6952.53.camel@dagon.hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1349724405.6952.53.camel@dagon.hellion.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "Xen-devel@lists.xensource.com" , Stefano Stabellini , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org On Mon, 8 Oct 2012 20:26:45 +0100 Ian Campbell wrote: > On Mon, 2012-10-08 at 20:10 +0100, Mukesh Rathor wrote: > > On Mon, 8 Oct 2012 10:21:42 +0100 > > Ian Campbell wrote: > > > > > On Fri, 2012-10-05 at 22:22 +0100, Mukesh Rathor wrote: > > > > On Fri, 5 Oct 2012 10:21:18 +0100 > > > > Ian Campbell wrote: > > > > > > > > > On Thu, 2012-10-04 at 19:20 +0100, Mukesh Rathor wrote: > > > > > > On Thu, 4 Oct 2012 09:50:42 +0100 > > > > if (xen_feature(XENFEAT_auto_translated_physmap)) { > > > > int sz = sizeof(vma->vm_private_data); > > > > return (!__cmpxchg(&vma->vm_private_data, NULL, > > > > NULL, sz)); > > > > > > Passing NULL for both old and new values can't be right, can it? > > > Did you test with something which tries to map twice? > > > > well, if it's already set to pointer, then __cmpxchg would leave > > the ptr alone and return it. The function would then return false > > which would fail the api. OTOH, if it's NULL, it would continue and > > get set later. > > What happens if a second thread tries to create a mapping while the > first is between the cmpxchg and the assignment? i.e. while the value > is still NULL. Ah, right, I forgot multi threaded...