[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/16] block: explicitly acquire aiocontext in t
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 10/16] block: explicitly acquire aiocontext in timers that need it |
Date: |
Wed, 18 Jan 2017 17:44:24 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
On 18/01/2017 16:43, Stefan Hajnoczi wrote:
> On Fri, Jan 13, 2017 at 02:17:25PM +0100, Paolo Bonzini wrote:
>> diff --git a/block/null.c b/block/null.c
>> index b300390..356209a 100644
>> --- a/block/null.c
>> +++ b/block/null.c
>> @@ -141,7 +141,11 @@ static void null_bh_cb(void *opaque)
>> static void null_timer_cb(void *opaque)
>> {
>> NullAIOCB *acb = opaque;
>> + AioContext *ctx = bdrv_get_aio_context(acb->common.bs);
>> +
>> + aio_context_acquire(ctx);
>> acb->common.cb(acb->common.opaque, 0);
>> + aio_context_release(ctx);
>> timer_deinit(&acb->timer);
>> qemu_aio_unref(acb);
>
> Is qemu_aio_unref() thread-safe?
qemu_aio_ref()/qemu_aio_unref() is only used by bdrv_aio_cancel, which
in turn is not used by dataplane. So in the multithreaded case
qemu_aio_unref() is effectively qemu_aio_free().
Probably needs more documentation, or a different implementation of
bdrv_aio_cancel (e.g. replacing the reference counting with a
NotifierList of some kind). Let me know what you prefer for v2.
Paolo
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 15/16] async: remove unnecessary inc/dec pairs, (continued)
[Qemu-devel] [PATCH 12/16] block: explicitly acquire aiocontext in bottom halves that need it, Paolo Bonzini, 2017/01/13
[Qemu-devel] [PATCH 11/16] block: explicitly acquire aiocontext in callbacks that need it, Paolo Bonzini, 2017/01/13
[Qemu-devel] [PATCH 14/16] aio-posix: partially inline aio_dispatch into aio_poll, Paolo Bonzini, 2017/01/13
Re: [Qemu-devel] [PATCH 00/16] aio_context_acquire/release pushdown, part 2, Fam Zheng, 2017/01/16