[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 03/17] aio-wait: Increase num_waiters even in hom
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH v2 03/17] aio-wait: Increase num_waiters even in home thread |
Date: |
Thu, 13 Sep 2018 14:52:03 +0200 |
Even if AIO_WAIT_WHILE() is called in the home context of the
AioContext, we still want to allow the condition to change depending on
other threads as long as they kick the AioWait. Specfically block jobs
can be running in an I/O thread and should then be able to kick a drain
in the main loop context.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
---
include/block/aio-wait.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/block/aio-wait.h b/include/block/aio-wait.h
index c85a62f798..46ba7f9111 100644
--- a/include/block/aio-wait.h
+++ b/include/block/aio-wait.h
@@ -77,10 +77,12 @@ typedef struct {
AioWait *wait_ = (wait); \
AioContext *ctx_ = (ctx); \
if (ctx_ && in_aio_context_home_thread(ctx_)) { \
+ atomic_inc(&wait_->num_waiters); \
while ((cond)) { \
aio_poll(ctx_, true); \
waited_ = true; \
} \
+ atomic_dec(&wait_->num_waiters); \
} else { \
assert(qemu_get_current_aio_context() == \
qemu_get_aio_context()); \
--
2.13.6
- [Qemu-devel] [PATCH v2 00/17] Fix some jobs/drain/aio_poll related hangs, Kevin Wolf, 2018/09/13
- [Qemu-devel] [PATCH v2 04/17] test-bdrv-drain: Drain with block jobs in an I/O thread, Kevin Wolf, 2018/09/13
- [Qemu-devel] [PATCH v2 05/17] test-blockjob: Acquire AioContext around job_cancel_sync(), Kevin Wolf, 2018/09/13
- [Qemu-devel] [PATCH v2 06/17] job: Use AIO_WAIT_WHILE() in job_finish_sync(), Kevin Wolf, 2018/09/13
- [Qemu-devel] [PATCH v2 09/17] block-backend: Add .drained_poll callback, Kevin Wolf, 2018/09/13