From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49347 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM61s-0004OE-Sy for qemu-devel@nongnu.org; Tue, 08 Jun 2010 17:12:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OM5rf-0001Wg-NV for qemu-devel@nongnu.org; Tue, 08 Jun 2010 16:57:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40749) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM5rf-0000re-5U for qemu-devel@nongnu.org; Tue, 08 Jun 2010 16:57:39 -0400 Date: Tue, 8 Jun 2010 13:54:47 -0700 From: Chris Wright Message-ID: <20100608205447.GP28492@x200.localdomain> References: <20100608191447.4451.47795.stgit@localhost.localdomain> <20100608191633.4451.59848.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100608191633.4451.59848.stgit@localhost.localdomain> Subject: [Qemu-devel] Re: [RFC PATCH 5/6] savevm: Migrate RAM based on name/offset List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: chrisw@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org * Alex Williamson (alex.williamson@redhat.com) wrote: > @@ -257,7 +272,7 @@ int ram_load(QEMUFile *f, void *opaque, int version_id) > ram_addr_t addr; > int flags; > > - if (version_id != 3) { > + if (version_id < 3) { > return -EINVAL; Should we clamp to 3 and 4? > } > > @@ -268,23 +283,89 @@ int ram_load(QEMUFile *f, void *opaque, int version_id) > addr &= TARGET_PAGE_MASK; > > if (flags & RAM_SAVE_FLAG_MEM_SIZE) { Does it simplify anything to simply add a new flag? > - if (addr != ram_bytes_total()) { > - return -EINVAL; > + if (version_id == 3) { > + if (addr != ram_bytes_total()) { > + return -EINVAL; > + } > + } else { > + /* Synchronize RAM block list */ > + char name[64]; > + ram_addr_t length; > + ram_addr_t total_ram_bytes = addr; > + > + while (total_ram_bytes) { > + RAMBlock *block; > + qemu_get_buffer(f, (uint8_t *)name, sizeof(name)); > + length = qemu_get_be64(f); > + > + QLIST_FOREACH(block, &ram.blocks, next) { > + if (!strncmp(name, block->name, sizeof(name))) { > + if (block->length != length) > + return -EINVAL; > + break; > + } > + } > + > + if (!block) { > + if (!qemu_ram_alloc(name, length)) > + return -ENOMEM; Is there any usee to finding blocks in stream such that we simply allocate them all dynamically? thanks, -chris