From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBsyf-0004rO-TL for qemu-devel@nongnu.org; Fri, 07 Feb 2014 16:28:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WBsya-0007So-6q for qemu-devel@nongnu.org; Fri, 07 Feb 2014 16:28:49 -0500 Received: from cantor2.suse.de ([195.135.220.15]:37082 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBsyZ-0007Sj-Sz for qemu-devel@nongnu.org; Fri, 07 Feb 2014 16:28:44 -0500 Message-ID: <52F55006.1030509@suse.de> Date: Fri, 07 Feb 2014 22:28:38 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1375063438-3149-1-git-send-email-afaerber@suse.de> <20130902114109.GD20911@redhat.com> In-Reply-To: <20130902114109.GD20911@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC for-next 0/2] QOM VMStateDescription remix List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Juan Quintela , qemu-devel@nongnu.org, Anthony Liguori , "Michael S. Tsirkin" Peter, Am 02.09.2013 13:41, schrieb Michael S. Tsirkin: > On Mon, Jul 29, 2013 at 04:03:56AM +0200, Andreas F=E4rber wrote: >> Hello, >> >> Based on a comment from mst, this mini-series proposes to change seman= tics of >> VMStateDescription registration to be more similar to those of static = properties. >> >> Today, a device has one VMStateDescription, the last assignment to dc-= >vmsd wins. >> This means that a device must take care to include state of its parent= type. >> To avoid dealing with individual fields, VMSTATE_STRUCT() and wrappers= have >> been used. Such fields often require access of the deprecated QOM pare= nt field. >> >> The proposal is that, e.g., TYPE_CPU assigns its own VMStateDescriptio= n and >> derived types (e.g., TYPE_ALPHA_CPU) register a VMStateDescription wit= h name >> and versions to be used and only the fields specific to that type. >> In this v1, versions of the parents' vmsd are ignored, so someone chan= ging CPU's >> DeviceClass::vmsd (as opposed to DeviceClass::vmsd->fields[0].vmsd) wo= uld need >> to assure appropriate .field_exists tests or bump the version of deriv= ed types' >> vmsd as if a field had been added there. >> >> Only rudimentarily tested: I've run some machines that didn't crash on= startup. >> >> Regards, >> Andreas >> >> Cc: Michael S. Tsirkin >> Cc: Juan Quintela >> Cc: Anthony Liguori >> Cc: Paolo Bonzini >=20 > Overall okay > Acked-by: Michael S. Tsirkin >=20 > but obviously this needs much more testing, in particular > you need to test migration, not just check that it doesn't > crash :) >=20 > Also - are there devices that already set vmstate at several levels? Using my qom-test plus the following code: diff --git a/hw/core/qdev.c b/hw/core/qdev.c index bd8f6dd..b4a7638 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -708,6 +708,8 @@ static void device_register_vmstate(DeviceState *dev, Error **errp) if (dc->vmsd !=3D NULL) { if (vmsd =3D=3D NULL) { vmsd =3D dc->vmsd; + } else { + fprintf(stderr, "%s (%s)\n", object_class_get_name(oc), vmsd->name); } for (field =3D dc->vmsd->fields; field && field->name; field= ++) { fields++; I have found a single such case: armv7m_nvic overrides arm_gic_common with a completely different vmsd. How can we fix that? :) Thanks, Andreas > If yes this will change the wire protocol won't it? >=20 >> Andreas F=E4rber (2): >> qdev: Construct VMStateDescription from type hierarchy >> cpu: Move VMSTATE_CPU() into TYPE_CPU VMStateDescription >> >> hw/core/qdev.c | 102 +++++++++++++++++++++++++++++++++++++= ++++----- >> include/hw/qdev-core.h | 1 + >> include/qom/cpu.h | 4 -- >> qom/cpu.c | 10 +++++ >> stubs/vmstate.c | 1 + >> target-alpha/machine.c | 1 - >> target-openrisc/machine.c | 1 - >> 7 files changed, 103 insertions(+), 17 deletions(-) >> >> --=20 >> 1.8.1.4 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg