From patchwork Thu Jan 26 09:16:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashijeet Acharya X-Patchwork-Id: 9538603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 225696046A for ; Thu, 26 Jan 2017 09:17:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 109C626E69 for ; Thu, 26 Jan 2017 09:17:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 033E628112; Thu, 26 Jan 2017 09:17:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A398326E69 for ; Thu, 26 Jan 2017 09:17:39 +0000 (UTC) Received: from localhost ([::1]:36938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWgBW-00036R-Bu for patchwork-qemu-devel@patchwork.kernel.org; Thu, 26 Jan 2017 04:17:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWgB6-00035J-GS for qemu-devel@nongnu.org; Thu, 26 Jan 2017 04:17:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWgB3-00020N-9Y for qemu-devel@nongnu.org; Thu, 26 Jan 2017 04:17:12 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:33132) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cWgB3-000201-1W for qemu-devel@nongnu.org; Thu, 26 Jan 2017 04:17:09 -0500 Received: by mail-pg0-x244.google.com with SMTP id 194so22010049pgd.0 for ; Thu, 26 Jan 2017 01:17:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=qaUmwubdYcveV9QNXsHeK8bIhAupsmuq+1kopyfjiEw=; b=DnSZ7uJbTpOTq60FKMiH7NMA1fgOLO+DCjgueJ8OAw+DKQCY2flRsJ4GOj+HbRJvGa wbSh+PInsCguh+H1AzYiZcUqaTFKafs2OYE7YJaDGjMc3Zoh0Y4vXJwIMfkcnaPuUSAV zglY/CTIl7dGRLzFqudYw4KjWA7bOJbU0Fahieu1NRyh2Hd1ekH2ocy1NRIP6pOmetT1 OYMheTTCMyQHqXKLZVcL3WDeeVr8ohWsF/6M485Q9d0wpqgguNgQ+0bOfnN98pcLB4eS YcMltaC2DSVbXVND/oeXtzKW2LAYaceMaYfGynFNfyld4gIYg7wmC6aeXYeHcAzVjtFp 1Isw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qaUmwubdYcveV9QNXsHeK8bIhAupsmuq+1kopyfjiEw=; b=E9lRR8JXioL13FcY6nq4O7B8/1PqzwJAzUq/LQIhaPfaCXQyFMS1piDAL0omWy+PzB V01TIxKE/ku2AHD535vQN23USDg1NBnkUQL6wt+e0WMI03Jwm9T+U//WthZDodUz3VFw 681KCST4A050wDwi26RV3+9QoF8cYzx0PD3GwnY2pChkDMsheJJ6F5s584tx/u9K7KVm ZmC3RoHx76KOPgE67/iT75ZyHgxUdRrCKOTC23VtITZCZafIBDzm2+oGxccJOsPp3KN6 iuQp9mOxVKfPTUMqhOw6ysGyekFjCGRnD0quh20zwYie/lmtzuwc6ydJYInWy4CCb29S n1Nw== X-Gm-Message-State: AIkVDXLOyD6EnoB7eYs5HITGsEgr11KWCDQUmno9x0CM0w9jrivNzyTvYfKAcJm9SYCWfQ== X-Received: by 10.84.232.204 with SMTP id x12mr2674713plm.125.1485422228150; Thu, 26 Jan 2017 01:17:08 -0800 (PST) Received: from linux.local ([27.251.197.196]) by smtp.gmail.com with ESMTPSA id o18sm2206299pgn.36.2017.01.26.01.17.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Jan 2017 01:17:07 -0800 (PST) From: Ashijeet Acharya To: thuth@redhat.com Date: Thu, 26 Jan 2017 14:46:52 +0530 Message-Id: <1485422212-31546-1-git-send-email-ashijeetacharya@gmail.com> X-Mailer: git-send-email 2.6.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH] migrate: Migration aborts abruptly for machine "none" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, dgilbert@redhat.com, Ashijeet Acharya , quintela@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Migration of a "none" machine with no RAM crashes abruptly as bitmap_new() fails and thus aborts. Instead, place a check for last_ram_offset() being '0' at the start of ram_save_setup() and error out with a meaningful error message. Signed-off-by: Ashijeet Acharya Reviewed-by: Dr. David Alan Gilbert --- migration/ram.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index ef8fadf..bf05d69 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1947,6 +1947,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque) { RAMBlock *block; + if (last_ram_offset() == 0) { + error_report("Failed to migrate: No RAM available!"); + return -1; + } + /* migration has already setup the bitmap, reuse it. */ if (!migration_in_colo_state()) { if (ram_save_init_globals() < 0) {