[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] async: add aio_bh_schedule_oneshot
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] async: add aio_bh_schedule_oneshot |
Date: |
Wed, 5 Oct 2016 15:55:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 05/10/2016 15:13, Stefan Hajnoczi wrote:
> > qemu_bh_delete is already clearing bh->scheduled at the same time
> > as it's setting bh->deleted. Since it's not using any memory
> > barriers, there is no synchronization going on for bh->deleted,
> > and this makes the bh->deleted checks superfluous in aio_compute_timeout,
> > aio_bh_poll and aio_ctx_check.
>
> Yikes. On one hand this sounds scary but in practice qemu_bh_delete()
> isn't called from another thread so the next aio_bh_poll() will indeed
> clean it up instead of dispatching a deleted BH.
>
> Due to the nature of this change I suggest making it in a separate
> patch.
Separate from what? (Sorry if I'm being dense).
>>
>> + * aio_bh_schedule_oneshot: Allocate a new bottom half structure that will
>> run
>> + * only once and as soon as possible.
>> + *
>> + * Bottom halves are lightweight callbacks whose invocation is guaranteed
>> + * to be wait-free, thread-safe and signal-safe. The #QEMUBH structure
>> + * is opaque and must be allocated prior to its use.
>
> I'm confused. There is no QEMUBH structure in this function
> prototype. Is this comment from an earlier version of this function?
No, it's from aio_bh_new. Of course this one is neither wait-free nor
signal-safe. Kevin, do you want me to respin?
Paolo
Re: [Qemu-devel] [PATCH 0/2] block: introduce and use aio_bh_schedule_oneshot, Kevin Wolf, 2016/10/05