From nobody Sat May 18 18:27:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500784413697196.53563495414312; Sat, 22 Jul 2017 21:33:33 -0700 (PDT) Received: from localhost ([::1]:49217 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ8aB-0004tb-Ko for importer@patchew.org; Sun, 23 Jul 2017 00:33:31 -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 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 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 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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, MemoryHotplu= gState *hpms, goto out; } =20 - 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 *in= fo); void qemu_add_exit_notifier(Notifier *notify); void qemu_remove_exit_notifier(Notifier *notify); =20 +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); =20 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) =20 static bool machine_init_done; =20 +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); --=20 1.8.3.1