From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzdzW-0001X3-Ui for qemu-devel@nongnu.org; Tue, 11 Sep 2018 04:25:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fzdzW-0000Gn-Ap for qemu-devel@nongnu.org; Tue, 11 Sep 2018 04:25:46 -0400 Date: Tue, 11 Sep 2018 16:25:35 +0800 From: Fam Zheng Message-ID: <20180911082535.GH19292@lemon.usersys.redhat.com> References: <20180907161520.26349-1-kwolf@redhat.com> <20180907161520.26349-8-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180907161520.26349-8-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH 07/14] aio-wait: Increase num_waiters even in home thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-block@nongnu.org, mreitz@redhat.com, pbonzini@redhat.com, slp@redhat.com, qemu-devel@nongnu.org On Fri, 09/07 18:15, Kevin Wolf wrote: > 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. We can now move the atomic_inc/atomic_dec pair outside the if/else block, but that's cosmetic. Reviewed-by: Fam Zheng > > Signed-off-by: Kevin Wolf > --- > 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 >