From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwELY-0007om-Ld for qemu-devel@nongnu.org; Fri, 18 Jan 2013 10:59:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwELW-0005nY-Tg for qemu-devel@nongnu.org; Fri, 18 Jan 2013 10:59:12 -0500 Received: from mail-bk0-f41.google.com ([209.85.214.41]:56074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwELW-0005n4-J0 for qemu-devel@nongnu.org; Fri, 18 Jan 2013 10:59:10 -0500 Received: by mail-bk0-f41.google.com with SMTP id jg9so2104736bkc.28 for ; Fri, 18 Jan 2013 07:59:09 -0800 (PST) Date: Fri, 18 Jan 2013 16:59:05 +0100 From: Stefan Hajnoczi Message-ID: <20130118155905.GA21114@stefanha-thinkpad.redhat.com> References: <1358266778-14621-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1358266778-14621-1-git-send-email-stefanha@redhat.com> Subject: Re: [Qemu-devel] [PATCH] dataplane: avoid reentrancy during virtio_blk_data_plane_stop() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel@nongnu.org, "Michael S. Tsirkin" On Tue, Jan 15, 2013 at 05:19:38PM +0100, Stefan Hajnoczi wrote: > When dataplane is stopping, the s->vdev->binding->set_host_notifier(..., > false) call can invoke the virtqueue handler if an ioeventfd > notification is pending. This causes hw/virtio-blk.c to invoke > virtio_blk_data_plane_start() before virtio_blk_data_plane_stop() > returns! > > The result is that we try to restart dataplane while trying to stop it > and the following assertion is raised: > > msix_set_mask_notifier: Assertion `!dev->msix_mask_notifier' failed. > > Although the code was intended to prevent this scenario, the s->started > boolean isn't enough. Add s->stopping so that we can postpone clearing > s->started until we've completely stopped dataplane. > > This way, virtqueue handler calls during virtio_blk_data_plane_stop() > are ignored. When dataplane is legitimately started again later we > already self-kick ourselves to resume processing. > > Signed-off-by: Stefan Hajnoczi > --- > hw/dataplane/virtio-blk.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) Applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan