From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM4ws-0008WQ-Id for qemu-devel@nongnu.org; Thu, 12 Feb 2015 20:21:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YM4wm-0005DV-Uj for qemu-devel@nongnu.org; Thu, 12 Feb 2015 20:21:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36924) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM4wm-0005DR-NA for qemu-devel@nongnu.org; Thu, 12 Feb 2015 20:21:32 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1D1LV1m013681 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 12 Feb 2015 20:21:31 -0500 Date: Fri, 13 Feb 2015 09:21:29 +0800 From: Fam Zheng Message-ID: <20150213012129.GA20581@ad.nay.redhat.com> References: <1423718462-25566-1-git-send-email-famz@redhat.com> <1423718462-25566-4-git-send-email-famz@redhat.com> <54DCB8DE.4090302@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54DCB8DE.4090302@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/3] virtio-scsi-dataplane: Use main thread BH to set BDS' aio context List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Thu, 02/12 15:29, Paolo Bonzini wrote: > > > On 12/02/2015 06:21, Fam Zheng wrote: > > Before processing a request, virtio-scsi dataplane will check if the > > backend runs on the same context with it. If not, it has to be moved, > > with bdrv_set_aio_context. > > > > However this function is unsafe to be called from IOThread outside BQL. > > The reason is that it calls bdrv_drain_all(), to acquire and drain all > > existing BDS. Therefore there is a deadlock problem. > > > > Fix it by offloading the bdrv_set_aio_context to main loop thread, > > through a BH (#1). This main loop BH will set the context, then notify > > the calling thread with another BH (#2). In BH (#2), we can continue the > > virtio-scsi request processing. > > > > A queue is added to VirtIOSCSI for tracking the pending requests, so in > > virtio_scsi_dataplane_stop, we have to drain them for migration. > > > > Signed-off-by: Fam Zheng > > Could you just do set_aio_context for all devices when starting > dataplane? For example with a new scsi_device_set_aio_context function > (and a new method in SCSIDeviceClass). > > Maybe I'm missing the obvious. :) > Per VQ IOThread stills needs it, in the case that guest switches the VQ of a disk on the fly. Fam