|
|
1bdc94 |
From efb378ef6983c9f7cc7cdb2cc0540a52b05ff916 Mon Sep 17 00:00:00 2001
|
|
|
1bdc94 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Date: Fri, 14 Sep 2018 10:55:26 +0200
|
|
|
1bdc94 |
Subject: [PATCH 35/49] aio-wait: Increase num_waiters even in home thread
|
|
|
1bdc94 |
|
|
|
1bdc94 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Message-id: <20180914105540.18077-29-kwolf@redhat.com>
|
|
|
1bdc94 |
Patchwork-id: 82179
|
|
|
1bdc94 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 28/42] aio-wait: Increase num_waiters even in home thread
|
|
|
1bdc94 |
Bugzilla: 1601212
|
|
|
1bdc94 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Even if AIO_WAIT_WHILE() is called in the home context of the
|
|
|
1bdc94 |
AioContext, we still want to allow the condition to change depending on
|
|
|
1bdc94 |
other threads as long as they kick the AioWait. Specfically block jobs
|
|
|
1bdc94 |
can be running in an I/O thread and should then be able to kick a drain
|
|
|
1bdc94 |
in the main loop context.
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Reviewed-by: Fam Zheng <famz@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
1bdc94 |
---
|
|
|
1bdc94 |
include/block/aio-wait.h | 6 +++---
|
|
|
1bdc94 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/include/block/aio-wait.h b/include/block/aio-wait.h
|
|
|
1bdc94 |
index c85a62f..600fad1 100644
|
|
|
1bdc94 |
--- a/include/block/aio-wait.h
|
|
|
1bdc94 |
+++ b/include/block/aio-wait.h
|
|
|
1bdc94 |
@@ -76,6 +76,8 @@ typedef struct {
|
|
|
1bdc94 |
bool waited_ = false; \
|
|
|
1bdc94 |
AioWait *wait_ = (wait); \
|
|
|
1bdc94 |
AioContext *ctx_ = (ctx); \
|
|
|
1bdc94 |
+ /* Increment wait_->num_waiters before evaluating cond. */ \
|
|
|
1bdc94 |
+ atomic_inc(&wait_->num_waiters); \
|
|
|
1bdc94 |
if (ctx_ && in_aio_context_home_thread(ctx_)) { \
|
|
|
1bdc94 |
while ((cond)) { \
|
|
|
1bdc94 |
aio_poll(ctx_, true); \
|
|
|
1bdc94 |
@@ -84,8 +86,6 @@ typedef struct {
|
|
|
1bdc94 |
} else { \
|
|
|
1bdc94 |
assert(qemu_get_current_aio_context() == \
|
|
|
1bdc94 |
qemu_get_aio_context()); \
|
|
|
1bdc94 |
- /* Increment wait_->num_waiters before evaluating cond. */ \
|
|
|
1bdc94 |
- atomic_inc(&wait_->num_waiters); \
|
|
|
1bdc94 |
while ((cond)) { \
|
|
|
1bdc94 |
if (ctx_) { \
|
|
|
1bdc94 |
aio_context_release(ctx_); \
|
|
|
1bdc94 |
@@ -96,8 +96,8 @@ typedef struct {
|
|
|
1bdc94 |
} \
|
|
|
1bdc94 |
waited_ = true; \
|
|
|
1bdc94 |
} \
|
|
|
1bdc94 |
- atomic_dec(&wait_->num_waiters); \
|
|
|
1bdc94 |
} \
|
|
|
1bdc94 |
+ atomic_dec(&wait_->num_waiters); \
|
|
|
1bdc94 |
waited_; })
|
|
|
1bdc94 |
|
|
|
1bdc94 |
/**
|
|
|
1bdc94 |
--
|
|
|
1bdc94 |
1.8.3.1
|
|
|
1bdc94 |
|