From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1cof-0000BM-Jx for qemu-devel@nongnu.org; Tue, 23 Jul 2013 09:39:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1coe-0003Sc-Bq for qemu-devel@nongnu.org; Tue, 23 Jul 2013 09:39:49 -0400 Received: from mail-ee0-x236.google.com ([2a00:1450:4013:c00::236]:45987) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1coe-0003SW-5b for qemu-devel@nongnu.org; Tue, 23 Jul 2013 09:39:48 -0400 Received: by mail-ee0-f54.google.com with SMTP id t10so4506930eei.41 for ; Tue, 23 Jul 2013 06:39:47 -0700 (PDT) Date: Tue, 23 Jul 2013 15:39:44 +0200 From: Stefan Hajnoczi Message-ID: <20130723133944.GC27684@stefanha-thinkpad.redhat.com> References: <1374053720-28420-1-git-send-email-stefanha@redhat.com> <1374053720-28420-4-git-send-email-stefanha@redhat.com> <51E6716E.8050304@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51E6716E.8050304@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/3] dataplane: enable virtio-blk x-data-plane=on live migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Juan Quintela On Wed, Jul 17, 2013 at 12:26:54PM +0200, Paolo Bonzini wrote: > Il 17/07/2013 11:35, Stefan Hajnoczi ha scritto: > > @@ -628,6 +629,34 @@ void virtio_blk_set_conf(DeviceState *dev, VirtIOBlkConf *blk) > > memcpy(&(s->blk), blk, sizeof(struct VirtIOBlkConf)); > > } > > > > +#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE > > +/* Disable dataplane thread during live migration since it does not > > + * update the dirty memory bitmap yet. > > + */ > > +static void virtio_blk_migration_state_changed(Notifier *notifier, void *data) > > +{ > > + VirtIOBlock *s = container_of(notifier, VirtIOBlock, > > + migration_state_notifier); > > + MigrationState *mig = data; > > + > > + if (migration_is_active(mig)) { > > + if (!s->dataplane) { > > + return; > > + } > > + virtio_blk_data_plane_destroy(s->dataplane); > > + s->dataplane = NULL; > > + } else if (migration_has_finished(mig) || > > + migration_has_failed(mig)) { > > + if (s->dataplane) { > > + return; > > + } > > + bdrv_drain_all(); /* complete in-flight non-dataplane requests */ > > + virtio_blk_data_plane_create(VIRTIO_DEVICE(s), &s->blk, > > + &s->dataplane); > > + } > > +} > > Perhaps you can call bdrv_set_in_use here (set it to 1 after > destruction, and to 0 before creation), so that you do not need the > check in virtio_blk_data_plane_create? The bdrv_in_use() check fixes a bug that was present before this series. Therefore I split it into a separate commit in v3 and CCed qemu-stable@nongnu.org. Stefan