cpupool: fix ASSERT( c != old_pool )
diff mbox series

Message ID 1554691246-7249-1-git-send-email-fionali-oc@zhaoxin.com
State New, archived
Headers show
Series
  • cpupool: fix ASSERT( c != old_pool )
Related show

Commit Message

FionaLi-oc April 8, 2019, 2:40 a.m. UTC
Assigning cpu to cpupool needn't to switch cpu scheduler when
system state is resume, otherwise it will cause ASSERT in
schedule_cpu_switch().

Signed-off-by: FionaLi-oc <fionali-oc@zhaoxin.com>
---
 xen/common/cpupool.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Juergen Gross April 8, 2019, 5:09 a.m. UTC | #1
On 08/04/2019 04:40, FionaLi-oc wrote:
> Assigning cpu to cpupool needn't to switch cpu scheduler when
> system state is resume, otherwise it will cause ASSERT in
> schedule_cpu_switch().

I don't think this patch is needed on current staging tree. Commit
6870ea9d1fad6fbe27 changed resume handling leading to
cpupool_assign_cpu_locked() being no longer called when resuming.


Juergen
Jan Beulich April 8, 2019, 9:26 a.m. UTC | #2
>>> On 08.04.19 at 07:09, <jgross@suse.com> wrote:
> On 08/04/2019 04:40, FionaLi-oc wrote:
>> Assigning cpu to cpupool needn't to switch cpu scheduler when
>> system state is resume, otherwise it will cause ASSERT in
>> schedule_cpu_switch().
> 
> I don't think this patch is needed on current staging tree. Commit
> 6870ea9d1fad6fbe27 changed resume handling leading to
> cpupool_assign_cpu_locked() being no longer called when resuming.

But is it something worthwhile to put onto stable trees (with the
one missing blank added)?

Jan
Juergen Gross April 8, 2019, 10:25 a.m. UTC | #3
On 08/04/2019 11:26, Jan Beulich wrote:
>>>> On 08.04.19 at 07:09, <jgross@suse.com> wrote:
>> On 08/04/2019 04:40, FionaLi-oc wrote:
>>> Assigning cpu to cpupool needn't to switch cpu scheduler when
>>> system state is resume, otherwise it will cause ASSERT in
>>> schedule_cpu_switch().
>>
>> I don't think this patch is needed on current staging tree. Commit
>> 6870ea9d1fad6fbe27 changed resume handling leading to
>> cpupool_assign_cpu_locked() being no longer called when resuming.
> 
> But is it something worthwhile to put onto stable trees (with the
> one missing blank added)?

I don't think it is always correct.

While avoiding the ASSERT() triggering it won't switch back the
scheduler from the default one at resume, which was activated when
suspending the machine.

So for older Xen versions we'd need to know which ASSERT() was
triggering and why that did happen, or we could backport my series
removing really the need for calling schedule_cpu_switch().


Juergen

Patch
diff mbox series

diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index e89bb67..acc4a52 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -268,9 +268,13 @@  static int cpupool_assign_cpu_locked(struct cpupool *c, unsigned int cpu)
 
     if ( (cpupool_moving_cpu == cpu) && (c != cpupool_cpu_moving) )
         return -EADDRNOTAVAIL;
-    ret = schedule_cpu_switch(cpu, c);
-    if ( ret )
-        return ret;
+
+    if( system_state != SYS_STATE_resume )
+    {
+        ret = schedule_cpu_switch(cpu, c);
+        if ( ret )
+            return ret;
+    }
 
     cpumask_clear_cpu(cpu, &cpupool_free_cpus);
     if (cpupool_moving_cpu == cpu)