From: Juergen Gross Date: Fri, 15 Apr 2016 14:54:16 +0000 (+0200) Subject: libxc: cpupools: adjust retry loop in xc_cpupool_removecpu() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=15fedd65a83da2972563c5e7e054512f799f6d55;p=people%2Froyger%2Fxen.git libxc: cpupools: adjust retry loop in xc_cpupool_removecpu() Commit 1ef6beea187b ("libxc: do some retries in xc_cpupool_removecpu() for EBUSY case") added a retry loop in xc_cpupool_removecpu() for the EBUSY case. As EBUSY was returned in multiple error situations the loop would have been executed in situations where a retry would not be successful. Additionally calling sleep(1) between the rerires is a bad idea when being called in a daemon. The hypervisor has been changed to return different error values now. The retry added in above mentioned commit should be done in the EADDRINUSE case now. As the error condition should last only for a very short time, the sleep(1) call can be removed. Requested-by: Ian Jackson Signed-off-by: Juergen Gross Acked-by: Ian Jackson Reviewed-by: Dario Faggioli Reviewed-by: Alan Robinson Release-acked-by: Wei Liu --- diff --git a/tools/libxc/xc_cpupool.c b/tools/libxc/xc_cpupool.c index 261b9c956e..bb99e3bed3 100644 --- a/tools/libxc/xc_cpupool.c +++ b/tools/libxc/xc_cpupool.c @@ -139,7 +139,7 @@ int xc_cpupool_addcpu(xc_interface *xch, } /* - * The hypervisor might return EBUSY when trying to remove a cpu from a + * The hypervisor might return EADDRINUSE when trying to remove a cpu from a * cpupool when a domain running in this cpupool has pinned a vcpu * temporarily. Do some retries in this case, perhaps the situation * cleans up. @@ -160,9 +160,7 @@ int xc_cpupool_removecpu(xc_interface *xch, sysctl.u.cpupool_op.cpu = (cpu < 0) ? XEN_SYSCTL_CPUPOOL_PAR_ANY : cpu; for ( retries = 0; retries < NUM_RMCPU_BUSY_RETRIES; retries++ ) { err = do_sysctl_save(xch, &sysctl); - if ( err < 0 && errno == EBUSY ) - sleep(1); - else + if ( err == 0 || errno != EADDRINUSE ) break; } return err;