async: clarify usage of barriers in the polling case
Explain that aio_context_notifier_poll() relies on aio_notify_accept() to catch all the memory writes that were done before ctx->notified was set to true. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
8dd48650b4
commit
6229438cca
10
util/async.c
10
util/async.c
@ -474,8 +474,9 @@ void aio_notify_accept(AioContext *ctx)
|
|||||||
qatomic_set(&ctx->notified, false);
|
qatomic_set(&ctx->notified, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write ctx->notified before reading e.g. bh->flags. Pairs with smp_wmb
|
* Order reads of ctx->notified (in aio_context_notifier_poll()) and the
|
||||||
* in aio_notify.
|
* above clearing of ctx->notified before reads of e.g. bh->flags. Pairs
|
||||||
|
* with smp_wmb() in aio_notify.
|
||||||
*/
|
*/
|
||||||
smp_mb();
|
smp_mb();
|
||||||
}
|
}
|
||||||
@ -498,6 +499,11 @@ static bool aio_context_notifier_poll(void *opaque)
|
|||||||
EventNotifier *e = opaque;
|
EventNotifier *e = opaque;
|
||||||
AioContext *ctx = container_of(e, AioContext, notifier);
|
AioContext *ctx = container_of(e, AioContext, notifier);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* No need for load-acquire because we just want to kick the
|
||||||
|
* event loop. aio_notify_accept() takes care of synchronizing
|
||||||
|
* the event loop with the producers.
|
||||||
|
*/
|
||||||
return qatomic_read(&ctx->notified);
|
return qatomic_read(&ctx->notified);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user