mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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@suse.com> Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
This commit is contained in:
1 parent
0aa1330aac
commit
d62ead2eb2
1 file changed
+13
-5
+13
-5
@@ -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)
|
||||
|
||||