From patchwork Thu Sep 17 11:40:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 33770 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 79AE0B7B6D for ; Thu, 17 Sep 2009 21:37:58 +1000 (EST) Received: from localhost ([127.0.0.1]:37148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MoFJD-00054a-AO for incoming@patchwork.ozlabs.org; Thu, 17 Sep 2009 07:37:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MoFIj-00054V-1D for qemu-devel@nongnu.org; Thu, 17 Sep 2009 07:37:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MoFIe-000525-BU for qemu-devel@nongnu.org; Thu, 17 Sep 2009 07:37:24 -0400 Received: from [199.232.76.173] (port=34814 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MoFIe-000522-8q for qemu-devel@nongnu.org; Thu, 17 Sep 2009 07:37:20 -0400 Received: from smtp.eu.citrix.com ([62.200.22.115]:46659) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MoFId-0005yI-Gg for qemu-devel@nongnu.org; Thu, 17 Sep 2009 07:37:19 -0400 X-IronPort-AV: E=Sophos;i="4.44,403,1249257600"; d="scan'208";a="7126675" Received: from lonpmailmx01.citrite.net ([10.30.224.162]) by LONPIPO01.EU.CITRIX.COM with ESMTP; 17 Sep 2009 11:36:54 +0000 Received: from kaball.uk.xensource.com (10.80.2.59) by smtprelay.citrix.com (10.30.224.162) with Microsoft SMTP Server id 8.1.393.1; Thu, 17 Sep 2009 12:36:54 +0100 Date: Thu, 17 Sep 2009 12:40:50 +0100 From: Stefano Stabellini X-X-Sender: sstabellini@kaball-desktop To: Juan Quintela In-Reply-To: Message-ID: References: <9e1839178f7a85d264eee20a07d4aed6e6ddb7b1.1252543871.git.quintela@redhat.com> <4AA94403.5020500@codemonkey.ws> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Ian Jackson , "qemu-devel@nongnu.org" , Stefano Stabellini Subject: [Qemu-devel] Re: [PATCH 03/26] Remove SaveVM v2 support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 > 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 > 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. Cheers, Stefano 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); }