qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC for-next 0/2] QOM VMStateDescription remix
@ 2013-07-29  2:03 Andreas Färber
  2013-07-29  2:03 ` [Qemu-devel] [RFC for-next 1/2] qdev: Construct VMStateDescription from type hierarchy Andreas Färber
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Andreas Färber @ 2013-07-29  2:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Juan Quintela, Andreas Färber,
	Anthony Liguori, Michael S. Tsirkin

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>

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-02-07 21:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-02-07 21:39     ` Peter Maydell

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).