From: Ian Jackson Subject: Re: [PATCH 2/2] libxl: fix stale timeout event callback race Date: Thu, 13 Dec 2012 13:12:27 +0000 Message-ID: <20681.54331.814590.759348@mariner.uk.xensource.com> References: <20678.5159.946248.90947@mariner.uk.xensource.com> <1355158624-11163-2-git-send-email-ian.jackson@eu.citrix.com> <50C7B974.4050706@suse.com> <20680.47971.962603.851882@mariner.uk.xensource.com> <50C8BE3F.4040402@suse.com> <20680.49391.646654.814456@mariner.uk.xensource.com> <50C8C665.2030202@suse.com> <1355394576.10554.62.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1355394576.10554.62.camel@zakaz.uk.xensource.com> 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: Jim Fehlig , Bamvor Jian Zhang , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] [PATCH 2/2] libxl: fix stale timeout event callback race"): > On Wed, 2012-12-12 at 18:01 +0000, Jim Fehlig wrote: > > Hmm, it is not clear to me how to make the libxl driver work correctly > > with libxl pre and post your patches :-/. > > Ideally we will find a way to make this work without changes on the > application side. Yes, but if the application has bugs which are exposed by the new approach I think it is probably simplest to fix those bugs. The way I'm proposing at the moment means that there are two sets of relevant changes to libxl and libvirt: - libxl always use timeout_modify and never _deregister. Officially speaking this is a backwards-compatible change: libxl now promises to use only a strict subset of the documented interface provided by the application. Any correct application will still work. - libvirt implement both _modify and _deregister correctly. With old libxl this leaves the timeout deregistration race. With new libxl there is no problem at all. > One option is to add new hooks which libxl can call to take/release the > application's event loop lock + a LIBXL_HAVE_EVENT_LOOP_LOCK define so > the application can conditionally provide them. The upside is that I > would expect this to result in much simpler code in both libxl and > libvirt. The downside is that doing this kind of sucks from an API > stability point of view, but if the application has to change anyway > then we might as well do it cleanly instead of bending over backwards to > keep the API the same. I don't know what other users there might be who would be hurt by an API change. But I think from a deployment/testing/etc. point of view two separate patches to libxl and libvirt which each make matters strictly better, and which can be applied independently, does seem like the best approach. Ian.