From: "Andreas Färber" <afaerber@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Juan Quintela <quintela@redhat.com>,
qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [RFC for-next 0/2] QOM VMStateDescription remix
Date: Fri, 07 Feb 2014 22:28:38 +0100 [thread overview]
Message-ID: <52F55006.1030509@suse.de> (raw)
In-Reply-To: <20130902114109.GD20911@redhat.com>
Peter,
Am 02.09.2013 13:41, schrieb Michael S. Tsirkin:
> On Mon, Jul 29, 2013 at 04:03:56AM +0200, Andreas Färber wrote:
>> Hello,
>>
>> Based on a comment from mst, this mini-series proposes to change semantics 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 parent field.
>>
>> The proposal is that, e.g., TYPE_CPU assigns its own VMStateDescription and
>> derived types (e.g., TYPE_ALPHA_CPU) register a VMStateDescription with 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 changing CPU's
>> DeviceClass::vmsd (as opposed to DeviceClass::vmsd->fields[0].vmsd) would need
>> to assure appropriate .field_exists tests or bump the version of derived 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 <mst@redhat.com>
>> Cc: Juan Quintela <quintela@redhat.com>
>> Cc: Anthony Liguori <anthony@codemonkey.ws>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>
> Overall okay
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
>
> but obviously this needs much more testing, in particular
> you need to test migration, not just check that it doesn't
> crash :)
>
> 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 != NULL) {
if (vmsd == NULL) {
vmsd = dc->vmsd;
+ } else {
+ fprintf(stderr, "%s (%s)\n", object_class_get_name(oc),
vmsd->name);
}
for (field = 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?
>
>> Andreas Färber (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(-)
>>
>> --
>> 1.8.1.4
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2014-02-07 21:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-29 2:03 [Qemu-devel] [RFC for-next 0/2] QOM VMStateDescription remix Andreas Färber
2013-07-29 2:03 ` [Qemu-devel] [RFC for-next 1/2] qdev: Construct VMStateDescription from type hierarchy Andreas Färber
2013-07-29 2:03 ` [Qemu-devel] [RFC for-next 2/2] cpu: Move VMSTATE_CPU() into TYPE_CPU VMStateDescription Andreas Färber
2013-07-29 4:30 ` Jia Liu
2013-09-02 11:28 ` [Qemu-devel] [RFC for-next 0/2] QOM VMStateDescription remix Andreas Färber
2013-09-02 11:41 ` Michael S. Tsirkin
2014-02-07 21:28 ` Andreas Färber [this message]
2014-02-07 21:39 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52F55006.1030509@suse.de \
--to=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).