From nobody Mon Feb 9 07:57:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1582578917; cv=none; d=zohomail.com; s=zohoarc; b=U82pJeLB0KX1h1xbYTc7IXgT6FBhWvzZpH5Q0cR7ceCiv/HePJYpWS7lo78eMFFmQ6uR9XaM/BT6VBliyX/4SUjrO4bXVehSHPIb8QApdi6LBOTClW1Z/MlBwokObY7rpexBtRLxxoReGKlj1U18iNycbk4AqcjSlYEll+2kQ1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582578917; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=0bgtJYi5Q+wqi1vj3BeRoc/5jB6JYG14IQlZmOpXzdM=; b=SjlKj3EVZfe5eGgDDI5D+8boDgs35Ebeq1YNEwNTnCTbBlaXYhEFs+mAQGPQiuFZk+snvHiPRVQSPth/JyF1e/4ZVhzM+mkR72Kr6kcbQaJP4TQw9GwyZCxDQEDYNaBNtm5Fv26/apVv0l/8/7CwZAeZxTgma6PpgWhOIWPjLag= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582578917272287.46792135431997; Mon, 24 Feb 2020 13:15:17 -0800 (PST) Received: from localhost ([::1]:43532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6L4O-0005AD-0t for importer@patchew.org; Mon, 24 Feb 2020 16:15:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51003) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kmz-0008Pu-P1 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kmy-00047u-Iv for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:17 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:45340) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6Kmy-000478-9s for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:16 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01OKrgSd032171; Mon, 24 Feb 2020 20:57:10 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2yauqua0rq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Feb 2020 20:57:10 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01OKq5fO171086; Mon, 24 Feb 2020 20:57:10 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2ybdshksuk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Feb 2020 20:57:09 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01OKv8VW030212; Mon, 24 Feb 2020 20:57:08 GMT Received: from jaraman-bur-1.us.oracle.com (/10.152.33.39) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 24 Feb 2020 12:57:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=corp-2020-01-29; bh=0bgtJYi5Q+wqi1vj3BeRoc/5jB6JYG14IQlZmOpXzdM=; b=snUzxX27V0itBBRYmJGEsjo/W75fvVRQyfI1qtQ14w4b90fxai6sN61xLwz0xL+GlzEy F8mNZdFwXtsITViHsVzKKb+W2W9LALHdG2T0YQUwq5cHM/0szTv32hVZklCtl4ocOEfh mW6xR7+S3Yb7z6N3UjnFbG5F+q4QmG+fuTvdEmvyVdM57vP5Y4//eHqW8Qks8tv9EPUl Huro0jo6beW14yvyoO9MDXutRg6hK2ZRw3fKGHr5y3YRsXVyH3/EWqKrqeNC+0Gn5xxK H7Aam4K8QDyfnoTWl5PBb1Zq4omp2bYJURFFtlSJqxDviwVhQsx7arspjvYOHWHNycyf ng== From: Jagannathan Raman To: qemu-devel@nongnu.org Subject: [PATCH v5 46/50] multi-process/mig: Restore the VMSD in remote process Date: Mon, 24 Feb 2020 15:55:37 -0500 Message-Id: <68144e5a0cdc4a16c1fe63f4a7482191f86b7c0f.1582576372.git.jag.raman@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9541 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=1 spamscore=0 malwarescore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002240153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9541 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 bulkscore=0 clxscore=1015 malwarescore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002240153 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: elena.ufimtseva@oracle.com, fam@euphon.net, swapnil.ingle@nutanix.com, john.g.johnson@oracle.com, kraxel@redhat.com, jag.raman@oracle.com, quintela@redhat.com, mst@redhat.com, armbru@redhat.com, kanth.ghatraju@oracle.com, felipe@nutanix.com, thuth@redhat.com, ehabkost@redhat.com, konrad.wilk@oracle.com, dgilbert@redhat.com, liran.alon@oracle.com, stefanha@redhat.com, thanos.makatos@nutanix.com, rth@twiddle.net, kwolf@redhat.com, berrange@redhat.com, mreitz@redhat.com, ross.lagerwall@citrix.com, marcandre.lureau@gmail.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Elena Ufimtseva The remote process accepts the VMSD from Proxy object and restores it Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- migration/savevm.c | 36 ++++++++++++++++++++++++++++++++++++ migration/savevm.h | 1 + remote/remote-main.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index 09af14d..e95ea4a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2969,3 +2969,39 @@ int qemu_remote_savevm(QEMUFile *f) =20 return 0; } + +int qemu_remote_loadvm(QEMUFile *f) +{ + uint8_t section_type; + int ret =3D 0; + + qemu_mutex_lock_iothread(); + + while (true) { + section_type =3D qemu_get_byte(f); + + if (qemu_file_get_error(f)) { + ret =3D qemu_file_get_error(f); + break; + } + + switch (section_type) { + case QEMU_VM_SECTION_FULL: + ret =3D qemu_loadvm_section_start_full(f, NULL); + if (ret < 0) { + break; + } + break; + case QEMU_VM_EOF: + goto out; + default: + ret =3D -EINVAL; + goto out; + } + } + +out: + qemu_mutex_unlock_iothread(); + + return ret; +} diff --git a/migration/savevm.h b/migration/savevm.h index 0491d3a..8741c66 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -66,5 +66,6 @@ int qemu_loadvm_state_main(QEMUFile *f, MigrationIncoming= State *mis); int qemu_load_device_state(QEMUFile *f); =20 int qemu_remote_savevm(QEMUFile *f); +int qemu_remote_loadvm(QEMUFile *f); =20 #endif diff --git a/remote/remote-main.c b/remote/remote-main.c index 0260c7c..ab4ad0b 100644 --- a/remote/remote-main.c +++ b/remote/remote-main.c @@ -68,6 +68,7 @@ #include "chardev/char.h" #include "sysemu/reset.h" #include "vl.h" +#include "migration/misc.h" =20 static MPQemuLinkState *mpqemu_link; =20 @@ -363,6 +364,30 @@ static void process_start_mig_out(MPQemuMsg *msg) qemu_fclose(f); } =20 +static int process_start_mig_in(MPQemuMsg *msg) +{ + Error *err =3D NULL; + QIOChannel *ioc; + QEMUFile *f; + int rc =3D -EINVAL; + + ioc =3D qio_channel_new_fd(msg->fds[0], &err); + if (err) { + error_report_err(err); + return rc; + } + + qio_channel_set_name(QIO_CHANNEL(ioc), "remote-migration-channel"); + + f =3D qemu_fopen_channel_input(ioc); + + rc =3D qemu_remote_loadvm(f); + + qemu_fclose(f); + + return rc; +} + static void process_msg(GIOCondition cond, MPQemuChannel *chan) { MPQemuMsg *msg =3D NULL; @@ -455,6 +480,12 @@ static void process_msg(GIOCondition cond, MPQemuChann= el *chan) case START_MIG_OUT: process_start_mig_out(msg); break; + case START_MIG_IN: + if (process_start_mig_in(msg)) { + error_setg(&err, "Incoming migration failed."); + goto finalize_loop; + } + break; case RUNSTATE_SET: remote_runstate_set(msg->data1.runstate.state); notify_proxy(msg->fds[0], 0); @@ -532,6 +563,8 @@ int main(int argc, char *argv[]) } mpqemu_init_channel(mpqemu_link, &mpqemu_link->mmio, fd); =20 + migration_object_init(); + parse_cmdline(argc - 3, argv + 3, NULL); =20 mpqemu_link_set_callback(mpqemu_link, process_msg); --=20 1.8.3.1