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

[Xen-changelog] [xen master] cpupool: correct error handling when removing cpu from cpupool



commit d62ead2eb23491de50cf65f548d66c2e433de455
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Wed Mar 9 16:44:04 2016 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Mar 9 16:48:30 2016 +0100

    cpupool: correct error handling when removing cpu from cpupool
    
    When schedule_cpu_switch() called from cpupool_unassign_cpu_helper()
    returns an error, the domlist_read_lock isn't released again.
    
    As cpu_disable_scheduler() might have changed affinity of some
    domains domain_update_node_affinity() must be called for all domains
    in the cpupool even in error case.
    
    Even if looking weird it is okay to let the to be removed cpu set in
    cpupool_free_cpus in case of an error returned by
    cpu_disable_scheduler(). Add a comment explaining the reason for this.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Acked-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
---
 xen/common/cpupool.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index 8e7b723..d0189f8 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -312,17 +312,25 @@ static long cpupool_unassign_cpu_helper(void *info)
     rcu_read_lock(&domlist_read_lock);
     ret = cpu_disable_scheduler(cpu);
     cpumask_set_cpu(cpu, &cpupool_free_cpus);
+
+    /*
+     * cpu_disable_scheduler() returning an error doesn't require resetting
+     * cpupool_free_cpus' cpu bit. All error cases should be of temporary
+     * nature and tools will retry the operation. Even if the number of
+     * retries may be limited, the in-between state can easily be repaired
+     * by adding the cpu to the cpupool again.
+     */
     if ( !ret )
     {
         ret = schedule_cpu_switch(cpu, NULL);
         if ( ret )
-        {
             cpumask_clear_cpu(cpu, &cpupool_free_cpus);
-            goto out;
+        else
+        {
+            cpupool_moving_cpu = -1;
+            cpupool_put(cpupool_cpu_moving);
+            cpupool_cpu_moving = NULL;
         }
-        cpupool_moving_cpu = -1;
-        cpupool_put(cpupool_cpu_moving);
-        cpupool_cpu_moving = NULL;
     }
 
     for_each_domain_in_cpupool(d, c)
--
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®.