[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPol
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPoll |
Date: |
Tue, 7 Nov 2017 14:43:28 +0800 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Mon, 11/06 17:46, 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.
Looks sane,
Reviewed-by: Fam Zheng <address@hidden>
- [Qemu-devel] [RFC v3 00/27] QMP: out-of-band (OOB) execution support, Peter Xu, 2017/11/06
- [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPoll, Peter Xu, 2017/11/06
- Re: [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPoll,
Fam Zheng <=
- Re: [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPoll, Stefan Hajnoczi, 2017/11/13
- Re: [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPoll, Peter Xu, 2017/11/14
- Re: [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPoll, Stefan Hajnoczi, 2017/11/14
- Re: [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPoll, Peter Xu, 2017/11/14
- Re: [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPoll, Stefan Hajnoczi, 2017/11/15
- Re: [Qemu-devel] [RFC v3 01/27] char-io: fix possible race on IOWatchPoll, Peter Xu, 2017/11/15
[Qemu-devel] [RFC v3 02/27] qobject: introduce qstring_get_try_str(), Peter Xu, 2017/11/06
[Qemu-devel] [RFC v3 03/27] qobject: introduce qobject_get_try_str(), Peter Xu, 2017/11/06