Skip to contentSkip to conversation

x86/S3: Fix cpu pool scheduling after suspend/resume

PATCH In review Ben Guthro 5 participants 12 messages Apr 9, 2013 – Apr 15, 2013

lore
Share & tools
lore

Ben Guthro

author
#0 lore raw

PATCH 1/1 x86/S3: Fix cpu pool scheduling after suspend/resume

This review is another S3 scheduler problem with the system_state variable introduced with the following changeset:
http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=269f543ea750ed567d18f2e819e5d5ce58eda5c5

Specifically, the cpu_callback function that takes the CPU down during suspend, and back up during resume.
We were seeing situations where, after S3, only CPU0 was in cpupool0. Guest performance suffered greatly, since all vcpus were only on a single pcpu. Guests under high CPU load showed the problem much more quickly than an idle guest.

Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3.

This also includes a necessary partial change proposed earlier by Tomasz Wroblewski here:
http://lists.xen.org/archives/html/xen-devel/2013-01/msg02206.html

It should also resolve the issues discussed in this thread:
http://lists.xen.org/archives/html/xen-devel/2012-11/msg01801.html

---
 xen/common/cpu.c     |    3 +++
 xen/common/cpupool.c |    5 -----
 2 files changed, 3 insertions(+), 5 deletions(-)
xen/common/cpu.c +3 -0
index 630881e..e20868c 100644
@@ -5,6 +5,7 @@
 #include <xen/init.h>
 #include <xen/sched.h>
 #include <xen/stop_machine.h>
+#include <xen/sched-if.h>
 
 unsigned int __read_mostly nr_cpu_ids = NR_CPUS;
 #ifndef nr_cpumask_bits
@@ -212,6 +213,8 @@ void enable_nonboot_cpus(void)
             BUG_ON(error == -EBUSY);
             printk("Error taking CPU%d up: %d\n", cpu, error);
         }
+        if (system_state == SYS_STATE_resume)
+            cpumask_set_cpu(cpu, cpupool0->cpu_valid);
     }
 
     cpumask_clear(&frozen_cpus);
xen/common/cpupool.c +0 -5
index 10b10f8..a9653a8 100644
@@ -633,10 +633,6 @@ static int cpu_callback(
     unsigned int cpu = (unsigned long)hcpu;
     int rc = 0;
 
-    if ( (system_state == SYS_STATE_suspend) ||
-         (system_state == SYS_STATE_resume) )
-        goto out;
-
     switch ( action )
     {
     case CPU_DOWN_FAILED:
@@ -650,7 +646,6 @@ static int cpu_callback(
         break;
     }
 
-out:
     return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
 }
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 33 lines · Ben Guthro

This review is another S3 scheduler problem with the system_state variable introduced with the following changeset:
http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=269f543ea750ed567d18f2e819e5d5ce58eda5c5

Specifically, the cpu_callback function that takes the CPU down during suspend, and back up during resume.
We were seeing situations where, after S3, only CPU0 was in cpupool0. Guest performance suffered greatly, since all vcpus were only on a single pcpu. Guests under high CPU load showed the problem much more quickly than an idle guest.

Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3.

This also includes a necessary partial change proposed earlier by Tomasz Wroblewski here:
http://lists.xen.org/archives/html/xen-devel/2013-01/msg02206.html

It should also resolve the issues discussed in this thread:
http://lists.xen.org/archives/html/xen-devel/2012-11/msg01801.html

---
  xen/common/cpu.c     |    3 +++
  xen/common/cpupool.c |    5 -----
  2 files changed, 3 insertions(+), 5 deletions(-)
xen/common/cpu.c +1 -0
index 630881e..e20868c 100644
@@ -5,6 +5,7 @@
  #include<xen/init.h>
  #include<xen/sched.h>
  #include<xen/stop_machine.h>
+#include<xen/sched-if.h>
 
  unsigned int __read_mostly nr_cpu_ids = NR_CPUS;
  #ifndef nr_cpumask_bits

xen/common/cpu.c void enable_nonboot_cpus(void) · line 217

Quoted 5 lines
xen/common/cpu.c +2 -0
@@ -212,6 +213,8 @@ void enable_nonboot_cpus(void)
              BUG_ON(error == -EBUSY);
              printk("Error taking CPU%d up: %d\n", cpu, error);
          }
+        if (system_state == SYS_STATE_resume)
+            cpumask_set_cpu(cpu, cpupool0->cpu_valid);

This might solve YOUR problem, but reintroduces the problem why the original change was done: ALL cpus will be in cpupool0 after resume!

So: NAK

Juergen

Signature · 5 lines
Juergen Gross                 Principal Developer Operating Systems
PBG PDG ES&S SWE OS6                   Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: [email protected]
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html
#7 lore raw
In reply to Ben Guthro
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ben Guthro

This review is another S3 scheduler problem with the system_state variable introduced with the following changeset:
http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=269f543ea750ed567d18f2e8
19e5d5ce58eda5c5

Specifically, the cpu_callback function that takes the CPU down during suspend, and back up during resume.
We were seeing situations where, after S3, only CPU0 was in cpupool0. Guest performance suffered greatly, since all vcpus were only on a single pcpu. Guests under high CPU load showed the problem much more quickly than an idle guest.

Quoted 2 lines

Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3.

But this doesn't explain _why_ the code block you remove was wrong. And that would be vital to understand, so we can be reasonably sure this change won't lead to regressions elsewhere again.

Jan

Quoted 65 lines

This also includes a necessary partial change proposed earlier by Tomasz Wroblewski here:
http://lists.xen.org/archives/html/xen-devel/2013-01/msg02206.html

It should also resolve the issues discussed in this thread:
http://lists.xen.org/archives/html/xen-devel/2012-11/msg01801.html

---
 xen/common/cpu.c     |    3 +++
 xen/common/cpupool.c |    5 -----
 2 files changed, 3 insertions(+), 5 deletions(-)
xen/common/cpu.c +3 -0
index 630881e..e20868c 100644
@@ -5,6 +5,7 @@
 #include <xen/init.h>
 #include <xen/sched.h>
 #include <xen/stop_machine.h>
+#include <xen/sched-if.h>
 
 unsigned int __read_mostly nr_cpu_ids = NR_CPUS;
 #ifndef nr_cpumask_bits
@@ -212,6 +213,8 @@ void enable_nonboot_cpus(void)
             BUG_ON(error == -EBUSY);
             printk("Error taking CPU%d up: %d\n", cpu, error);
         }
+        if (system_state == SYS_STATE_resume)
+            cpumask_set_cpu(cpu, cpupool0->cpu_valid);
     }
 
     cpumask_clear(&frozen_cpus);
