From patchwork Sun Jul 23 12:46:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 9858277 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 ED810600F5 for ; Sun, 23 Jul 2017 04:33:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6B97284AA for ; Sun, 23 Jul 2017 04:33:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9C15284BD; Sun, 23 Jul 2017 04:33:20 +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=-5.0 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_HI 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 823A0284AA for ; Sun, 23 Jul 2017 04:33:17 +0000 (UTC) Received: from localhost ([::1]:49216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ8Zx-0004bf-2q for patchwork-qemu-devel@patchwork.kernel.org; Sun, 23 Jul 2017 00:33:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ8ZR-0004ba-0c for qemu-devel@nongnu.org; Sun, 23 Jul 2017 00:32:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZ8ZM-0002hs-Uf for qemu-devel@nongnu.org; Sun, 23 Jul 2017 00:32:44 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:34307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ8ZM-0002fU-B5 for qemu-devel@nongnu.org; Sun, 23 Jul 2017 00:32:40 -0400 X-scanvirus: By SEG_CYREN AntiVirus Engine X-scanresult: CLEAN X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170723122159 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 23 Jul 2017 04:21:59 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v6N4WTBv016310; Sun, 23 Jul 2017 12:32:29 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017072312323750-4570567 ; Sun, 23 Jul 2017 12:32:37 +0800 From: Peng Hao To: mst@redhat.com, imammedo@redhat.com Date: Sun, 23 Jul 2017 20:46:11 +0800 Message-Id: <1500813971-82408-1-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-23 12:32:37, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-23 12:32:29, Serialize complete at 2017-07-23 12:32:29 X-MAIL: mse01.zte.com.cn v6N4WTBv016310 X-HQIP: 127.0.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 63.217.80.70 Subject: [Qemu-devel] [PATCH V2] vhost: fix a migration failed because of vhost region merge 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: Peng Hao , Wang Yechao , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When a guest that has several hotplugged dimms is migrated, on destination it will fail to resume. Because regions on source are merged and on destination the order of realizing devices is different from on source with dimms, so when part of devices are realizd some region can not be merged.That may be more than vhost slot limit. Signed-off-by: Peng Hao Signed-off-by: Wang Yechao --- hw/mem/pc-dimm.c | 2 +- include/sysemu/sysemu.h | 1 + vl.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index ea67b46..13f3db5 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -101,7 +101,7 @@ void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms, goto out; } - if (!vhost_has_free_slot()) { + if (!vhost_has_free_slot() && qemu_is_machine_init_done()) { error_setg(&local_err, "a used vhost backend has no free" " memory slots left"); goto out; diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index b213696..48228ad 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -88,6 +88,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info); void qemu_add_exit_notifier(Notifier *notify); void qemu_remove_exit_notifier(Notifier *notify); +bool qemu_is_machine_init_done(void); void qemu_add_machine_init_done_notifier(Notifier *notify); void qemu_remove_machine_init_done_notifier(Notifier *notify); diff --git a/vl.c b/vl.c index fb6b2ef..43aee22 100644 --- a/vl.c +++ b/vl.c @@ -2681,6 +2681,11 @@ static void qemu_run_exit_notifiers(void) static bool machine_init_done; +bool qemu_is_machine_init_done(void) +{ + return machine_init_done; +} + void qemu_add_machine_init_done_notifier(Notifier *notify) { notifier_list_add(&machine_init_done_notifiers, notify);