From: Ian Jackson Subject: Re: [PATCH v1 12/12] libxl: add device backend listener in order to launch backends Date: Thu, 7 Nov 2013 16:35:45 +0000 Message-ID: <21115.49505.48339.985424@mariner.uk.xensource.com> References: <1380705874-58491-1-git-send-email-roger.pau@citrix.com> <1380705874-58491-13-git-send-email-roger.pau@citrix.com> <21105.15127.428243.701439@mariner.uk.xensource.com> <5277D362.4040300@citrix.com> <21111.55145.501074.162529@mariner.uk.xensource.com> <21111.57474.653370.258557@mariner.uk.xensource.com> <1383819735.26213.150.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VeSYh-0001DR-7o for xen-devel@lists.xenproject.org; Thu, 07 Nov 2013 16:35:51 +0000 In-Reply-To: <1383819735.26213.150.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: xen-devel@lists.xenproject.org, Roger Pau =?utf-8?Q?Monn=C3=A9?= List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [PATCH v1 12/12] libxl: add device backend listener in order to launch backends"): > On Mon, 2013-11-04 at 17:59 +0000, Ian Jackson wrote: > > + assert(parent->magic == LIBXL__AO_MAGIC); > > Is the intention to allow multiple levels of nesting or would it be a > good idea to have an assert(!parent->nested) here? I don't think there is anything wrong with multiple levels of nesting although I'm hoping no-one will find a use for it! > In either case it would be good to be explicit in the comment, either > here or in the header. Sure. > > /* > > + * Short-lived sub-ao, aka "nested ao". > > + * > > + * Some asynchronous operations are very long-running. Generally, > > + * since an ao has a gc, any allocations made in that ao will live > > + * until the ao is completed. When this is not desirable, these > > + * functions may be used to manage a "sub-ao". > > + * > > + * The returned sub-ao is suitable for passing to gc-related functions > > + * and macros such as libxl__ao_inprogress_gc, AO_GC, and STATE_AO_GC. > > + * > > + * It MUST NOT be used with AO_INPROGRESS, AO_ABORT, > > + * libxl__ao_complete, libxl__ao_progress_report, and so on. > > + * > > + * The caller must ensure that all of the sub-ao's are freed before > > + * the parent is. > > OOI what causes this requirement? If there is no first-class ao running, then nothing might be running the libxl event loop and the "escaped" sub-ao might never make progress. So the requirement is there to stop people writing a broken daemonic sub-ao (ie, one which outlives its parent). It's slightly stricter than the actual requirement for correctness, which is that _some_ ao must still continue. But I'm hoping that no-one wants to have some more complicated semantic relationship between a sub-ao and the system's real ao's than parenthood. Ian.