xen/common/cpupool.c +0 -5
index 10b10f8..a9653a8 100644
@@ -633,10 +633,6 @@ static int cpu_callback(
     unsigned int cpu = (unsigned long)hcpu;
     int rc = 0;
 
-    if ( (system_state == SYS_STATE_suspend) ||
-         (system_state == SYS_STATE_resume) )
-        goto out;
-
     switch ( action )
     {
     case CPU_DOWN_FAILED:
@@ -650,7 +646,6 @@ static int cpu_callback(
         break;
     }
 
-out:
     return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
 }
 
Signature · 7 lines
1.7.9.5


_______________________________________________
Xen-devel mailing list
[email protected] 
http://lists.xen.org/xen-devel 
author
#2 lore raw
In reply to Juergen Gross

How would you suggest this be solved then - because we are seeing that all non-boot cpus are not being put in a pool at all - which is clearly worse than being put into pool0

Quoted 72 lines · Juergen Gross
Quoted 42 lines · Ben Guthro

This review is another S3 scheduler problem with the system_state variable introduced with the following changeset:

http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=269f543ea750ed567d18f2e819e5d5ce58eda5c5

Specifically, the cpu_callback function that takes the CPU down during suspend, and back up during resume.
We were seeing situations where, after S3, only CPU0 was in cpupool0. Guest performance suffered greatly, since all vcpus were only on a single pcpu. Guests under high CPU load showed the problem much more quickly than an idle guest.

Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3.

This also includes a necessary partial change proposed earlier by Tomasz Wroblewski here:
http://lists.xen.org/archives/html/xen-devel/2013-01/msg02206.html

It should also resolve the issues discussed in this thread:
http://lists.xen.org/archives/html/xen-devel/2012-11/msg01801.html

---
  xen/common/cpu.c     |    3 +++
  xen/common/cpupool.c |    5 -----
  2 files changed, 3 insertions(+), 5 deletions(-)
xen/common/cpu.c +1 -0
index 630881e..e20868c 100644
@@ -5,6 +5,7 @@
  #include<xen/init.h>
  #include<xen/sched.h>
  #include<xen/stop_machine.h>
+#include<xen/sched-if.h>
 
  unsigned int __read_mostly nr_cpu_ids = NR_CPUS;
  #ifndef nr_cpumask_bits

xen/common/cpu.c void enable_nonboot_cpus(void) · line 217

Quoted 5 lines
xen/common/cpu.c +2 -0
@@ -212,6 +213,8 @@ void enable_nonboot_cpus(void)
              BUG_ON(error == -EBUSY);
              printk("Error taking CPU%d up: %d\n", cpu, error);
          }
+        if (system_state == SYS_STATE_resume)
+            cpumask_set_cpu(cpu, cpupool0->cpu_valid);

This might solve YOUR problem, but reintroduces the problem why the original change was done: ALL cpus will be in cpupool0 after resume!

So: NAK

Juergen

--
Juergen Gross Principal Developer Operating Systems
PBG PDG ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions e-mail:
[email protected]
Domagkstr. 28 Internet: ts.fujitsu.com
D-80807 Muenchen Company details:
ts.fujitsu.com/imprint.html

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 3 lines · Ben Guthro

How would you suggest this be solved then - because we are seeing that all non-boot cpus are not being put in a pool at all - which is clearly worse than being put into pool0

I proposed a patch before, which should have worked:

http://lists.xen.org/archives/html/xen-devel/2012-03/msg01843.html

Keir didn't like it and came up with the state variable...

Juergen

Signature · 5 lines
Juergen Gross                 Principal Developer Operating Systems
PBG PDG ES&S SWE OS6                   Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: [email protected]
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html
author
#8 lore raw
In reply to Jan Beulich
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ben Guthro

This review is another S3 scheduler problem with the system_state variable introduced with the following changeset:
http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=269f543ea750ed567d18f2e8
19e5d5ce58eda5c5

Specifically, the cpu_callback function that takes the CPU down during suspend, and back up during resume.
We were seeing situations where, after S3, only CPU0 was in cpupool0. Guest performance suffered greatly, since all vcpus were only on a single pcpu. Guests under high CPU load showed the problem much more quickly than an idle guest.

Quoted 7 lines
Quoted 2 lines

Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3.

But this doesn't explain _why_ the code block you remove was wrong. And that would be vital to understand, so we can be reasonably sure this change won't lead to regressions elsewhere again.

I would argue that there has been so many problems with the original changeset, that the argument should be in the other direction - since this changeset that introduced the system_state variable, nobody has been able to successfully suspend, as has been discussed in multiple threads over the past year.

What is the reason that this particular callback gets bailed out of, but not others?
Previously, the code worked, and went through this code path. Why this one, in particular?

We have been systematically removing parts of the system_state changeset, in regard to the S3 path. This is just another one that puts it back to the way it was prior to that changeset (at least the second hunk of it)

