@@ -572,6 +572,7 @@ static long cf_check cpupool_unassign_cpu_helper(void *info)
* possible failures:
* - last cpu and still active domains in cpupool
* - cpu just being unplugged
+ * - Attempt to remove boot cpu from cpupool0
*/
static int cpupool_unassign_cpu(struct cpupool *c, unsigned int cpu)
{
@@ -582,7 +583,12 @@ static int cpupool_unassign_cpu(struct cpupool *c, unsigned int cpu)
debugtrace_printk("cpupool_unassign_cpu(pool=%u,cpu=%d)\n",
c->cpupool_id, cpu);
- if ( !cpu_online(cpu) )
+ /*
+ * Cpu0 must remain in cpupool0, otherwise some operations like moving cpus
+ * between cpupools, cpu hotplug, destroying cpupools, shutdown of the host,
+ * might not work in a sane way.
+ */
+ if ( (!c->cpupool_id && !cpu) || !cpu_online(cpu) )
return -EINVAL;
master_cpu = sched_get_resource_cpu(cpu);