Skip to contentSkip to conversation

xen/sched: fix resuming from S3 with smt=0

PATCH In review Juergen Gross 2 participants 2 messages Jan 5, 2020 – Jan 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/sched: fix resuming from S3 with smt=0

When resuming from S3 and smt=0 or maxcpus= are specified we must not do anything in cpu_schedule_callback(). This is not true today for taking down a cpu during resume.

If anything goes wrong during resume all the scheduler related error handling is in cpupool.c, so we can just bail out early from cpu_schedule_callback() when suspending or resuming.

This fixes commit 0763cd2687897b55e7 ("xen/sched: don't disable scheduler on cpus during suspend").

---
 xen/common/schedule.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
xen/common/schedule.c +9 -6
index e70cc70a65..54a07ff9e8 100644
@@ -2562,6 +2562,13 @@ static int cpu_schedule_callback(
     unsigned int cpu = (unsigned long)hcpu;
     int rc = 0;
 
+    /*
+     * All scheduler related suspend/resume handling needed is done in
+     * cpupool.c.
+     */
+    if ( system_state > SYS_STATE_active )
+        return NOTIFY_DONE;
+
     rcu_read_lock(&sched_res_rculock);
 
     /*
@@ -2589,8 +2596,7 @@ static int cpu_schedule_callback(
     switch ( action )
     {
     case CPU_UP_PREPARE:
-        if ( system_state != SYS_STATE_resume )
-            rc = cpu_schedule_up(cpu);
+        rc = cpu_schedule_up(cpu);
         break;
     case CPU_DOWN_PREPARE:
         rcu_read_lock(&domlist_read_lock);
@@ -2598,13 +2604,10 @@ static int cpu_schedule_callback(
         rcu_read_unlock(&domlist_read_lock);
         break;
     case CPU_DEAD:
-        if ( system_state == SYS_STATE_suspend )
-            break;
         sched_rm_cpu(cpu);
         break;
     case CPU_UP_CANCELED:
-        if ( system_state != SYS_STATE_resume )
-            cpu_schedule_down(cpu);
+        cpu_schedule_down(cpu);
         break;
     default:
         break;
Signature · 7 lines
2.16.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Juergen Gross

When resuming from S3 and smt=0 or maxcpus= are specified we must not do anything in cpu_schedule_callback(). This is not true today for taking down a cpu during resume.

If anything goes wrong during resume all the scheduler related error handling is in cpupool.c, so we can just bail out early from cpu_schedule_callback() when suspending or resuming.

Quoted 6 lines

This fixes commit 0763cd2687897b55e7 ("xen/sched: don't disable scheduler on cpus during suspend").

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel