Skip to contentSkip to conversation

d6f4ade214a9f74dca9495b83a24ff9c113e4f9a

Qemu-devel Superseded malc 2 participants 4 messages Apr 5, 2010 – Apr 6, 2010

lore
Share & tools
lore

malc

author
#0 lore raw

Hello,

d6f4ade214a9f74dca9495b83a24ff9c113e4f9a: disentangle tcg and deadline calculation introduces following regression(s):

100% cpu utilization when QEMU is invoked like:
qemu -S -s ...

ditto when gdb takes control over the session via gdb-stub (i.e. the breakpoint is hit or C-c is pressed inside gdb to
interrupt the attached qemu instance)

Signature · 1 line
mailto:[email protected]
#1 lore raw

PATCH 1/1 fix 100% cpu utilization when cpu is stopped (was Re: d6f4ade214a9f74dca9495b83a24ff9c113e4f9a)

Quoted 11 lines · malc

Hello,

d6f4ade214a9f74dca9495b83a24ff9c113e4f9a: disentangle tcg and deadline calculation introduces following regression(s):

100% cpu utilization when QEMU is invoked like:
qemu -S -s ...

ditto when gdb takes control over the session via gdb-stub (i.e. the breakpoint is hit or C-c is pressed inside gdb to
interrupt the attached qemu instance)

The bug is that env->stopped is not really as comprehensive as it seems to be (and cpu_has_work thinks); it is only valid with iothread basically, and even then it is cleared by reset and it is not set when starting qemu with -S.

cpus.c +2 -4
index a2e0642..0debe77 100644
@@ -100,9 +100,7 @@ static int cpu_can_run(CPUState *env)
 {
     if (env->stop)
         return 0;
-    if (env->stopped)
-        return 0;
-    if (!vm_running)
+    if (env->stopped || !vm_running)
         return 0;
     return 1;
 }
@@ -111,7 +109,7 @@ static int cpu_has_work(CPUState *env)
 {
     if (env->stop)
         return 1;
-    if (env->stopped)
+    if (env->stopped || !vm_running)
         return 0;
     if (!env->halted)
         return 1;
author
#2 lore raw

[Qemu-devel] Re: [PATCH] fix 100% cpu utilization when cpu is stopped (was Re: d6f4ade214a9f74dca9495b83a24ff9c113e4f9a)

Quoted 37 lines · Paolo Bonzini
Quoted 6 lines · malc

Hello,

d6f4ade214a9f74dca9495b83a24ff9c113e4f9a: disentangle tcg and deadline calculation
introduces following regression(s):

Quoted 6 lines

100% cpu utilization when QEMU is invoked like:
qemu -S -s ...

ditto when gdb takes control over the session via gdb-stub (i.e. the breakpoint is hit or C-c is pressed inside gdb to
interrupt the attached qemu instance)

The bug is that env->stopped is not really as comprehensive as it seems to be (and cpu_has_work thinks); it is only valid with iothread basically, and even then it is cleared by reset and it is not set when starting qemu with -S.

cpus.c +1 -3
index a2e0642..0debe77 100644
@@ -100,9 +100,7 @@ static int cpu_can_run(CPUState *env)
 {
     if (env->stop)
         return 0;
-    if (env->stopped)
-        return 0;
-    if (!vm_running)
+    if (env->stopped || !vm_running)
         return 0;
     return 1;
 }

cpus.c static int cpu_has_work(CPUState *env) · line 115

Quoted 8 lines
cpus.c +1 -1
@@ -111,7 +109,7 @@ static int cpu_has_work(CPUState *env)
 {
     if (env->stop)
         return 1;
-    if (env->stopped)
+    if (env->stopped || !vm_running)
         return 0;
     if (!env->halted)
         return 1;

This doesn't apply for whatever reason, i patched the thing by hand and things seem to work, thanks, care to resend?

Signature · 1 line
mailto:[email protected]
#3 lore raw

PATCH RESEND 1/1 fix 100% cpu utilization when cpu is stopped

Quoted 11 lines

Hello,

d6f4ade (disentangle tcg and deadline calculation, 2010-03-10) introduces following regression(s):

100% cpu utilization when QEMU is invoked like:
qemu -S -s ...

ditto when gdb takes control over the session via gdb-stub (i.e. the breakpoint is hit or C-c is pressed inside gdb to
interrupt the attached qemu instance)

The bug is that env->stopped is not really as comprehensive as it seems to be (and cpu_has_work thinks); it is only valid with iothread basically, and even then it is cleared by reset and it is not set when starting qemu with -S.

---
 cpus.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
cpus.c +2 -4
index a2e0642..0debe77 100644
@@ -100,9 +100,7 @@ static int cpu_can_run(CPUState *env)
 {
     if (env->stop)
         return 0;
-    if (env->stopped)
-        return 0;
-    if (!vm_running)
+    if (env->stopped || !vm_running)
         return 0;
     return 1;
 }
@@ -111,7 +109,7 @@ static int cpu_has_work(CPUState *env)
 {
     if (env->stop)
         return 1;
-    if (env->stopped)
+    if (env->stopped || !vm_running)
         return 0;
     if (!env->halted)
         return 1;
Signature · 1 line
1.6.6.1