All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: qemu-kvm: sigsegv at exit
Date: Thu, 22 Oct 2009 14:00:15 +0200	[thread overview]
Message-ID: <20091022120015.GA28836@redhat.com> (raw)

Hi!
I'm sometimes getting segfaults when I kill qemu.
This time I caught it when qemu was under gdb:


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
(gdb) where
#0  0x000000000040afb4 in qemu_mod_timer (ts=0x19f0fd0, expire_time=62275467335)
    at /home/mst/scm/qemu-kvm/vl.c:1009
#1  0x000000000041aadf in virtio_net_handle_tx (vdev=<value optimized out>, vq=0x19f5af0)
    at /home/mst/scm/qemu-kvm/hw/virtio-net.c:696
#2  0x0000000000421669 in kvm_run (vcpu=0x19d46a0, env=0x19c2250) at /home/mst/scm/qemu-kvm/qemu-kvm.c:797
#3  0x00000000004216d6 in kvm_cpu_exec (env=0x83d0f8) at /home/mst/scm/qemu-kvm/qemu-kvm.c:1714
#4  0x0000000000422981 in ap_main_loop (_env=<value optimized out>) at /home/mst/scm/qemu-kvm/qemu-kvm.c:1969
#5  0x000000377dc06367 in start_thread () from /lib64/libpthread.so.0
#6  0x000000377d0d30ad in clone () from /lib64/libc.so.6
(gdb)

So this probably means that we have already run quit_timers:

static void quit_timers(void)
{
    alarm_timer->stop(alarm_timer);
    alarm_timer = NULL;
}

but kvm vcpu thread is still running.


Not sure what the right fix is here: should we stop
kvm after main loop has exited?

-- 
MST

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] qemu-kvm: sigsegv at exit
Date: Thu, 22 Oct 2009 14:00:15 +0200	[thread overview]
Message-ID: <20091022120015.GA28836@redhat.com> (raw)

Hi!
I'm sometimes getting segfaults when I kill qemu.
This time I caught it when qemu was under gdb:


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
(gdb) where
#0  0x000000000040afb4 in qemu_mod_timer (ts=0x19f0fd0, expire_time=62275467335)
    at /home/mst/scm/qemu-kvm/vl.c:1009
#1  0x000000000041aadf in virtio_net_handle_tx (vdev=<value optimized out>, vq=0x19f5af0)
    at /home/mst/scm/qemu-kvm/hw/virtio-net.c:696
#2  0x0000000000421669 in kvm_run (vcpu=0x19d46a0, env=0x19c2250) at /home/mst/scm/qemu-kvm/qemu-kvm.c:797
#3  0x00000000004216d6 in kvm_cpu_exec (env=0x83d0f8) at /home/mst/scm/qemu-kvm/qemu-kvm.c:1714
#4  0x0000000000422981 in ap_main_loop (_env=<value optimized out>) at /home/mst/scm/qemu-kvm/qemu-kvm.c:1969
#5  0x000000377dc06367 in start_thread () from /lib64/libpthread.so.0
#6  0x000000377d0d30ad in clone () from /lib64/libc.so.6
(gdb)

So this probably means that we have already run quit_timers:

static void quit_timers(void)
{
    alarm_timer->stop(alarm_timer);
    alarm_timer = NULL;
}

but kvm vcpu thread is still running.


Not sure what the right fix is here: should we stop
kvm after main loop has exited?

-- 
MST

             reply	other threads:[~2009-10-22 12:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-22 12:00 Michael S. Tsirkin [this message]
2009-10-22 12:00 ` [Qemu-devel] qemu-kvm: sigsegv at exit Michael S. Tsirkin
2009-10-22 20:57 ` Marcelo Tosatti
2009-10-22 20:57   ` [Qemu-devel] " Marcelo Tosatti
2009-10-25 10:11   ` Michael S. Tsirkin
2009-10-25 10:11     ` [Qemu-devel] " Michael S. Tsirkin
2009-10-26 18:43     ` Marcelo Tosatti
2009-10-26 18:43       ` [Qemu-devel] " Marcelo Tosatti
2009-10-26 18:49       ` Michael S. Tsirkin
2009-10-26 18:49         ` [Qemu-devel] " Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091022120015.GA28836@redhat.com \
    --to=mst@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.