[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxc: cpupools: adjust retry loop in xc_cpupool_removecpu()



commit 15fedd65a83da2972563c5e7e054512f799f6d55
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Fri Apr 15 16:54:16 2016 +0200
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Wed Apr 20 14:44:01 2016 +0100

    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 <Ian.Jackson@xxxxxxxxxxxxx>
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Reviewed-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
    Reviewed-by: Alan Robinson <alan.robinson@xxxxxxxxxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxc/xc_cpupool.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/libxc/xc_cpupool.c b/tools/libxc/xc_cpupool.c
index 261b9c9..bb99e3b 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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.