From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGSN5-0007UV-1H for qemu-devel@nongnu.org; Fri, 24 Jun 2016 10:46:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGSN0-0003zz-0e for qemu-devel@nongnu.org; Fri, 24 Jun 2016 10:46:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGSMz-0003zr-RQ for qemu-devel@nongnu.org; Fri, 24 Jun 2016 10:46:09 -0400 Date: Fri, 24 Jun 2016 16:46:05 +0200 From: Kevin Wolf Message-ID: <20160624144605.GF5422@noname.redhat.com> References: <1466775608-31052-1-git-send-email-roman.penyaev@profitbricks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1466775608-31052-1-git-send-email-roman.penyaev@profitbricks.com> Subject: Re: [Qemu-devel] [PATCH 1/1] Revert "linux-aio: Cancel BH if not needed" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Pen Cc: Paolo Bonzini , Stefan Hajnoczi , qemu-devel@nongnu.org Am 24.06.2016 um 15:40 hat Roman Pen geschrieben: > This reverts commit ccb9dc10129954d0bcd7814298ed445e684d5a2a, > which causes MQ stuck while doing IO thru virtio_blk. It would be good to have a theory why this happens. > diff --git a/block/linux-aio.c b/block/linux-aio.c > index e468960..fe7cece 100644 > --- a/block/linux-aio.c > +++ b/block/linux-aio.c > @@ -149,8 +149,6 @@ static void qemu_laio_completion_bh(void *opaque) > if (!s->io_q.plugged && !QSIMPLEQ_EMPTY(&s->io_q.pending)) { > ioq_submit(s); > } > - > - qemu_bh_cancel(s->completion_bh); > } Maybe if a nested event loops cancels the BH, it's missing on the next loop iteration. Before my patch, the nested callback happened to leave an additional BH around which the outer one actually needs. I find this a bit ugly, but if we're okay with this mechanism we could add a counter for the nesting level and only cancel on the top level. If you find it as ugly as I do, a cleaner solution would be to schedule the BH inside the loop. > @@ -158,7 +156,7 @@ static void qemu_laio_completion_cb(EventNotifier *e) > LinuxAioState *s = container_of(e, LinuxAioState, e); > > if (event_notifier_test_and_clear(&s->e)) { > - qemu_laio_completion_bh(s); > + qemu_bh_schedule(s->completion_bh); > } > } I can't see how this hunk would make a difference. Can you confirm that just the first hunk is enough to fix the problem? Kevin