public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: Avi Kivity <avi@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: fix qemu-kvm sigsegv at exit
Date: Mon, 26 Oct 2009 17:05:14 -0200	[thread overview]
Message-ID: <20091026190514.GA6736@amt.cnet> (raw)
In-Reply-To: <20091026185849.GA5930@redhat.com>

On Mon, Oct 26, 2009 at 08:58:49PM +0200, Gleb Natapov wrote:
> On Mon, Oct 26, 2009 at 04:46:02PM -0200, Marcelo Tosatti wrote:
> > 
> > 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.
> > 
> > Make sure cpu is not stopped before proceeding to kvm_cpu_exec.
> > 
> > Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> > Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
> > 
> > diff --git a/qemu-kvm.c b/qemu-kvm.c
> > index 4c13628..ab8f0e4 100644
> > --- a/qemu-kvm.c
> > +++ b/qemu-kvm.c
> > @@ -1868,7 +1868,8 @@ static int kvm_main_loop_cpu(CPUState *env)
> >          }
> >          if (run_cpu) {
> >              kvm_main_loop_wait(env, 0);
> > -            kvm_cpu_exec(env);
> > +            if (!is_cpu_stopped(env))
> > +                kvm_cpu_exec(env);
> I wonder if calling kvm_cpu_exec() after kvm_main_loop_wait() will fix
> the problem?

Yeah, that would also do it.



  reply	other threads:[~2009-10-26 19:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 18:46 fix qemu-kvm sigsegv at exit Marcelo Tosatti
2009-10-26 18:58 ` Gleb Natapov
2009-10-26 19:05   ` Marcelo Tosatti [this message]
2009-10-27 15:33   ` [PATCH v2] " Marcelo Tosatti
2009-10-28  9:42     ` Avi Kivity
2009-10-28 22:38       ` Marcelo Tosatti
2009-11-01 15:39         ` Avi Kivity

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=20091026190514.GA6736@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox