AioContext: acquire/release AioContext during aio_poll

This is the first step in pushing down acquire/release, and will let
rfifolock drop the contention callback feature.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1424449612-18215-3-git-send-email-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Paolo Bonzini 2015-02-20 17:26:51 +01:00 committed by Kevin Wolf
parent e98ab09709
commit 49110174f8
3 changed files with 24 additions and 6 deletions

View file

@ -118,13 +118,14 @@ void aio_context_ref(AioContext *ctx);
void aio_context_unref(AioContext *ctx);
/* Take ownership of the AioContext. If the AioContext will be shared between
* threads, a thread must have ownership when calling aio_poll().
* threads, and a thread does not want to be interrupted, it will have to
* take ownership around calls to aio_poll(). Otherwise, aio_poll()
* automatically takes care of calling aio_context_acquire and
* aio_context_release.
*
* Note that multiple threads calling aio_poll() means timers, BHs, and
* callbacks may be invoked from a different thread than they were registered
* from. Therefore, code must use AioContext acquire/release or use
* fine-grained synchronization to protect shared state if other threads will
* be accessing it simultaneously.
* Access to timers and BHs from a thread that has not acquired AioContext
* is possible. Access to callbacks for now must be done while the AioContext
* is owned by the thread (FIXME).
*/
void aio_context_acquire(AioContext *ctx);