From nobody Tue Nov 18 10:36:04 2025 Delivered-To: importer@patchew.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=1609863479; cv=none; d=zohomail.com; s=zohoarc; b=Pa7zhEJNGE6+fMbKOflYsz2e/OFfzvEQiB80/enpQevg2bf29F0I3CWIJ/pBgST6te6eFgH9v//or9tB3r8eruH/itGhw61gDoqopRBo23T5Bn2ZYztXYPoES+fuE60l73SH5xaESl6Eapmtw2jnmew2R6IYLlTzhQsZI9EAxXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609863479; 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=7i4w3KiW8uVoEnJ0gDLqxwKqNbmMawd7mp9fpN9woeI=; b=XYtjZcuQK7gYUTBMUK9fy6cYZxMktkoA6sCpshkGl4XWyW4AyIszt1fASdWIRTtfQZDib6l9rY3kkYbx1tW437ogZREQ5M3S+wlvZZxmHyw8EJBMyVO1MzEnLcsItOs1sjFinLP+QWq9vhvn43U3RYWIi7hi0hSmLXg06WeoyQ4= 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 160986347923559.731638476677404; Tue, 5 Jan 2021 08:17:59 -0800 (PST) Received: from localhost ([::1]:35786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwp1y-0000Tq-3Y for importer@patchew.org; Tue, 05 Jan 2021 11:17:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwotb-0003ya-2E for qemu-devel@nongnu.org; Tue, 05 Jan 2021 11:09:19 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:34454) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwotV-0003rn-5r for qemu-devel@nongnu.org; Tue, 05 Jan 2021 11:09:18 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 105Ft4EL094589; Tue, 5 Jan 2021 16:09:10 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 35tebasjve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 05 Jan 2021 16:09:09 +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 105FtKvd175795; Tue, 5 Jan 2021 16:09:09 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 35vct61vq6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Jan 2021 16:09:09 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 105G97E0020434; Tue, 5 Jan 2021 16:09:07 GMT Received: from ca-dev63.us.oracle.com (/10.211.8.221) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Jan 2021 08:09: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; s=corp-2020-01-29; bh=7i4w3KiW8uVoEnJ0gDLqxwKqNbmMawd7mp9fpN9woeI=; b=vpjL8+tNQFGJN/9NfcotAQ+V9VQrJCIAA7mqO20Of1aBLnnMSbzsvhf3Jdja9XZyk4jI MEIqbD0Ni/6w9y6pqHaEsQnYtHP6RTXIliGrUlURhdYcSZwD7Hbtca7VKb+GrWUEsZ7g flI7x6LUlYlfZUCqlfFSmB7qpJfCLKDGDh6vJ9xnQJoPQO/HD5lH4zncpuukiPkcAE3r IsaL9/kcrk5POk277/k26OcTXRmSKTZXp+m2Krc+spF3de8tS4sM5VW3vCsX2ojsZv0F ikS1bD6jeqMkn97OwPdyA4OYiIovDh7cMouvNNuzyWQXVj5Lr2ZyDG7oZETVpoeOhiVM Fg== From: Steve Sistare To: qemu-devel@nongnu.org Subject: [PATCH V2 09/22] cpr: HMP interfaces Date: Tue, 5 Jan 2021 07:41:57 -0800 Message-Id: <1609861330-129855-10-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1609861330-129855-1-git-send-email-steven.sistare@oracle.com> References: <1609861330-129855-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9855 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050099 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9855 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 priorityscore=1501 spamscore=0 mlxscore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050099 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; Received-SPF: pass client-ip=141.146.126.79; envelope-from=steven.sistare@oracle.com; helo=aserp2130.oracle.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.252, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: "Daniel P. Berrange" , "Michael S. Tsirkin" , Jason Zeng , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Juan Quintela , "Dr. David Alan Gilbert" , Markus Armbruster , Alex Williamson , Steve Sistare , Stefan Hajnoczi , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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" cprsave Call cprsave(). Arguments: file : save vmstate to this file name mode: "reboot" or "restart" cprload Call cprload(). Arguments: file : load vmstate from this file name cprinfo Print to stdout a space-delimited list of modes supported by cprsave. Arguments: none Signed-off-by: Mark Kanda Signed-off-by: Steve Sistare --- hmp-commands.hx | 44 ++++++++++++++++++++++++++++++++++++++++++++ include/monitor/hmp.h | 3 +++ monitor/hmp-cmds.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index 60f395c..8577850 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -354,6 +354,50 @@ SRST ERST =20 { + .name =3D "cprinfo", + .args_type =3D "", + .params =3D "", + .help =3D "return list of modes supported by cprsave", + .cmd =3D hmp_cprinfo, + }, + +SRST +``cprinfo`` + Return a space-delimited list of modes supported by cprsave. +ERST + + { + .name =3D "cprsave", + .args_type =3D "file:s,mode:s", + .params =3D "file 'restart'|'reboot'", + .help =3D "create a checkpoint of the VM in file", + .cmd =3D hmp_cprsave, + }, + +SRST +``cprsave`` *file* *mode* + Create a checkpoint of the whole virtual machine and save it in *file*. + If *mode* is 'reboot', the checkpoint remains valid after a host kexec + reboot. Guest ram must be backed by persistant shared memory. + If *mode* is 'restart', pause the VCPUs, exec /usr/bin/qemu-exec if it + exists, else exec argv[0], passing all the original command line argum= ents. + Guest ram must be allocated with the memfd-anon option. +ERST + + { + .name =3D "cprload", + .args_type =3D "file:s", + .params =3D "file", + .help =3D "load VM checkpoint from file", + .cmd =3D hmp_cprload, + }, + +SRST +``cprload`` *file* +Load a virtual machine from checkpoint file *file* and continue VCPUs. +ERST + + { .name =3D "delvm", .args_type =3D "name:s", .params =3D "tag", diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index c986cfd..919b9a9 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -59,6 +59,9 @@ void hmp_balloon(Monitor *mon, const QDict *qdict); void hmp_loadvm(Monitor *mon, const QDict *qdict); void hmp_savevm(Monitor *mon, const QDict *qdict); void hmp_delvm(Monitor *mon, const QDict *qdict); +void hmp_cprinfo(Monitor *mon, const QDict *qdict); +void hmp_cprsave(Monitor *mon, const QDict *qdict); +void hmp_cprload(Monitor *mon, const QDict *qdict); void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); void hmp_migrate_continue(Monitor *mon, const QDict *qdict); void hmp_migrate_incoming(Monitor *mon, const QDict *qdict); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index ae4b6a4..e64b754 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -32,6 +32,7 @@ #include "qapi/qapi-commands-block.h" #include "qapi/qapi-commands-char.h" #include "qapi/qapi-commands-control.h" +#include "qapi/qapi-commands-cpr.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-net.h" @@ -1139,6 +1140,53 @@ void hmp_announce_self(Monitor *mon, const QDict *qd= ict) qapi_free_AnnounceParameters(params); } =20 +void hmp_cprinfo(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + CprInfo *cprinfo; + CprModeList *mode; + + cprinfo =3D qmp_cprinfo(&err); + if (err) { + goto out; + } + + for (mode =3D cprinfo->modes; mode; mode =3D mode->next) { + monitor_printf(mon, "%s ", CprMode_str(mode->value)); + } + +out: + hmp_handle_error(mon, err); + qapi_free_CprInfo(cprinfo); +} + +void hmp_cprsave(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + const char *mode; + int val; + + mode =3D qdict_get_try_str(qdict, "mode"); + val =3D qapi_enum_parse(&CprMode_lookup, mode, -1, &err); + + if (val =3D=3D -1) { + goto out; + } + + qmp_cprsave(qdict_get_try_str(qdict, "file"), val, &err); + +out: + hmp_handle_error(mon, err); +} + +void hmp_cprload(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + + qmp_cprload(qdict_get_try_str(qdict, "file"), &err); + hmp_handle_error(mon, err); +} + void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) { qmp_migrate_cancel(NULL); --=20 1.8.3.1