From: Keir Fraser Date: Tue, 9 Sep 2008 14:33:27 +0000 (+0100) Subject: xc_domain_save: Do not poll-wait for guest to shutdown -- it should X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14111^2~17 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=792f9bc05e1ec6980b81a989d957cf6f38bea7bc;p=xen.git xc_domain_save: Do not poll-wait for guest to shutdown -- it should already be suspended when the (*suspend)() function returns. Signed-off-by: Keir Fraser --- diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index dae4a75df9..c6e1c23c32 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -341,69 +341,20 @@ static int analysis_phase(int xc_handle, uint32_t domid, int p2m_size, static int suspend_and_state(int (*suspend)(void), int xc_handle, int io_fd, int dom, xc_dominfo_t *info) { - int i = 0; - if ( !(*suspend)() ) { ERROR("Suspend request failed"); return -1; } - retry: - - if ( xc_domain_getinfo(xc_handle, dom, 1, info) != 1 ) - { - ERROR("Could not get domain info"); - return -1; - } - - if ( info->dying ) + if ( (xc_domain_getinfo(xc_handle, dom, 1, info) != 1) || + !info->shutdown || (info->shutdown_reason != SHUTDOWN_suspend) ) { - ERROR("domain is dying"); + ERROR("Domain not in suspended state"); return -1; } - if ( info->crashed ) - { - ERROR("domain has crashed"); - return -1; - } - - if ( info->shutdown ) - { - switch ( info->shutdown_reason ) - { - case SHUTDOWN_poweroff: - case SHUTDOWN_reboot: - ERROR("domain has shut down"); - return -1; - case SHUTDOWN_suspend: - return 0; - case SHUTDOWN_crash: - ERROR("domain has crashed"); - return -1; - } - } - - if ( info->paused ) - { - /* Try unpausing domain, wait, and retest. */ - xc_domain_unpause( xc_handle, dom ); - ERROR("Domain was paused. Wait and re-test."); - usleep(10000); /* 10ms */ - goto retry; - } - - if ( ++i < 100 ) - { - ERROR("Retry suspend domain"); - usleep(10000); /* 10ms */ - goto retry; - } - - ERROR("Unable to suspend domain."); - - return -1; + return 0; } /*