From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0umT-000844-5d for qemu-devel@nongnu.org; Tue, 16 Dec 2014 11:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0umN-0001tQ-1d for qemu-devel@nongnu.org; Tue, 16 Dec 2014 11:15:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0umM-0001tK-Qj for qemu-devel@nongnu.org; Tue, 16 Dec 2014 11:15:18 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBGGFI1J005402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 16 Dec 2014 11:15:18 -0500 Date: Tue, 16 Dec 2014 18:15:15 +0200 From: "Michael S. Tsirkin" Message-ID: <1418746479-21634-7-git-send-email-mst@redhat.com> References: <1418746479-21634-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1418746479-21634-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PATCH v2 6/8] arch_init: support resizing on incoming migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Amit Shah , pbonzini@redhat.com, imammedo@redhat.com, dgilbert@redhat.com, Juan Quintela If block used_length does not match, try to resize it. Signed-off-by: Michael S. Tsirkin --- arch_init.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch_init.c b/arch_init.c index 106f46e..cfedbf0 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1086,11 +1086,14 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) QTAILQ_FOREACH(block, &ram_list.blocks, next) { if (!strncmp(id, block->idstr, sizeof(id))) { - if (block->used_length != length) { - error_report("Length mismatch: %s: 0x" RAM_ADDR_FMT - " in != 0x" RAM_ADDR_FMT, id, length, - block->used_length); - ret = -EINVAL; + if (length != block->used_length) { + Error *local_err = NULL; + + ret = qemu_ram_resize(block->offset, length, &local_err); + if (local_err) { + error_report("%s", error_get_pretty(local_err)); + error_free(local_err); + } } break; } -- MST