I'm open to other suggestions, but this was the only path that explained the fact that all of the vcpus would end up on cpu0.

Ben

Quoted 76 lines

Jan

Quoted 61 lines

This also includes a necessary partial change proposed earlier by Tomasz Wroblewski here:
http://lists.xen.org/archives/html/xen-devel/2013-01/msg02206.html

It should also resolve the issues discussed in this thread:
http://lists.xen.org/archives/html/xen-devel/2012-11/msg01801.html

---
 xen/common/cpu.c     |    3 +++
 xen/common/cpupool.c |    5 -----
 2 files changed, 3 insertions(+), 5 deletions(-)
xen/common/cpu.c +3 -0
index 630881e..e20868c 100644
@@ -5,6 +5,7 @@
 #include <xen/init.h>
 #include <xen/sched.h>
 #include <xen/stop_machine.h>
+#include <xen/sched-if.h>
 
 unsigned int __read_mostly nr_cpu_ids = NR_CPUS;
 #ifndef nr_cpumask_bits
@@ -212,6 +213,8 @@ void enable_nonboot_cpus(void)
             BUG_ON(error == -EBUSY);
             printk("Error taking CPU%d up: %d\n", cpu, error);
         }
+        if (system_state == SYS_STATE_resume)
+            cpumask_set_cpu(cpu, cpupool0->cpu_valid);
     }
 
     cpumask_clear(&frozen_cpus);
xen/common/cpupool.c +0 -6
index 10b10f8..a9653a8 100644
@@ -633,10 +633,6 @@ static int cpu_callback(
     unsigned int cpu = (unsigned long)hcpu;
     int rc = 0;
 
-    if ( (system_state == SYS_STATE_suspend) ||
-         (system_state == SYS_STATE_resume) )
-        goto out;
-
     switch ( action )
     {
     case CPU_DOWN_FAILED:
@@ -650,7 +646,6 @@ static int cpu_callback(
         break;
     }
 
-out:
     return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
 }
 
--

1.7.9.5

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
In reply to Ben Guthro
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Ben Guthro

How would you suggest this be solved then - because we are seeing that all non-boot cpus are not being put in a pool at all - which is clearly worse than being put into pool0

There ought to be a way for them to be put back where they belong?

Plus so far I understood that this mishandling happens sometimes, not always. Yet the change you propose would imply this didn't ever work.

Jan

#9 lore raw
In reply to Ben Guthro
Quoted 17 lines
Quoted 1 line
Quoted 1 line · Ben Guthro
Quoted 8 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Ben Guthro

Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3.

But this doesn't explain _why_ the code block you remove was wrong. And that would be vital to understand, so we can be reasonably sure this change won't lead to regressions elsewhere again.

I would argue that there has been so many problems with the original changeset, that the argument should be in the other direction - since this changeset that introduced the system_state variable, nobody has been able to successfully suspend, as has been discussed in multiple threads over the past year.

Quoted 4 lines

What is the reason that this particular callback gets bailed out of, but not others?
Previously, the code worked, and went through this code path. Why this one, in particular?

You'd need to work this out with Juergen and Keir. I don't really recall the details of the discussion they had back then.

Quoted 4 lines

We have been systematically removing parts of the system_state changeset, in regard to the S3 path. This is just another one that puts it back to the way it was prior to that changeset (at least the second hunk of it)

But as said by Juergen - at the expense of breaking cpupools.

Quoted 2 lines

I'm open to other suggestions, but this was the only path that explained the fact that all of the vcpus would end up on cpu0.

Again - one of my main concerns here is that so far I was under the impression that this "all CPUs on pCPU0" was occurring sometime, not always. And with that, I would expect the problem to be a race of some sort, and the fix be dealing with a race. Which isn't the case.

So the question that first needs answering is - was that impression of mine wrong? If not, the next question would be whether you spotted the race...

Jan

#10 lore raw
In reply to Ben Guthro
Quoted 22 lines · Ben Guthro
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ben Guthro

This review is another S3 scheduler problem with the system_state variable introduced with the following changeset:
http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=269f543ea750ed567d18f2e8
19e5d5ce58eda5c5

Specifically, the cpu_callback function that takes the CPU down during suspend, and back up during resume.
We were seeing situations where, after S3, only CPU0 was in cpupool0. Guest performance suffered greatly, since all vcpus were only on a single pcpu. Guests under high CPU load showed the problem much more quickly than an idle guest.

Quoted 7 lines
Quoted 2 lines

Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3.

But this doesn't explain _why_ the code block you remove was wrong. And that would be vital to understand, so we can be reasonably sure this change won't lead to regressions elsewhere again.

Quoted 5 lines

I would argue that there has been so many problems with the original changeset, that the argument should be in the other direction - since this changeset that introduced the system_state variable, nobody has been able to successfully suspend, as has been discussed in multiple threads over the past year.

We could revert all the system_state patches and try Juergen's original patch?

-- Keir

Quoted 96 lines

What is the reason that this particular callback gets bailed out of, but not others?
Previously, the code worked, and went through this code path. Why this one, in particular?

We have been systematically removing parts of the system_state changeset, in regard to the S3 path. This is just another one that puts it back to the way it was prior to that changeset (at least the second hunk of it)

I'm open to other suggestions, but this was the only path that explained the fact that all of the vcpus would end up on cpu0.

Ben

Quoted 64 lines

Jan

Quoted 61 lines

This also includes a necessary partial change proposed earlier by Tomasz Wroblewski here:
http://lists.xen.org/archives/html/xen-devel/2013-01/msg02206.html

It should also resolve the issues discussed in this thread:
http://lists.xen.org/archives/html/xen-devel/2012-11/msg01801.html

---
 xen/common/cpu.c     |    3 +++
 xen/common/cpupool.c |    5 -----
 2 files changed, 3 insertions(+), 5 deletions(-)
xen/common/cpu.c +3 -0
index 630881e..e20868c 100644
@@ -5,6 +5,7 @@
 #include <xen/init.h>
 #include <xen/sched.h>
 #include <xen/stop_machine.h>
+#include <xen/sched-if.h>
 
 unsigned int __read_mostly nr_cpu_ids = NR_CPUS;
 #ifndef nr_cpumask_bits
@@ -212,6 +213,8 @@ void enable_nonboot_cpus(void)
             BUG_ON(error == -EBUSY);
             printk("Error taking CPU%d up: %d\n", cpu, error);
         }
+        if (system_state == SYS_STATE_resume)
+            cpumask_set_cpu(cpu, cpupool0->cpu_valid);
     }
 
     cpumask_clear(&frozen_cpus);
