|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 16/19] libxl: suspend: Abolish usleeps in domain suspend wait
On Tue, 2014-03-04 at 14:56 +0000, Ian Jackson wrote:
> Replace the use of a loop with usleep().
>
> Instead, use a xenstore watch and an event system timeout. xenstore
> fires watches on @releaseDomain when a domain shuts down.
>
> The logic which checks for the state of the domain is unchanged, and
> not ideal, but we will leave that for the next patch.
>
> There is not intended to be any semantic change, other than to make
> the algorithm properly asynchronous and the consequential waiting on
> xenstore, rather than polling.
>
> Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
> ---
> tools/libxl/libxl_dom.c | 80
> ++++++++++++++++++++++++++++++------------
> tools/libxl/libxl_internal.h | 2 ++
> 2 files changed, 60 insertions(+), 22 deletions(-)
>
> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
> index dde7e33..6291115 100644
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -1028,8 +1028,14 @@ static void
> domain_suspend_common_wait_guest(libxl__egc *egc,
> libxl__domain_suspend_state
> *dss);
> static void domain_suspend_common_guest_suspended(libxl__egc *egc,
> libxl__domain_suspend_state *dss);
> +
> static void domain_suspend_common_pvcontrol_suspending(libxl__egc *egc,
> libxl__xswait_state *xswa, int rc, const char *state);
> +static void suspend_common_wait_guest_watch(libxl__egc *egc,
> + libxl__ev_xswatch *xsw, const char *watch_path, const char
> *event_path);
> +static void suspend_common_wait_guest_timeout(libxl__egc *egc,
> + libxl__ev_time *ev, const struct timeval *requested_abs);
> +
> static void domain_suspend_common_failed(libxl__egc *egc,
> libxl__domain_suspend_state *dss);
> static void domain_suspend_common_done(libxl__egc *egc,
> @@ -1175,36 +1181,59 @@ static void
> domain_suspend_common_wait_guest(libxl__egc *egc,
> libxl__domain_suspend_state
> *dss)
> {
> STATE_AO_GC(dss->ao);
> + int rc;
> +
> + LOG(DEBUG, "wait for the guest to suspend");
> +
> + rc = libxl__ev_xswatch_register(gc, &dss->guest_watch,
> + suspend_common_wait_guest_watch,
> + "@releaseDomain");
> + if (rc) goto err;
> +
> + rc = libxl__ev_time_register_rel(gc, &dss->guest_timeout,
> + suspend_common_wait_guest_timeout,
> + 60*1000);
This smells a lot like the xswait stuff you introduced towards the
beginning of the series.
Is the difference just that you cannot read the "path" @releaseDomain?
If so can we paper over that somehow in the helper?
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |