[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/24] coroutine-lock: reschedule coroutine on the Ai
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 08/24] coroutine-lock: reschedule coroutine on the AioContext it was running on |
Date: |
Mon, 20 Feb 2017 09:32:48 +0000 |
From: Paolo Bonzini <address@hidden>
As a small step towards the introduction of multiqueue, we want
coroutines to remain on the same AioContext that started them,
unless they are moved explicitly with e.g. aio_co_schedule. This patch
avoids that coroutines switch AioContext when they use a CoMutex.
For now it does not make much of a difference, because the CoMutex
is not thread-safe and the AioContext itself is used to protect the
CoMutex from concurrent access. However, this is going to change.
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
util/qemu-coroutine-lock.c | 5 ++---
util/trace-events | 1 -
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c
index 14cf9ce..e6afd1a 100644
--- a/util/qemu-coroutine-lock.c
+++ b/util/qemu-coroutine-lock.c
@@ -27,6 +27,7 @@
#include "qemu/coroutine.h"
#include "qemu/coroutine_int.h"
#include "qemu/queue.h"
+#include "block/aio.h"
#include "trace.h"
void qemu_co_queue_init(CoQueue *queue)
@@ -63,7 +64,6 @@ void qemu_co_queue_run_restart(Coroutine *co)
static bool qemu_co_queue_do_restart(CoQueue *queue, bool single)
{
- Coroutine *self = qemu_coroutine_self();
Coroutine *next;
if (QSIMPLEQ_EMPTY(&queue->entries)) {
@@ -72,8 +72,7 @@ static bool qemu_co_queue_do_restart(CoQueue *queue, bool
single)
while ((next = QSIMPLEQ_FIRST(&queue->entries)) != NULL) {
QSIMPLEQ_REMOVE_HEAD(&queue->entries, co_queue_next);
- QSIMPLEQ_INSERT_TAIL(&self->co_queue_wakeup, next, co_queue_next);
- trace_qemu_co_queue_next(next);
+ aio_co_wake(next);
if (single) {
break;
}
diff --git a/util/trace-events b/util/trace-events
index 53bd70c..65c9787 100644
--- a/util/trace-events
+++ b/util/trace-events
@@ -28,7 +28,6 @@ qemu_coroutine_terminate(void *co) "self %p"
# util/qemu-coroutine-lock.c
qemu_co_queue_run_restart(void *co) "co %p"
-qemu_co_queue_next(void *nxt) "next %p"
qemu_co_mutex_lock_entry(void *mutex, void *self) "mutex %p self %p"
qemu_co_mutex_lock_return(void *mutex, void *self) "mutex %p self %p"
qemu_co_mutex_unlock_entry(void *mutex, void *self) "mutex %p self %p"
--
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 <=
- [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, 2017/02/20
- [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