[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] fix 100% cpu utilization when cpu is stopped (was R

From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH] fix 100% cpu utilization when cpu is stopped (was Re: d6f4ade214a9f74dca9495b83a24ff9c113e4f9a)
Date: Tue, 06 Apr 2010 22:16:05 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.3

On 04/05/2010 03:51 PM, malc wrote:

d6f4ade214a9f74dca9495b83a24ff9c113e4f9a: disentangle tcg and deadline 
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.

Signed-off-by: Paolo Bonzini <address@hidden>

diff --git a/cpus.c b/cpus.c
index a2e0642..0debe77 100644
--- a/cpus.c
+++ b/cpus.c
@@ -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;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]