[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH] fix select(2) race between main_loop_wait a
From: |
Avi Kivity |
Subject: |
Re: [Qemu-devel] [RFC PATCH] fix select(2) race between main_loop_wait and qemu_aio_wait |
Date: |
Mon, 05 Mar 2012 16:24:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 |
On 03/05/2012 11:07 AM, Jan Kiszka wrote:
> On 2012-03-05 09:34, Paolo Bonzini wrote:
> > This is quite ugly. Two threads, one running main_loop_wait and
> > one running qemu_aio_wait, can race with each other on running the
> > same iohandler. The result is that an iohandler could run while the
> > underlying socket is not readable or writable, with possibly ill effects.
>
> Hmm, isn't it a problem already that a socket is polled by two threads
> at the same time? Can't that be avoided?
Could it be done simply by adding a mutex there? It's hardly a clean
fix, but it's not a clean problem.
> Long-term, I'd like to cut out certain file descriptors from the main
> loop and process them completely in separate threads (for separate
> locking, prioritization etc.). Dunno how NBD works, but maybe it should
> be reworked like this already.
Ideally qemu_set_fd_handler2() should be made thread local, and each
device thread would run a copy of the main loop, just working on
different data.
--
error compiling committee.c: too many arguments to function
- [Qemu-devel] [RFC PATCH] fix select(2) race between main_loop_wait and qemu_aio_wait, Paolo Bonzini, 2012/03/05
- Re: [Qemu-devel] [RFC PATCH] fix select(2) race between main_loop_wait and qemu_aio_wait, Jan Kiszka, 2012/03/05
- Re: [Qemu-devel] [RFC PATCH] fix select(2) race between main_loop_wait and qemu_aio_wait, Paolo Bonzini, 2012/03/05
- Re: [Qemu-devel] [RFC PATCH] fix select(2) race between main_loop_wait and qemu_aio_wait, Avi Kivity, 2012/03/05
- Re: [Qemu-devel] [RFC PATCH] fix select(2) race between main_loop_wait and qemu_aio_wait, Paolo Bonzini, 2012/03/05
- Re: [Qemu-devel] [RFC PATCH] fix select(2) race between main_loop_wait and qemu_aio_wait, Avi Kivity, 2012/03/05
- Re: [Qemu-devel] [RFC PATCH] fix select(2) race between main_loop_wait and qemu_aio_wait, Paolo Bonzini, 2012/03/06