qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [QEMU-devel][PATCH v4 0/2] Fix concurrent aio_poll/set_


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [QEMU-devel][PATCH v4 0/2] Fix concurrent aio_poll/set_fd_handler.
Date: Fri, 21 Dec 2018 12:34:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

On 20/12/18 17:37, Stefan Hajnoczi wrote:
> On Thu, Dec 20, 2018 at 04:20:28PM +0100, address@hidden wrote:
>> From: Remy Noel <address@hidden>
>>
>> It is possible for an io_poll/read/write callback to be concurrently 
>> executed along
>> with an aio_set_fd_handlers. This can cause all sorts of problems, like
>> a NULL callback or a bad opaque pointer.
>>
>> V2:
>>     * Do not use RCU anymore as it inccurs a performance loss
>> V3:
>>     * Don't drop revents when a handler is modified [Stefan]
>> V4:
>>     * Unregister fd from ctx epoll when removing fd_handler [Paolo]
>>
>> Remy Noel (2):
>>   aio-posix: Unregister fd from ctx epoll when removing fd_handler.
>>   aio-posix: Fix concurrent aio_poll/set_fd_handler.
>>
>>  util/aio-posix.c | 90 +++++++++++++++++++++++++++++-------------------
>>  util/aio-win32.c | 67 ++++++++++++++++-------------------
>>  2 files changed, 84 insertions(+), 73 deletions(-)
>>
>> -- 
>> 2.19.2
>>
> 
> Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>

FWIW, I had missed the early version that used RCU, but lockcnt is
already very RCU-like, so not using RCU is the right thing to do.  The
difference between lockcnt and RCU is that cleanup is done by the reader
instead of a separate thread.  Because we know that reader/writer
concurrency is very rare for AioContext handlers, the tradeoffs favor
lockcnt over RCU.

Paolo

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]