aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2010-04-07 00:11:09 +0200
committermalc <av1474@comtv.ru>2010-04-07 02:24:58 +0400
commit55274a30522d0f542c1659386f01096b78669455 (patch)
treeb93a86df16744380626aea1cdce897696d4e285d /cpus.c
parenttcg/ppc: Fix typo (diff)
downloadqemu-kvm-55274a30522d0f542c1659386f01096b78669455.tar.gz
qemu-kvm-55274a30522d0f542c1659386f01096b78669455.tar.bz2
qemu-kvm-55274a30522d0f542c1659386f01096b78669455.zip
fix 100% cpu utilization when cpu is stopped
> 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. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: malc <av1474@comtv.ru> Signed-off-by: malc <av1474@comtv.ru>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/cpus.c b/cpus.c
index a2e0642a4..0debe772e 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;