From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKPvZ-0003ZZ-Ja for qemu-devel@nongnu.org; Wed, 29 Jul 2015 07:53:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKPvY-0003Rl-JH for qemu-devel@nongnu.org; Wed, 29 Jul 2015 07:53:41 -0400 Date: Wed, 29 Jul 2015 19:53:33 +0800 From: Fam Zheng Message-ID: <20150729115333.GA15022@ad.nay.redhat.com> References: <1438144934-23619-1-git-send-email-famz@redhat.com> <1438144934-23619-12-git-send-email-famz@redhat.com> <55B882C1.8070500@redhat.com> <20150729105725.GA10376@ad.nay.redhat.com> <55B8B2C3.9050307@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55B8B2C3.9050307@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 11/11] block: Only poll block layer fds in bdrv_aio_poll List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org On Wed, 07/29 13:02, Paolo Bonzini wrote: > > > On 29/07/2015 12:57, Fam Zheng wrote: > > On Wed, 07/29 09:37, Paolo Bonzini wrote: > >> > >> > >> On 29/07/2015 06:42, Fam Zheng wrote: > >>> @@ -2613,6 +2613,8 @@ bool bdrv_aio_poll(AioContext *ctx, bool blocking) > >>> { > >>> bool ret; > >>> > >>> + aio_disable_clients(ctx, AIO_CLIENT_DATAPLANE | AIO_CLIENT_NBD_SERVER); > >>> ret = aio_poll(ctx, blocking); > >>> + aio_enable_clients(ctx, AIO_CLIENT_DATAPLANE | AIO_CLIENT_NBD_SERVER); > >>> return ret; > >> > >> This is not enough, because another thread's aio_poll can sneak in > >> between calls to bdrv_aio_poll if the AioContext lock is released, and > >> they will use the full set of clients. > >> > >> Similar to your v1, it works with the large critical sections we > >> currently have, but it has the same problem in the longer term. > > > > Can we add more disable/enable pairs around bdrv_drain on top? > > Yes, though I think you'd end up reverting patches 10 and 11 in the end. We will add outer disable/enable pairs to prevent another threads's aio_poll from sneaking in between bdrv_aio_poll calls, but we needn't obsolete bdrv_aio_poll() because of that - it can be useful by itself. For example bdrv_aio_cancel shouldn't look at ioeventfd, otherwise it could spin for too long on high load. Does that make sense? Fam > > All 11 patches are okay, though it would be great if you could post the > full series before this is applied. > > Paolo