From: Stefan Hajnoczi <stefanha@gmail.com>
To: Amos Kong <akong@redhat.com>
Cc: vyasevic@redhat.com, pbonzini@redhat.com, aliguori@us.ibm.com,
Laszlo Ersek <lersek@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit()
Date: Thu, 8 Aug 2013 10:19:55 +0200 [thread overview]
Message-ID: <20130808081955.GF21639@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <20130807081729.GA1624@amosk.info>
On Wed, Aug 07, 2013 at 04:17:29PM +0800, Amos Kong wrote:
> BTW, can we add a check in quit_timers() to avoid one kind of crash
> (try to quit the uninited timers, or quit timer repeatedly) ?
>
>
> diff --git a/qemu-timer.c b/qemu-timer.c
> index b2d95e2..023e4ae 100644
> --- a/qemu-timer.c
> +++ b/qemu-timer.c
> @@ -728,8 +728,10 @@ static void win32_rearm_timer(struct
> qemu_alarm_timer *t,
> static void quit_timers(void)
> {
> struct qemu_alarm_timer *t = alarm_timer;
> - alarm_timer = NULL;
> - t->stop(t);
> + if (t) {
> + alarm_timer = NULL;
> + t->stop(t);
> + }
> }
This is unnecessary once your other patch has been applied since t will
be initialized before quit_timers() is installed.
If we do ever hit the problem it should be debugged because assumptions
about the timer lifecycle must be broken. So avoiding the segfault
isn't really useful here, I think.
Stefan
prev parent reply other threads:[~2013-08-08 8:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 23:29 [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit() Amos Kong
2013-08-07 6:39 ` Laszlo Ersek
2013-08-07 7:57 ` Stefan Hajnoczi
2013-08-07 8:17 ` Amos Kong
2013-08-08 8:19 ` Stefan Hajnoczi [this message]
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=20130808081955.GF21639@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=akong@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vyasevic@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).