aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-10-27 13:33:46 -0200
committerAvi Kivity <avi@redhat.com>2009-11-01 17:38:01 +0200
commit418a8926c936991e0f55e40641b4ed8236c64b10 (patch)
treec2f26c8110a0c97e02c0595c9bdd18cc2ea2a27e /qemu-kvm.c
parentvmxcap: improve bool formatting (diff)
downloadqemu-kvm-418a8926c936991e0f55e40641b4ed8236c64b10.tar.gz
qemu-kvm-418a8926c936991e0f55e40641b4ed8236c64b10.tar.bz2
qemu-kvm-418a8926c936991e0f55e40641b4ed8236c64b10.zip
Fix qemu-kvm sigsegv at exit
Michael reported a qemu-kvm SIGSEGV at shutdown: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x411d0940 (LWP 14446)] 0x000000000040afb4 in qemu_mod_timer (ts=0x19f0fd0, expire_time=62275467335) at /home/mst/scm/qemu-kvm/vl.c:1009 1009 if ((alarm_timer->flags & ALARM_FLAG_EXPIRED) == 0) { (gdb) l 1004 ts->next = *pt; 1005 *pt = ts; 1006 1007 /* Rearm if necessary */ 1008 if (pt == &active_timers[ts->clock->type]) { 1009 if ((alarm_timer->flags & ALARM_FLAG_EXPIRED) == 0) { 1010 qemu_rearm_alarm_timer(alarm_timer); 1011 } 1012 /* Interrupt execution to force deadline recalculation. */ 1013 if (use_icount) (gdb) p alarm_timer $1 = (struct qemu_alarm_timer *) 0x0 Problem is kvm_main_loop_wait(env, 0) can process the stop request (signalling iothread that vcpu is stopped, so its OK to exit) and continue to kvm_cpu_exec. Reorder kvm_main_loop_wait and kvm_cpu_exec, as suggested by Gleb. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Reported-by: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'qemu-kvm.c')
-rw-r--r--qemu-kvm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 4c136280a..809fd65a0 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1867,8 +1867,8 @@ static int kvm_main_loop_cpu(CPUState *env)
run_cpu = !env->halted;
}
if (run_cpu) {
- kvm_main_loop_wait(env, 0);
kvm_cpu_exec(env);
+ kvm_main_loop_wait(env, 0);
} else {
kvm_main_loop_wait(env, 1000);
}