[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/24] blkdebug: reschedule coroutine on the AioConte
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 09/24] blkdebug: reschedule coroutine on the AioContext it is running on |
Date: |
Mon, 20 Feb 2017 09:32:49 +0000 |
From: Paolo Bonzini <address@hidden>
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.
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <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] [PULL 00/24] Block patches, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 03/24] block-backend: allow blk_prw from coroutine context, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 01/24] block: move AioContext, QEMUTimer, main-loop to libqemuutil, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 02/24] aio: introduce aio_co_schedule and aio_co_wake, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 04/24] test-thread-pool: use generic AioContext infrastructure, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 05/24] io: add methods to set I/O handlers on AioContext, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 08/24] coroutine-lock: reschedule coroutine on the AioContext it was running on, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 06/24] io: make qio_channel_yield aware of AioContexts, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 07/24] nbd: convert to use qio_channel_yield, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 09/24] blkdebug: reschedule coroutine on the AioContext it is running on,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 10/24] qed: introduce qed_aio_start_io and qed_aio_next_io_cb, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 11/24] aio: push aio_context_acquire/release down to dispatching, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 12/24] block: explicitly acquire aiocontext in timers that need it, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 13/24] block: explicitly acquire aiocontext in callbacks that need it, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 14/24] block: explicitly acquire aiocontext in bottom halves that need it, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 15/24] block: explicitly acquire aiocontext in aio callbacks that need it, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 16/24] aio-posix: partially inline aio_dispatch into aio_poll, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 18/24] block: document fields protected by AioContext lock, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 17/24] async: remove unnecessary inc/dec pairs, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 20/24] coroutine-lock: add limited spinning to CoMutex, Stefan Hajnoczi, 2017/02/20