xen/common/cpupool.c +0 -6
index 10b10f8..a9653a8 100644
@@ -633,10 +633,6 @@ static int cpu_callback(
     unsigned int cpu = (unsigned long)hcpu;
     int rc = 0;
 
-    if ( (system_state == SYS_STATE_suspend) ||
-         (system_state == SYS_STATE_resume) )
-        goto out;
-
     switch ( action )
     {
     case CPU_DOWN_FAILED:
@@ -650,7 +646,6 @@ static int cpu_callback(
         break;
     }
 
-out:
     return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
 }
 
--

1.7.9.5

Quoted 12 lines
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
In reply to Ben Guthro
Quoted 3 lines · Ben Guthro

How would you suggest this be solved then - because we are seeing that all non-boot cpus are not being put in a pool at all - which is clearly worse than being put into pool0

I don't think this is what you're actually seeing -- or if you are, then there's a bug somewhere else that this is just triggering.

For the benefit of others: What they're seeing sometimes is that after a suspend/resume cycle, certain pcpus don't generate any trace records. However, it is clear from the traces that *are* generated, that it's not the case that nothing is happening on those invisible pcpus; there is clear evidence of the vcpus running on visible pcpus communicating with vcpus on the invisible pcpus.

But they are also sometimes seeing performance degradation that would be consistent with pcpus not coming back up; but it's hard to be sure because sometimes it's just tracing not working.

In any case, the "system state" patch doesn't work for dom0 affinity, and the recent patch to generically save/restore vcpu affinity is one step towards making it not needed anymore. We should either:
* Revert the patch and save/restore stuff properly
* Special-case dom0 to save and re-pin on suspend/resume, since it's still running
* Make sure that dom0 is handled some other way (e.g., by not migrating vcpus which are paused)?

Looking at this patch -- it looks like the sched-state patch makes it so that the scheduler cpu initialization stuff is not called on resume -- e.g., tick_resume. Am I reading that correctly? That could be part of the problem...

-George

Quoted 82 lines
Quoted 68 lines · Juergen Gross
Quoted 42 lines · Ben Guthro

This review is another S3 scheduler problem with the system_state variable introduced with the following changeset:

http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=269f543ea750ed567d18f2e819e5d5ce58eda5c5

Specifically, the cpu_callback function that takes the CPU down during suspend, and back up during resume.
We were seeing situations where, after S3, only CPU0 was in cpupool0. Guest performance suffered greatly, since all vcpus were only on a single pcpu. Guests under high CPU load showed the problem much more quickly than an idle guest.

Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3.

This also includes a necessary partial change proposed earlier by Tomasz Wroblewski here:
http://lists.xen.org/archives/html/xen-devel/2013-01/msg02206.html

It should also resolve the issues discussed in this thread:
http://lists.xen.org/archives/html/xen-devel/2012-11/msg01801.html

---
  xen/common/cpu.c     |    3 +++
  xen/common/cpupool.c |    5 -----
  2 files changed, 3 insertions(+), 5 deletions(-)
xen/common/cpu.c +1 -0
index 630881e..e20868c 100644
@@ -5,6 +5,7 @@
  #include<xen/init.h>
  #include<xen/sched.h>
  #include<xen/stop_machine.h>
+#include<xen/sched-if.h>
 
  unsigned int __read_mostly nr_cpu_ids = NR_CPUS;
  #ifndef nr_cpumask_bits

xen/common/cpu.c void enable_nonboot_cpus(void) · line 217

Quoted 5 lines
xen/common/cpu.c +2 -0
@@ -212,6 +213,8 @@ void enable_nonboot_cpus(void)
              BUG_ON(error == -EBUSY);
              printk("Error taking CPU%d up: %d\n", cpu, error);
          }
+        if (system_state == SYS_STATE_resume)
+            cpumask_set_cpu(cpu, cpupool0->cpu_valid);

This might solve YOUR problem, but reintroduces the problem why the original change was done: ALL cpus will be in cpupool0 after resume!

So: NAK

Juergen

--
Juergen Gross Principal Developer Operating Systems
PBG PDG ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions e-mail:
[email protected]
Domagkstr. 28 Internet: ts.fujitsu.com
D-80807 Muenchen Company details:
ts.fujitsu.com/imprint.html

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · George Dunlap

Looking at this patch -- it looks like the sched-state patch makes it so that the scheduler cpu initialization stuff is not called on resume -- e.g., tick_resume. Am I reading that correctly? That could be part of the problem...

ISTR having mentioned this issue as a possible part of the resume problems. The only missing piece for me is that tick_suspend doesn't get called during suspend either (i.e. the only problem ought to be that the tick may get delivered prematurely, which is what led me to suggest to suppress full softirq handling from rcu_barrier_action() when resuming, or perhaps more generically for all callers, i.e. in process_pending_softirqs() itself). And we need to not forget that tick_suspend()/tick_resume() are meant to be used by the idle management code only at present, so using it for another purpose could have other issues.

Jan

author
#11 lore raw
In reply to Keir Fraser
Quoted 24 lines · Keir Fraser
Quoted 22 lines · Ben Guthro
Quoted 20 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ben Guthro

This review is another S3 scheduler problem with the system_state variable introduced with the following changeset:
http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=269f543ea750ed567d18f2e8
19e5d5ce58eda5c5

Specifically, the cpu_callback function that takes the CPU down during suspend, and back up during resume.
We were seeing situations where, after S3, only CPU0 was in cpupool0. Guest performance suffered greatly, since all vcpus were only on a single pcpu. Guests under high CPU load showed the problem much more quickly than an idle guest.

Quoted 2 lines

Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3.

But this doesn't explain _why_ the code block you remove was wrong. And that would be vital to understand, so we can be reasonably sure this change won't lead to regressions elsewhere again.

Quoted 8 lines
Quoted 5 lines

I would argue that there has been so many problems with the original changeset, that the argument should be in the other direction - since this changeset that introduced the system_state variable, nobody has been able to successfully suspend, as has been discussed in multiple threads over the past year.

We could revert all the system_state patches and try Juergen's original patch?

Apologies for my delay on responding to this - I have been traveling.

I think that reversion of the original patch should be considered, if we want to have S3 work.

IMO - Severe regression of a long standing platform (S3) feature for the introduction of a new one (cpupools) seems like a problem that should be addressed by the author of the new feature, or that new feature should be reverted.

Unfortunately, since Konrad's acpi-s3 patches are not upstream, it makes it difficult to add to the automated tests to catch these early.

Ben

Quoted 106 lines

-- Keir

Quoted 92 lines

What is the reason that this particular callback gets bailed out of, but not others?
Previously, the code worked, and went through this code path. Why this one, in particular?

We have been systematically removing parts of the system_state changeset, in regard to the S3 path. This is just another one that puts it back to the way it was prior to that changeset (at least the second hunk of it)

I'm open to other suggestions, but this was the only path that explained the fact that all of the vcpus would end up on cpu0.

Ben

Quoted 64 lines

Jan

Quoted 61 lines

This also includes a necessary partial change proposed earlier by Tomasz Wroblewski here:
http://lists.xen.org/archives/html/xen-devel/2013-01/msg02206.html

It should also resolve the issues discussed in this thread:
http://lists.xen.org/archives/html/xen-devel/2012-11/msg01801.html

---
 xen/common/cpu.c     |    3 +++
 xen/common/cpupool.c |    5 -----
 2 files changed, 3 insertions(+), 5 deletions(-)
xen/common/cpu.c +3 -0
index 630881e..e20868c 100644
@@ -5,6 +5,7 @@
 #include <xen/init.h>
 #include <xen/sched.h>
 #include <xen/stop_machine.h>
+#include <xen/sched-if.h>
 
 unsigned int __read_mostly nr_cpu_ids = NR_CPUS;
 #ifndef nr_cpumask_bits
@@ -212,6 +213,8 @@ void enable_nonboot_cpus(void)
             BUG_ON(error == -EBUSY);
             printk("Error taking CPU%d up: %d\n", cpu, error);
         }
+        if (system_state == SYS_STATE_resume)
+            cpumask_set_cpu(cpu, cpupool0->cpu_valid);
     }
 
     cpumask_clear(&frozen_cpus);
xen/common/cpupool.c +0 -6
index 10b10f8..a9653a8 100644
@@ -633,10 +633,6 @@ static int cpu_callback(
     unsigned int cpu = (unsigned long)hcpu;
     int rc = 0;
 
-    if ( (system_state == SYS_STATE_suspend) ||
-         (system_state == SYS_STATE_resume) )
-        goto out;
-
     switch ( action )
     {
     case CPU_DOWN_FAILED:
@@ -650,7 +646,6 @@ static int cpu_callback(
         break;
     }
 
-out:
     return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
 }
 
--

1.7.9.5

Quoted 12 lines
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel