xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Simon Beaumont <simon.beaumont@citrix.com>,
	"xs-devel@lists.xenserver.org" <xs-devel@lists.xenserver.org>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: FW: Cancelling asynchronous operations in libxl
Date: Thu, 31 Oct 2013 17:09:12 +0000	[thread overview]
Message-ID: <1383239352.5436.13.camel@dagon.hellion.org.uk> (raw)
In-Reply-To: <21106.27135.289465.658185@mariner.uk.xensource.com>

On Thu, 2013-10-31 at 14:32 +0000, Ian Jackson wrote:
> Ian Campbell writes ("Re: [Xen-devel] FW: Cancelling asynchronous operations in libxl"):
> > The way in which sequential async subops are currently handled (by
> > chaining callbacks) is a bit ugly -- it leads to weird error messages
> > like "libxl__vtpm_foo: Failed" which actually means "couldn't add a
> > NIC" (because that was the previous step, and libxl__vtpm_foo is what
> > picks up the result). Do you think it would be feasible to recast those
> > as sequences of function pointers in an array with a central (common)
> > dispatcher which steps through, handling and reporting errors?
> 
> Hmmm.  It might be.  There's a problem in that they all tend to have
> different arguments.  And the control flow would be split into two
> places.
> 
> Maybe it would be better to improve the error reporting to not rely on
> the function name (which is TBH pretty pants anyway).

Yes. Even just adding a foo_done step would be better. e.g.:

do_nic_stuff -> nic_stuff_done (check nic errors) -> do_vtpm_stuff(vtpm
stuff)

rather than do_nic_stuff -> do_vtpm_stuf(check nic errors, vtpm stuff)
> 
> > If things could be restructured along those lines then adding
> > cancellation support to the dispatcher might get us reasonably good API
> > coverage pretty easily
> 
> Hmm.
> 
> Writing the control flow of all of these in a declarative style would
> be difficult.  There are a lot of ifs and some parallel loops, as well
> as simple sequential execution.

ifs seems like the easier case, you call the function and it returns a
code saying "done" without doing anything (if its that sort of if)
instead of "async work started" or you handle the two cases in the
function etc.

Don't the parallel loops coalesce into a single "everything done"
callback at some point? That seems to obvious place to resync with the
dispatcher.

> I think we would be in danger of writing a full-on coroutine system.
> Maybe that wouldn't be such a bad idea.

Indeed ;-)

> 
> Hmm.
> 
> Ian.

  reply	other threads:[~2013-10-31 17:09 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4B8F5D33B081C044AA43634E84ED7F9616A83D@AMSPEX01CL03.citrite.net>
2013-10-23 17:23 ` FW: Cancelling asynchronous operations in libxl Konrad Rzeszutek Wilk
2013-10-26  8:33   ` Ian Campbell
     [not found]   ` <1382776392.22417.179.camel@hastur.hellion.org.uk>
2013-10-28  9:38     ` Simon Beaumont
2013-10-28 15:52     ` Ian Jackson
2013-10-31 13:52       ` Ian Campbell
2013-10-31 14:32         ` Ian Jackson
2013-10-31 17:09           ` Ian Campbell [this message]
2013-11-08 18:38             ` Ian Jackson
2013-11-20 11:01               ` Ian Campbell
2013-12-20 18:24                 ` Ian Jackson
2013-12-20 18:45                   ` [RFC PATCH 00/14] libxl: Asynchronous event cancellation Ian Jackson
2013-12-20 18:45                     ` [PATCH 01/14] libxl: suspend: switch_logdirty_done takes rc Ian Jackson
2013-12-20 18:45                     ` [PATCH 02/14] libxl: suspend: common suspend callbacks take rc Ian Jackson
2013-12-20 18:45                     ` [PATCH 03/14] libxl: suspend: Return correct error from callbacks Ian Jackson
2013-12-20 18:45                     ` [PATCH 04/14] libxl: Use libxl__xswait* in libxl__ao_device Ian Jackson
2013-12-20 18:45                     ` [PATCH 05/14] libxl: xswait/devstate: Move xswait to before devstate Ian Jackson
2013-12-20 18:45                     ` [PATCH 06/14] libxl: devstate: Use libxl__xswait* Ian Jackson
2013-12-20 18:45                     ` [PATCH 07/14] libxl: New error codes CANCELLED etc Ian Jackson
2013-12-20 18:45                     ` [PATCH 08/14] libxl: events: Permit timeouts to signal cancellation Ian Jackson
2013-12-20 18:45                     ` [PATCH 09/14] libxl: domain create: Do not destroy on cancellation Ian Jackson
2013-12-20 18:45                     ` [PATCH 10/14] libxl: ao: Record ultimate parent of a nested ao Ian Jackson
2013-12-20 18:45                     ` [PATCH 11/14] libxl: ao: Count the nested progeny of an ao Ian Jackson
2013-12-20 18:45                     ` [PATCH 12/14] libxl: ao: Provide manip_refcnt Ian Jackson
2013-12-20 18:45                     ` [PATCH 13/14] libxl: ao: Cancellation API Ian Jackson
2013-12-20 18:45                     ` [PATCH 14/14] libxl: ao: Timeouts are cancellable Ian Jackson
2014-03-14 10:42                   ` FW: Cancelling asynchronous operations in libxl Ian Campbell
2014-03-14 12:32                     ` Simon Beaumont
2014-03-14 17:09                     ` Ian Jackson
2013-10-15 16:08 Simon Beaumont

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1383239352.5436.13.camel@dagon.hellion.org.uk \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=simon.beaumont@citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xs-devel@lists.xenserver.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).