[xen stable-4.10] cpupools: fix state when downing a CPU failed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.10] cpupools: fix state when downing a CPU failed

patchbot
commit 3607213d2c96e657b0b09d51b6c86dd4970d215f
Author:     Jan Beulich <[hidden email]>
AuthorDate: Mon Jul 30 11:38:38 2018 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Mon Jul 30 11:38:38 2018 +0200

    cpupools: fix state when downing a CPU failed
   
    While I've run into the issue with further patches in place which no
    longer guarantee the per-CPU area to start out as all zeros, the
    CPU_DOWN_FAILED processing looks to have the same issue: By not zapping
    the per-CPU cpupool pointer, cpupool_cpu_add()'s (indirect) invocation
    of schedule_cpu_switch() will trigger the "c != old_pool" assertion
    there.
   
    Clearing the field during CPU_DOWN_PREPARE is too early (afaict this
    should not happen before cpu_disable_scheduler()). Clearing it in
    CPU_DEAD and CPU_DOWN_FAILED would be an option, but would take the same
    piece of code twice. Since the field's value shouldn't matter while the
    CPU is offline, simply clear it (implicitly) for CPU_ONLINE and
    CPU_DOWN_FAILED, but only for other than the suspend/resume case (which
    gets specially handled in cpupool_cpu_remove()).
   
    By adjusting the conditional in cpupool_cpu_add() CPU_DOWN_FAILED
    handling in the suspend case should now also be handled better.
   
    Signed-off-by: Jan Beulich <[hidden email]>
    Reviewed-by: Juergen Gross <[hidden email]>
    master commit: cb1ae9a27819cea0c5008773c68a7be6f37eb0e5
    master date: 2018-07-19 09:41:55 +0200
---
 xen/common/cpupool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index 999839444e..1e8edcbd57 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -490,7 +490,7 @@ static int cpupool_cpu_add(unsigned int cpu)
     cpumask_clear_cpu(cpu, &cpupool_locked_cpus);
     cpumask_set_cpu(cpu, &cpupool_free_cpus);
 
-    if ( system_state == SYS_STATE_resume )
+    if ( system_state == SYS_STATE_suspend || system_state == SYS_STATE_resume )
     {
         struct cpupool **c;
 
@@ -522,6 +522,7 @@ static int cpupool_cpu_add(unsigned int cpu)
          * (or unplugging would have failed) and that is the default behavior
          * anyway.
          */
+        per_cpu(cpupool, cpu) = NULL;
         ret = cpupool_assign_cpu_locked(cpupool0, cpu);
     }
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog