[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [RFC PATCH] async: Fix aio_notify_accept
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-block] [RFC PATCH] async: Fix aio_notify_accept |
Date: |
Fri, 3 Aug 2018 18:51:35 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 03/08/2018 17:49, Fam Zheng wrote:
> void aio_notify_accept(AioContext *ctx)
> {
> - if (atomic_xchg(&ctx->notified, false)) {
> + /* If ctx->notify_me >= 2, another aio_poll() is waiting which may need
> the
> + * ctx->notifier event to wake up, so don't already clear it just
> because "we" are
> + * done iterating. */
> + if (atomic_read(&ctx->notify_me) < 2
> + && atomic_xchg(&ctx->notified, false)) {
> event_notifier_test_and_clear(&ctx->notifier);
> }
> }
I'm worried that this would this cause a busy wait, and I don't
understand the issue.
When aio_poll()s are nested, outer calls are in the "dispatch" phase and
therefore do not need notification.
In your situation is notify_me actually ever >2?
Paolo