From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH v2] device-assignment: Register as un-migratable Date: Tue, 16 Nov 2010 00:45:05 +0100 Message-ID: <4CE1C601.2080902@web.de> References: <20101115230552.3872.96887.stgit@s20.home> <4CE1BE0D.4000904@web.de> <1289863476.2805.247.camel@x201> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig19B6CE292D6FE247F418BE50" Cc: kvm@vger.kernel.org, mst@redhat.com To: Alex Williamson Return-path: Received: from fmmailgate02.web.de ([217.72.192.227]:59096 "EHLO fmmailgate02.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753091Ab0KOXpg (ORCPT ); Mon, 15 Nov 2010 18:45:36 -0500 In-Reply-To: <1289863476.2805.247.camel@x201> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig19B6CE292D6FE247F418BE50 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am 16.11.2010 00:24, Alex Williamson wrote: > On Tue, 2010-11-16 at 00:11 +0100, Jan Kiszka wrote: >> Am 16.11.2010 00:06, Alex Williamson wrote: >>> Use register_device_unmigratable() to declare ourselves as >>> non-migratable. >>> >>> Signed-off-by: Alex Williamson >>> --- >>> >>> v2: Use dummy vmsd instead of dummy save_state >>> >>> hw/device-assignment.c | 10 ++++++++++ >>> 1 files changed, 10 insertions(+), 0 deletions(-) >>> >>> diff --git a/hw/device-assignment.c b/hw/device-assignment.c >>> index bde231d..154bb1a 100644 >>> --- a/hw/device-assignment.c >>> +++ b/hw/device-assignment.c >>> @@ -1434,6 +1434,10 @@ static void assigned_dev_unregister_msix_mmio(= AssignedDevice *dev) >>> dev->msix_table_page =3D NULL; >>> } >>> =20 >>> +static const VMStateDescription vmstate_assigned_device =3D { >>> + .name =3D "pci-assign" >>> +}; >>> + >>> static int assigned_initfn(struct PCIDevice *pci_dev) >>> { >>> AssignedDevice *dev =3D DO_UPCAST(AssignedDevice, dev, pci_dev);= >>> @@ -1490,6 +1494,11 @@ static int assigned_initfn(struct PCIDevice *p= ci_dev) >>> =20 >>> assigned_dev_load_option_rom(dev); >>> QLIST_INSERT_HEAD(&devs, dev, next); >>> + >>> + /* Register a vmsd so that we can mark it unmigratable. */ >>> + vmstate_register(&dev->dev.qdev, 0, &vmstate_assigned_device, de= v); >> >> Almost: You can register this vmstate description via assign_info >> (.qdev.vmsd =3D ....). >=20 > Only if you have some other suggestion on where to call > register_device_unmigratable rather than init. qdev_init looks like > this: >=20 > int qdev_init(DeviceState *dev) > { > int rc; >=20 > assert(dev->state =3D=3D DEV_STATE_CREATED); > rc =3D dev->info->init(dev, dev->info); > if (rc < 0) { > qdev_free(dev); > return rc; > } > qemu_register_reset(qdev_reset, dev); > if (dev->info->vmsd) { > vmstate_register_with_alias_id(dev, -1, dev->info->vmsd, dev, > dev->instance_id_alias, > dev->alias_required_for_version)= ; > } > dev->state =3D DEV_STATE_INITIALIZED; > return 0; > } >=20 > So the save state entry hasn't been inserted yet for me to attach the > no_migrate flag to from init :( I see. I think that's a sign register_device_unmigratable should be obsoleted as well by introducing no_migrate to vmstate (one day, vmsd =3D= =3D NULL could replace this flag). BTW, ivshmem could resolve its need for dynamic no_migrate by introducing two device types: one that is migratable (ivshmem-master) and one that isn't (normal peer devices). Jan --------------enig19B6CE292D6FE247F418BE50 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAkzhxgIACgkQitSsb3rl5xTZugCg7qHrFF2VWjvmV3g+fNy/56Pw /n4Anj0PMHUpzcFkR2XLFx0Dp5+GiMHd =N6xJ -----END PGP SIGNATURE----- --------------enig19B6CE292D6FE247F418BE50--