From: "Bamvor Jian Zhang" Subject: Re: [PATCH 2/2] call ao_how callback explicitly Date: Thu, 07 Nov 2013 07:51:43 -0700 Message-ID: <527C43AF02000030000365F3@soto.provo.novell.com> References: <1383643331-6703-1-git-send-email-bjzhang@suse.com> <1383643331-6703-3-git-send-email-bjzhang@suse.com> <21113.5113.251975.983741@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21113.5113.251975.983741@mariner.uk.xensource.com> Content-Disposition: inline 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.Jackson@eu.citrix.com Cc: Jim Fehlig , xen-devel@lists.xen.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org > Bamvor Jian Zhang writes ("[PATCH 2/2] call ao_how callback explicitly"): > > ao_how callback is not called after inserted into list. > > in my test, i directly call it in > > libxl__ao_complete_check_progress_reports. i know it should not > > work like this. Could you give some suggestion about it? > > I'm not sure what you mean. Under what conditions do you not see the > callback happen ? The existing machinery is supposed to take care of > that. Specifically, in the patch you're changing, > libxl__ao_complete_check_progress_reports puts the ao onto > egc->aos_for_callback. On the return path from the libxl event > function back to the application, we are supposed to call > libxl__egc_cleanup, which in turn calls egc_run_callbacks, which > should pick up the aos on aos_for_callback. libxl__egc_cleanup is > called from the event loops in libxl_event_wait and > libxl__ao_inprogress and from the macro EGC_FREE. It should be > impossible for a path to be missed because inside libxl one needs an > egc to call libxl__ao_complete. the libvirt libxl driver register the event handler through libxl_event_register_callbacks, so the libxl_event_wait could not get the event. and if the ao_how is used, the libxl__egc_cleanup in "if ( poller )" statement will not be called either. even if i could expose the libxl_egc_cleanup to libvirt, i still do not know when should i call it? i do not know if there is a event triggered before the ao_how callback should be called. (is there a fd event when the async operation complete?). diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c index b732816..c216651 100644 --- a/tools/libxl/libxl_event.c +++ b/tools/libxl/libxl_event.c @@ -1743,6 +1743,13 @@ void libxl__ao_progress_report(libxl__egc *egc, libxl__ao *ao, } } +void libxl_egc_cleanup(libxl_ctx *ctx) +{ + EGC_INIT(ctx); + libxl__egc_cleanup(egc); + EGC_FREE; + return rc; +} /* * Local variables: diff --git a/tools/libxl/libxl_event.h b/tools/libxl/libxl_event.h index 27a65dc..f0f7376 100644 --- a/tools/libxl/libxl_event.h +++ b/tools/libxl/libxl_event.h @@ -555,6 +555,7 @@ int libxl_childproc_reaped(libxl_ctx *ctx, pid_t, int status) */ void libxl_postfork_child_noexec(libxl_ctx *ctx); +void libxl_egc_cleanup(libxl_ctx *ctx); #endif > > What kind of an ao_how is your application passing to libxl ? ao_how with callback set. > Is your > application multithreaded ? yes. > > Ian. > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel