[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/18] blkdebug: reschedule coroutine on the AioCont
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 09/18] blkdebug: reschedule coroutine on the AioContext it is running on |
Date: |
Mon, 13 Feb 2017 11:08:57 +0100 |
Keep the coroutine on the same AioContext. Without this change,
there would be a race between yielding the coroutine and reentering it.
While the race cannot happen now, because the code only runs from a single
AioContext, this will change with multiqueue support in the block layer.
While doing the change, replace custom bottom half with aio_co_schedule.
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/blkdebug.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/block/blkdebug.c b/block/blkdebug.c
index acccf85..d8eee1b 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -405,12 +405,6 @@ out:
return ret;
}
-static void error_callback_bh(void *opaque)
-{
- Coroutine *co = opaque;
- qemu_coroutine_enter(co);
-}
-
static int inject_error(BlockDriverState *bs, BlkdebugRule *rule)
{
BDRVBlkdebugState *s = bs->opaque;
@@ -423,8 +417,7 @@ static int inject_error(BlockDriverState *bs, BlkdebugRule
*rule)
}
if (!immediately) {
- aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), error_callback_bh,
- qemu_coroutine_self());
+ aio_co_schedule(qemu_get_current_aio_context(), qemu_coroutine_self());
qemu_coroutine_yield();
}
--
2.9.3
- [Qemu-devel] [PATCH v4 00/18] aio_context_acquire/release pushdown, part 2, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 03/18] block-backend: allow blk_prw from coroutine context, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 04/18] test-thread-pool: use generic AioContext infrastructure, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 01/18] block: move AioContext, QEMUTimer, main-loop to libqemuutil, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 02/18] aio: introduce aio_co_schedule and aio_co_wake, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 05/18] io: add methods to set I/O handlers on AioContext, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 06/18] io: make qio_channel_yield aware of AioContexts, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 08/18] coroutine-lock: reschedule coroutine on the AioContext it was running on, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 09/18] blkdebug: reschedule coroutine on the AioContext it is running on,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 10/18] qed: introduce qed_aio_start_io and qed_aio_next_io_cb, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 07/18] nbd: convert to use qio_channel_yield, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 11/18] aio: push aio_context_acquire/release down to dispatching, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 12/18] block: explicitly acquire aiocontext in timers that need it, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 13/18] block: explicitly acquire aiocontext in callbacks that need it, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 16/18] aio-posix: partially inline aio_dispatch into aio_poll, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 17/18] async: remove unnecessary inc/dec pairs, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 15/18] block: explicitly acquire aiocontext in aio callbacks that need it, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 14/18] block: explicitly acquire aiocontext in bottom halves that need it, Paolo Bonzini, 2017/02/13
- [Qemu-devel] [PATCH 18/18] block: document fields protected by AioContext lock, Paolo Bonzini, 2017/02/13