Skip to contentSkip to conversation

Avoid crash when doing shutdown with active cpupools

PATCH New [email protected] 1 participant 1 message Jul 7, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid crash when doing shutdown with active cpupools

From: Juergen Gross <[email protected]>

When shutting down the machine while there are cpus in a cpupool other than Pool-0 a crash is triggered due to cpupool handling rejecting offlining the non-boot cpus in other cpupools.

It is easy to detect this case and allow offlining those cpus.

---
 xen/common/cpupool.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
xen/common/cpupool.c +15 -3
index 4a0e569..73249d3 100644
@@ -471,12 +471,24 @@ static void cpupool_cpu_add(unsigned int cpu)
  */
 static int cpupool_cpu_remove(unsigned int cpu)
 {
-    int ret = 0;
+    int ret = -EBUSY;
+    struct cpupool **c;
 
     spin_lock(&cpupool_lock);
-    if ( !cpumask_test_cpu(cpu, cpupool0->cpu_valid))
-        ret = -EBUSY;
+    if ( cpumask_test_cpu(cpu, cpupool0->cpu_valid) )
+        ret = 0;
     else
+    {
+        for_each_cpupool(c)
+        {
+            if ( cpumask_test_cpu(cpu, (*c)->cpu_suspended ) )
+            {
+                ret = 0;
+                break;
+            }
+        }
+    }
+    if ( !ret )
         cpumask_set_cpu(cpu, &cpupool_locked_cpus);
     spin_unlock(&cpupool_lock);
 
Signature · 1 line
1.8.4.5