mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
iothread: release AioContext around aio_poll
This is the first step towards having fine-grained critical sections in
dataplane threads, which will resolve lock ordering problems between
address_space_* functions (which need the BQL when doing MMIO, even
after we complete RCU-based dispatch) and the AioContext.
Because AioContext does not use contention callbacks anymore, the
unit test has to be changed.
Previously applied as a0710f7995
and
then reverted.
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1477565348-5458-19-git-send-email-pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
This commit is contained in:
parent
c9d1a56174
commit
65c1b5b622
5 changed files with 41 additions and 55 deletions
11
iothread.c
11
iothread.c
|
@ -40,7 +40,6 @@ AioContext *qemu_get_current_aio_context(void)
|
|||
static void *iothread_run(void *opaque)
|
||||
{
|
||||
IOThread *iothread = opaque;
|
||||
bool blocking;
|
||||
|
||||
rcu_register_thread();
|
||||
|
||||
|
@ -50,14 +49,8 @@ static void *iothread_run(void *opaque)
|
|||
qemu_cond_signal(&iothread->init_done_cond);
|
||||
qemu_mutex_unlock(&iothread->init_done_lock);
|
||||
|
||||
while (!iothread->stopping) {
|
||||
aio_context_acquire(iothread->ctx);
|
||||
blocking = true;
|
||||
while (!iothread->stopping && aio_poll(iothread->ctx, blocking)) {
|
||||
/* Progress was made, keep going */
|
||||
blocking = false;
|
||||
}
|
||||
aio_context_release(iothread->ctx);
|
||||
while (!atomic_read(&iothread->stopping)) {
|
||||
aio_poll(iothread->ctx, true);
|
||||
}
|
||||
|
||||
rcu_unregister_thread();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue