Re: [PATCH 03/26] Remove SaveVM v2 support

Message ID alpine.DEB.2.00.0909171209570.7938@kaball-desktop
State Superseded
Headers show

Commit Message

Stefano Stabellini Sept. 17, 2009, 11:40 a.m.
On Fri, 11 Sep 2009, Juan Quintela wrote:
> About this, nobody is wanting to remove useful features.  I was removing
> things that didn't work.  The best plan of action if you want v2 support
> on tree is to fix it.  Do what I did:
> This commit introduces SaveVM v3
> commit 9366f4186025e1d8fc3bebd41fb714521c170b6f
> Author: aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
> Date:   Mon Oct 6 14:53:52 2008 +0000
>     Introduce v3 of savevm protocol
> I checkout previous commit, savevm one machine. Go to the present and
> try to load it -> RAM don't work.
> Search what commit broke it:
> commit 94a6b54fd6d2d3321066cb4db7abeeb417af9365
> Author: pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
> Date:   Sat Apr 11 17:15:54 2009 +0000
>     Implement dynamic guest ram allocation.
> Went to the previous one, to see if this was the only broken thing.
> And found that ide and vga was broken at that point.
> I stopped searching there.
> You get that image to load, and I try not to break it with VMState
> changes.  Can you (or anybody else) got v2 to life?  If it is working,
> and you can use it, I don't want to break its support.  But if it has
> been broken for ages and nobody steps it to fix it -> removing is only
> useful thing that I can think of doing.

I didn't have much time to work on this but I thought it would be a
good idea to give an update on the situation.

The two patches I am attaching to this email fix the ide v1 state loading
problem and the v2 ram loading problem (you have to make sure that the
ram size given from the command line is the same of the saved image).
They apply to CS 799f1f2325a1136a84d6f0ea94d891ef33656af2 that is right
before "ram: remove support for loading v1" and "ram: Remove SaveVM
Version 2 support".

I was able to save and restore qemu guests in graphical mode with no issues.
There is still a font corruption problem that may be the vga issue you
were reporting. The vga state is saved and loaded correctly but the
fonts come up all zeroed after resume and I am still not sure why, it
might be a videram saving problem.

Reverting "Remove SaveVM v2 support" and "ram: Remove SaveVM Version 2
support" and applying these patches on the latest CS doesn't give the
results you would expect: qemu segfaults resuming the cirrus vga state
that may be a symptom of a problem introduced by the vmstate changes in
cirrus vga.

I'll be away for a week or two but I think IanJ will keep working on this.



diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 607472b..a5c112a 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -307,8 +307,6 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
     PCIIDEState *d = opaque;
     int ret, i;
-    if (version_id != 2 && version_id != 3)
-        return -EINVAL;
     ret = pci_device_load(&d->dev, f);
     if (ret < 0)
         return ret;
@@ -319,10 +317,12 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
         qemu_get_8s(f, &bm->cmd);
         qemu_get_8s(f, &bm->status);
         qemu_get_be32s(f, &bm->addr);
-        qemu_get_sbe64s(f, &bm->sector_num);
-        qemu_get_be32s(f, &bm->nsector);
-        qemu_get_8s(f, &ifidx);
-        bm->unit = ifidx & 1;
+        if (version_id > 1) {
+            qemu_get_sbe64s(f, &bm->sector_num);
+            qemu_get_be32s(f, &bm->nsector);
+            qemu_get_8s(f, &ifidx);
+            bm->unit = ifidx & 1;
+        }
         /* XXX: if a transfer is pending, we do not save it yet */


diff --git a/vl.c b/vl.c
index 0446769..3188672 100644
--- a/vl.c
+++ b/vl.c
@@ -3038,7 +3038,7 @@  static int ram_load_dead(QEMUFile *f, void *opaque)
     if (ram_decompress_open(s, f) < 0)
         return -EINVAL;
-    for(i = 0; i < last_ram_offset; i+= BDRV_HASH_BLOCK_SIZE) {
+    for(i = 0; i < ram_size; i+= BDRV_HASH_BLOCK_SIZE) {
         if (ram_decompress_buf(s, buf, 1) < 0) {
             fprintf(stderr, "Error while reading ram block header\n");
             goto error;
@@ -3069,7 +3069,7 @@  static int ram_load(QEMUFile *f, void *opaque, int version_id)
         return ram_load_v1(f, opaque);
     if (version_id == 2) {
-        if (qemu_get_be32(f) != last_ram_offset)
+        if (qemu_get_be32(f) != ram_size)
             return -EINVAL;
         return ram_load_dead(f, opaque);