All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] The State of the SaveVM format
Date: Wed, 09 Sep 2009 17:22:11 +0200	[thread overview]
Message-ID: <4AA7C823.8080909@redhat.com> (raw)
In-Reply-To: <4AA7BEA7.6080906@codemonkey.ws>

   Hi,

> Today, you make no attempt to support older versions even if their
> format is quite sane. Take ps2_kbd as an example.
>
> The new format (v3) is:
>
> VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2State),
> VMSTATE_INT32(scan_enabled, PS2KbdState),
> VMSTATE_INT32(translate, PS2KbdState),
> VMSTATE_INT32_V(scancode_set, PS2KbdState,3),
>
> This is nice and should support v2 and v3.

It doesn't ...

> if (version_id == 3)
> s->scancode_set=qemu_get_be32(f);
> else
> s->scancode_set=2;

... setting scancode_set when loading v2 is missing.

I think vmstate fields need a default value to handle cases like this 
one without having to keep the old load function.

> Which has to be an error. But this is the real problem with leaving the
> old functions. It encourages sloppiness.

I think we can kill most of the old load functions.  I'd keep the old 
ones only in case emulating the old load function with vmstate would 
make it unreasonable complex.

> static void marshal_pci_irq_levels(void *opaque, const char *name,
> size_t offset, int load, int version)
> {
> if (version == 2) {
> for (i = 0; i < 4; i++)
> d->irq_state->piix3->pci_irq_levels[i] = qemu_get_be32(f);
> }
> }

> VMSTATE_FUNC_V(irq_state->piix3->pci_irq_levels, PCII440FXState,
> marshal_pci_irq_levels, 2)

No.  I don't want any free-form C code in vmstate.  That will kill quite 
a few of the vmstate advantages.  Imagine a tool dumping snapshot data. 
  What this tool should do when it finds such a FUNC field?  It has 
absolutely no idea what is in there ...

cheers,
   Gerd

  parent reply	other threads:[~2009-09-09 15:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-09  8:47 [Qemu-devel] The State of the SaveVM format Juan Quintela
2009-09-09  8:54 ` [Qemu-devel] " Michael S. Tsirkin
2009-09-09  9:22   ` Juan Quintela
2009-09-09  9:33     ` Michael S. Tsirkin
2009-09-09  9:01 ` Michael S. Tsirkin
2009-09-09  9:26   ` Juan Quintela
2009-09-09 12:00     ` Michael S. Tsirkin
2009-09-09 14:33 ` [Qemu-devel] " Gerd Hoffmann
2009-09-09 14:41 ` Anthony Liguori
2009-09-09 14:49   ` [Qemu-devel] " Juan Quintela
2009-09-09 14:57     ` Anthony Liguori
2009-09-09 15:22   ` Gerd Hoffmann [this message]
2009-09-09 15:46     ` [Qemu-devel] " Anthony Liguori
2009-09-09 15:47     ` Anthony Liguori
2009-09-10  1:10     ` Markus Armbruster
2009-09-10  1:26   ` Markus Armbruster
2009-09-10  2:02     ` Anthony Liguori
2009-09-10 12:08       ` Michael S. Tsirkin
2009-09-10 12:55         ` [Qemu-devel] " Juan Quintela
2009-09-10 13:07           ` Michael S. Tsirkin
2009-09-10 13:26             ` Juan Quintela

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=4AA7C823.8080909@redhat.com \
    --to=kraxel@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=mst@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.