From patchwork Fri Sep 21 11:17:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 185710 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2E7362C007A for ; Fri, 21 Sep 2012 21:48:12 +1000 (EST) Received: from localhost ([::1]:51237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1Gc-0002sf-5x for incoming@patchwork.ozlabs.org; Fri, 21 Sep 2012 07:19:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1FE-0000QM-1U for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:18:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TF1F1-0003ud-Oh for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:18:03 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:58755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1F1-0003rI-HR for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:17:51 -0400 Received: by mail-bk0-f45.google.com with SMTP id jg9so1317042bkc.4 for ; Fri, 21 Sep 2012 04:17:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=EtMnylZoybJ4GbdrSW1SZWBL/lWWx2xhXqKSQKToJxo=; b=fsmrQ5RC0LoHr2t+0lGpdTnw0FW+W3X0VDTai0R9RaZNnLSONjt1Q8NccO67Mp4t8C fqMd88vA1E4Soex4KmZKYnXjbqXrxqABqXlvGlmzTpxoSga7zdLkB71h8hEcsyd0/jMe Wy2xTC4x9UbVtxm6YcsdD7O4wOk2XM9J1mvgg1tYWSmi5E7EswF0e6vZLexi1ZCdN1ml YZKeSUKjac4R1GFEHKKLfw192YoJYe37ur2z9K0wic/Kj/GSfbd95dn8miTLJGCg/eMF 8BJzQd9hfgFGrPH+j7f+wtKK/1PahlKSqU8ktjwb8X9JdC+BH+nnZqPnPNIvv4XAKJXk frgw== Received: by 10.204.4.200 with SMTP id 8mr170253bks.81.1348226271035; Fri, 21 Sep 2012 04:17:51 -0700 (PDT) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id x13sm5271435bkv.16.2012.09.21.04.17.49 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Sep 2012 04:17:50 -0700 (PDT) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Date: Fri, 21 Sep 2012 13:17:26 +0200 Message-Id: <1348226255-4226-11-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQm4TjVQ8bTOeZqmcbYUOJ5Pqm1dZ4t632ji200VvMFM6GZB8DVm7FXCkow+506DXt6PWtlm X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.45 Cc: Vasilis Liaskovitis , gleb@redhat.com, blauwirbel@gmail.com, kevin@koconnor.net, avi@redhat.com, anthony@codemonkey.ws, imammedo@redhat.com, eblake@redhat.com, kraxel@redhat.com Subject: [Qemu-devel] [RFC PATCH v3 10/19] fix live-migration when "populated=on" is missing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Live migration works after memory hot-add events, as long as the qemu command line "-dimm" arguments are changed on the destination host to specify "populated=on" for the dimms that have been hot-added. If a command-line change has not occured, the destination host does not yet have the corresponding ramblock in its ram_list. Activate the dimm on the destination during ram_load. Perhaps several fields of the DimmDevice should be part of a VMStateDescription to handle migration in a cleaner way. But the problem is that ramblocks are checked before qdev vmstates. Signed-off-by: Vasilis Liaskovitis --- arch_init.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/arch_init.c b/arch_init.c index 5a1173e..b63caa7 100644 --- a/arch_init.c +++ b/arch_init.c @@ -45,6 +45,7 @@ #include "hw/pcspk.h" #include "qemu/page_cache.h" #include "qmp-commands.h" +#include "hw/dimm.h" #ifdef DEBUG_ARCH_INIT #define DPRINTF(fmt, ...) \ @@ -740,10 +741,27 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) } if (!block) { - fprintf(stderr, "Unknown ramblock \"%s\", cannot " + /* this can happen if a dimm was hot-added at source host */ + bool ramblock_found = false; + if (dimm_add(id)) { + fprintf(stderr, "Cannot add unknown ramblock \"%s\", " + "cannot accept migration\n", id); + ret = -EINVAL; + goto done; + } + /* rescan ram_list, verify ramblock is there now */ + QLIST_FOREACH(block, &ram_list.blocks, next) { + if (!strncmp(id, block->idstr, sizeof(id))) { + ramblock_found = true; + break; + } + } + if (!ramblock_found) { + fprintf(stderr, "Unknown ramblock \"%s\", cannot " "accept migration\n", id); - ret = -EINVAL; - goto done; + ret = -EINVAL; + goto done; + } } total_ram_bytes -= length;