WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] libxl: make libxl_wait_for_device_model not racy

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxl: make libxl_wait_for_device_model not racy
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Wed, 23 Jun 2010 17:52:39 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Wed, 23 Jun 2010 09:53:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C223B42.3010807@xxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <alpine.DEB.2.00.1006231059110.22638@kaball-desktop> <4C223B42.3010807@xxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Wed, 23 Jun 2010, Jeremy Fitzhardinge wrote:
> On 06/23/2010 12:15 PM, Stefano Stabellini wrote:
> > Hi all,
> > at the moment libxl_wait_for_device_model waits on a xenstore watch
> > before checking the current value of the xenstore node, that might
> > contain already the value the function was looking for.
> > This patch changes libxl_wait_for_device_model so that it checks the
> > value of the xenstore node first, then waits for the watch.
> >   
> 
> That can't help because it's still racy: what if the value changes
> between the first check and the wait?  The watch must fire immediately
> if the value is already in the desired state, or there's an unavoidable
> deadlock.

The check is done after the watch is set, so the wait would return
immediately.

> 
> On the other hand, the check-then-wait pattern reads more clearly, I think.
> 

I agree on this.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel