From: Ian Jackson Subject: Re: FW: Cancelling asynchronous operations in libxl Date: Fri, 20 Dec 2013 18:24:04 +0000 Message-ID: <21172.35652.484647.666791@mariner.uk.xensource.com> References: <4B8F5D33B081C044AA43634E84ED7F9616A83D@AMSPEX01CL03.citrite.net> <20131023172329.GE28413@phenom.dumpdata.com> <1382776392.22417.179.camel@hastur.hellion.org.uk> <21102.34850.365297.10422@mariner.uk.xensource.com> <1383227549.25018.60.camel@dagon.hellion.org.uk> <21106.27135.289465.658185@mariner.uk.xensource.com> <1383239352.5436.13.camel@dagon.hellion.org.uk> <21117.12223.847323.32317@mariner.uk.xensource.com> <1384945311.28441.42.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1384945311.28441.42.camel@kazak.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: Simon Beaumont , "xs-devel@lists.xenserver.org" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] FW: Cancelling asynchronous operations in libxl"): > On Fri, 2013-11-08 at 18:38 +0000, Ian Jackson wrote: > > I've been thinking about this some more and looking at the code. > > > > I have the following sketch of an approach: I have now an RFC patch series, which I'm going to send as a reply to this email. > > * Somehow the ao_how API is changed to make it possible to return the > > ao to the caller (in the case of an asynchronous ao). I did this differently. The caller is expected to provide a copy of their previous ao_how, which hopefully is sufficiently unique (this is the responsibility of the application). This seems to deal satisfactorily with the lifetime issues. > The following 6 things are all internal to libxl, right? > [stuff] Yes. > > * The fork machinery is changed to take an ao, and register a > > cancellation hook. A suitable-for-default-uses cancellation hook > > function is provided which sends SIGKILL to the child and makes a > > note that this has happened. The child death callback provides an > > rc value (0 for status==0, or FAIL or CANCEL) for the convenience > > of the next layer up. I have not yet done this in my RFC series. > > A tricky question arises regarding cleanup: for example, if > > libxl_domain_create_* were cancelled. It would end up in > > domcreate_complete with rc==CANCEL. > > > > Should it now run the domain destruction ? How would the caller say > > they wanted that cancelled, if that too was taking too long ? Perhaps > > there should be a progress callback to say "we have finished > > cancelling the first thing and are now cleaning up". I decided to not do the destruction in the cancellation case. Ian.