[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll
From: |
Peter Xu |
Subject: |
Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll |
Date: |
Wed, 20 Sep 2017 12:44:12 +0800 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Tue, Sep 19, 2017 at 02:59:37PM -0500, Eric Blake wrote:
> On 09/14/2017 02:50 AM, Peter Xu wrote:
> > This is not a problem if we are only having one single loop thread like
> > before. However, after per-monitor thread is introduced, this is not
> > true any more, and the race can happen.
> >
> > The race can be triggered with "make check -j8" sometimes:
> >
> > qemu-system-x86_64: /root/git/qemu/chardev/char-io.c:91:
> > io_watch_poll_finalize: Assertion `iwp->src == NULL' failed.
> >
> > This patch keeps the reference for the watch object when creating in
> > io_add_watch_poll(), so that the object will never be released in the
> > context main loop, especially when the context loop is running in
> > another standalone thread. Meanwhile, when we want to remove the watch
> > object, we always first detach the watch object from its owner context,
> > then we continue with the cleanup.
> >
> > Without this patch, calling io_remove_watch_poll() in main loop thread
> > is not thread-safe, since the other per-monitor thread may be modifying
> > the watch object at the same time.
> >
> > Reviewed-by: Marc-André Lureau <address@hidden>
> > Signed-off-by: Peter Xu <address@hidden>
> > ---
>
> > + * Let's blame the glib bug mentioned in commit 2b3167 (again) for
>
> That 6-char commit id may become ambiguous soon (it's still rare to see
> ambiguity with an 8-char id, although I've seen it more in recent times
> than in the past; and git itself has moved from a 7-char default
> abbreviation length in the 2.0 days to what is now a 10-char default
> abbreviation in 2.13.5).
Thanks for noticing this. I'll use 10 chars in next post.
--
Peter Xu
- [Qemu-devel] [RFC 00/15] QMP: out-of-band (OOB) execution support, Peter Xu, 2017/09/14
- [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Peter Xu, 2017/09/14
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Eric Blake, 2017/09/19
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll,
Peter Xu <=
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Daniel P. Berrange, 2017/09/20
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Peter Xu, 2017/09/20
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Daniel P. Berrange, 2017/09/20
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Peter Xu, 2017/09/20
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Daniel P. Berrange, 2017/09/20
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Peter Xu, 2017/09/20
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Daniel P. Berrange, 2017/09/20
- Re: [Qemu-devel] [RFC 01/15] char-io: fix possible race on IOWatchPoll, Peter Xu, 2017/09/20
[Qemu-devel] [RFC 02/15] qobject: allow NULL for qstring_get_str(), Peter Xu, 2017/09/14