From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33DB3C07E96 for ; Thu, 8 Jul 2021 13:28:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AB28F601FF for ; Thu, 8 Jul 2021 13:28:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB28F601FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1U58-0002In-OJ for qemu-devel@archiver.kernel.org; Thu, 08 Jul 2021 09:28:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1U3n-0000Cr-8W for qemu-devel@nongnu.org; Thu, 08 Jul 2021 09:27:23 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]:38508) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m1U3k-0004f6-Pl for qemu-devel@nongnu.org; Thu, 08 Jul 2021 09:27:23 -0400 Received: by mail-ej1-x62e.google.com with SMTP id gb6so9615388ejc.5 for ; Thu, 08 Jul 2021 06:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B4Rsgs+2Fc4YrAZLenPi78VR2dNix/ag15tqYtYQblk=; b=oPwKvV1AnPXcKJqrJED6izt1tl2sE3HziqWI8tCKpLnde4Bmdj1Uh4lT6vLo6zBV5A CHF00pizbzprZRVQy76qdFkC5EzuIe8iwCgSN1kW+f/kNYDZ+SdOKHvwhDHlPoS9akwz S1dgxwj/0kferxEBExzkfCHw6GBupo6aL/Y/e8b0v6JGLBNtqJMDcnvUUnktnTNB1k7O 8w/AOGv2VAC6fecTQz7O4OnvyWt8TQEXmZgFJFvOkh2P3WYSF72f+oTZfv/2qQ54Eayz wsmBCPuDirUdODbRvk1NyEzAgey0LbX3XXo7xl1yk3stq+jlE5xYDkAXC8eGiqpI2WSz VBFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B4Rsgs+2Fc4YrAZLenPi78VR2dNix/ag15tqYtYQblk=; b=IS022ViCQcYb5kkqLZ2unDqAvn4xjhOLLWdgy/Q/e84PLTy1/ZVtLT73biZj/+S8L+ y/XGMVpuKcuseeWSEJNewClzt6VhYYe5vDGrVR7vqpyyyeWLo11U1jWzp5XA7c3eTcJJ DyLKKywejCbeA6KlJqysrm+m8X/x2DcuHPhpFTKrPvh9R1eMUhXeZGGCyY7E4YNB4flJ GRhCog0+5ngtT/cWypCxYVy0Yp9n1nu+0hsTEepdCUT8y9EliAnO3Xs7pneFkmIrVur9 YKzyO8f7Ygy4XokXbr0Gv12DiTQZkTIQn+IvoG0s5IscBCQQx8sfiOJJMKkhAKd6FdqF c9kA== X-Gm-Message-State: AOAM530C9shVg5QKbBr2nbDwpCxJC8a3Js/aoNdsmbqiRVsCD6MVYJ5H RG8BxWRUXal8xTjNF7YytUrx960X9qHdua+zcT8= X-Google-Smtp-Source: ABdhPJxbx0ywGqetGg0x0qGl1lkhhenoD8Av5zocclQgKIeqTJTRvD1NLXn1G51+LLR0c2tx+/d+0tK+KA9XbDjuc+A= X-Received: by 2002:a17:906:4fd6:: with SMTP id i22mr17540831ejw.92.1625750839376; Thu, 08 Jul 2021 06:27:19 -0700 (PDT) MIME-Version: 1.0 References: <1625678434-240960-1-git-send-email-steven.sistare@oracle.com> <1625678434-240960-4-git-send-email-steven.sistare@oracle.com> In-Reply-To: <1625678434-240960-4-git-send-email-steven.sistare@oracle.com> From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Thu, 8 Jul 2021 17:27:07 +0400 Message-ID: Subject: Re: [PATCH V5 03/25] cpr: QMP interfaces for reboot To: Steve Sistare Content-Type: multipart/alternative; boundary="0000000000004652f605c69c9de2" Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=marcandre.lureau@gmail.com; helo=mail-ej1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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: Jason Zeng , Juan Quintela , Eric Blake , "Michael S. Tsirkin" , QEMU , "Dr. David Alan Gilbert" , Alex Williamson , Stefan Hajnoczi , Paolo Bonzini , "Daniel P. Berrange" , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= , =?UTF-8?B?QWxleCBCZW5uw6ll?= , Markus Armbruster Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --0000000000004652f605c69c9de2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Wed, Jul 7, 2021 at 9:28 PM Steve Sistare wrote: > cprsave calls cprsave(). Syntax: > { 'enum': 'CprMode', 'data': [ 'reboot' ] } > { 'command': 'cprsave', 'data': { 'file': 'str', 'mode': 'CprMode' } } > > cprload calls cprload(). Syntax: > { 'command': 'cprload', 'data': { 'file': 'str' } } > > cprinfo returns a list of supported modes. Syntax: > { 'struct': 'CprInfo', 'data': { 'modes': [ 'CprMode' ] } } > { 'command': 'cprinfo', 'returns': 'CprInfo' } > It may not be necessary, we may instead rely on query-qmp-schema introspection. > Signed-off-by: Mark Kanda > Signed-off-by: Steve Sistare > --- > MAINTAINERS | 1 + > monitor/qmp-cmds.c | 31 +++++++++++++++++++++ > qapi/cpr.json | 74 > +++++++++++++++++++++++++++++++++++++++++++++++++++ > qapi/meson.build | 1 + > qapi/qapi-schema.json | 1 + > 5 files changed, 108 insertions(+) > create mode 100644 qapi/cpr.json > > diff --git a/MAINTAINERS b/MAINTAINERS > index c3573aa..c48dd37 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -2864,6 +2864,7 @@ M: Mark Kanda > S: Maintained > F: include/migration/cpr.h > F: migration/cpr.c > +F: qapi/cpr.json > > Record/replay > M: Pavel Dovgalyuk > diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c > index f7d64a6..1128604 100644 > --- a/monitor/qmp-cmds.c > +++ b/monitor/qmp-cmds.c > @@ -37,9 +37,11 @@ > #include "qapi/qapi-commands-machine.h" > #include "qapi/qapi-commands-misc.h" > #include "qapi/qapi-commands-ui.h" > +#include "qapi/qapi-commands-cpr.h" > #include "qapi/qmp/qerror.h" > #include "hw/mem/memory-device.h" > #include "hw/acpi/acpi_dev_interface.h" > +#include "migration/cpr.h" > > NameInfo *qmp_query_name(Error **errp) > { > @@ -153,6 +155,35 @@ void qmp_cont(Error **errp) > } > } > > +CprInfo *qmp_cprinfo(Error **errp) > +{ > + CprInfo *cprinfo; > + CprModeList *mode, *mode_list =3D NULL; > + CprMode i; > + > + cprinfo =3D g_malloc0(sizeof(*cprinfo)); > + > + for (i =3D 0; i < CPR_MODE__MAX; i++) { > + mode =3D g_malloc0(sizeof(*mode)); > + mode->value =3D i; > + mode->next =3D mode_list; > + mode_list =3D mode; > + } > + > + cprinfo->modes =3D mode_list; > + return cprinfo; > +} > + > +void qmp_cprsave(const char *file, CprMode mode, Error **errp) > +{ > + cprsave(file, mode, errp); > +} > + > +void qmp_cprload(const char *file, Error **errp) > +{ > + cprload(file, errp); > +} > + > void qmp_system_wakeup(Error **errp) > { > if (!qemu_wakeup_suspend_enabled()) { > diff --git a/qapi/cpr.json b/qapi/cpr.json > new file mode 100644 > index 0000000..b6fdc89 > --- /dev/null > +++ b/qapi/cpr.json > @@ -0,0 +1,74 @@ > +# -*- Mode: Python -*- > +# > +# Copyright (c) 2021 Oracle and/or its affiliates. > +# > +# This work is licensed under the terms of the GNU GPL, version 2. > +# See the COPYING file in the top-level directory. > + > +## > +# =3D CPR > Please spell it out in the doc at least (it's not obvious, I had to search for the meaning in list archives ;). +## > + > +{ 'include': 'common.json' } > + > +## > +# @CprMode: > +# > +# @reboot: checkpoint can be cprload'ed after a host kexec reboot. > +# > +# Since: 6.1 > +## > +{ 'enum': 'CprMode', > + 'data': [ 'reboot' ] } > + > + > +## > +# @CprInfo: > +# > +# @modes: @CprMode list > +# > +# Since: 6.1 > +## > +{ 'struct': 'CprInfo', > + 'data': { 'modes': [ 'CprMode' ] } } > + > +## > +# @cprinfo: > +# > +# Returns the modes supported by @cprsave. > +# > +# Returns: @CprInfo > +# > +# Since: 6.1 > +# > +## > +{ 'command': 'cprinfo', > + 'returns': 'CprInfo' } > + > +## > +# @cprsave: > +# > +# Create a checkpoint of the virtual machine device state in @file. > +# Guest RAM and guest block device blocks are not saved. > +# > It would be worth highlighting the differences with snapshot-save/load. I guess it would make sense to consider this as an extension/variant to those commands. > +# @file: name of checkpoint file > +# @mode: @CprMode mode > +# > +# Since: 6.1 > +## > +{ 'command': 'cprsave', > + 'data': { 'file': 'str', > + 'mode': 'CprMode' } } > + > +## > +# @cprload: > +# > +# Start virtual machine from checkpoint file that was created earlier > using > +# the cprsave command. > +# > +# @file: name of checkpoint file > +# > +# Since: 6.1 > +## > +{ 'command': 'cprload', > + 'data': { 'file': 'str' } } > diff --git a/qapi/meson.build b/qapi/meson.build > index 376f4ce..7e7c48a 100644 > --- a/qapi/meson.build > +++ b/qapi/meson.build > @@ -26,6 +26,7 @@ qapi_all_modules =3D [ > 'common', > 'compat', > 'control', > + 'cpr', > 'crypto', > 'dump', > 'error', > diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json > index 4912b97..001d790 100644 > --- a/qapi/qapi-schema.json > +++ b/qapi/qapi-schema.json > @@ -77,6 +77,7 @@ > { 'include': 'ui.json' } > { 'include': 'authz.json' } > { 'include': 'migration.json' } > +{ 'include': 'cpr.json' } > { 'include': 'transaction.json' } > { 'include': 'trace.json' } > { 'include': 'compat.json' } > -- > 1.8.3.1 > > > --=20 Marc-Andr=C3=A9 Lureau --0000000000004652f605c69c9de2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Wed, Jul 7, 2021 at 9:28 PM Steve Sistare = <steven.sistare@oracle.com<= /a>> wrote:
c= prsave calls cprsave().=C2=A0 Syntax:
=C2=A0 { 'enum': 'CprMode', 'data': [ 'reboot&#= 39; ] }
=C2=A0 { 'command': 'cprsave', 'data': { 'file&= #39;: 'str', 'mode': 'CprMode' } }

cprload calls cprload().=C2=A0 Syntax:
=C2=A0 { 'command': 'cprload', 'data': { 'file&= #39;: 'str' } }

cprinfo returns a list of supported modes.=C2=A0 Syntax:
=C2=A0 { 'struct': 'CprInfo', 'data': { 'modes&= #39;: [ 'CprMode' ] } }
=C2=A0 { 'command': 'cprinfo', 'returns': 'CprI= nfo' }



Signed-off-by: Mark Kanda <
mark.kanda@oracle.com>
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
=C2=A0MAINTAINERS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 1 +
=C2=A0monitor/qmp-cmds.c=C2=A0 =C2=A0 | 31 +++++++++++++++++++++
=C2=A0qapi/cpr.json=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 74 +++++++++++++++++= ++++++++++++++++++++++++++++++++++
=C2=A0qapi/meson.build=C2=A0 =C2=A0 =C2=A0 |=C2=A0 1 +
=C2=A0qapi/qapi-schema.json |=C2=A0 1 +
=C2=A05 files changed, 108 insertions(+)
=C2=A0create mode 100644 qapi/cpr.json

diff --git a/MAINTAINERS b/MAINTAINERS
index c3573aa..c48dd37 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2864,6 +2864,7 @@ M: Mark Kanda <mark.kanda@oracle.com>
=C2=A0S: Maintained
=C2=A0F: include/migration/cpr.h
=C2=A0F: migration/cpr.c
+F: qapi/cpr.json

=C2=A0Record/replay
=C2=A0M: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index f7d64a6..1128604 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -37,9 +37,11 @@
=C2=A0#include "qapi/qapi-commands-machine.h"
=C2=A0#include "qapi/qapi-commands-misc.h"
=C2=A0#include "qapi/qapi-commands-ui.h"
+#include "qapi/qapi-commands-cpr.h"
=C2=A0#include "qapi/qmp/qerror.h"
=C2=A0#include "hw/mem/memory-device.h"
=C2=A0#include "hw/acpi/acpi_dev_interface.h"
+#include "migration/cpr.h"

=C2=A0NameInfo *qmp_query_name(Error **errp)
=C2=A0{
@@ -153,6 +155,35 @@ void qmp_cont(Error **errp)
=C2=A0 =C2=A0 =C2=A0}
=C2=A0}

+CprInfo *qmp_cprinfo(Error **errp)
+{
+=C2=A0 =C2=A0 CprInfo *cprinfo;
+=C2=A0 =C2=A0 CprModeList *mode, *mode_list =3D NULL;
+=C2=A0 =C2=A0 CprMode i;
+
+=C2=A0 =C2=A0 cprinfo =3D g_malloc0(sizeof(*cprinfo));
+
+=C2=A0 =C2=A0 for (i =3D 0; i < CPR_MODE__MAX; i++) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 mode =3D g_malloc0(sizeof(*mode));
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 mode->value =3D i;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 mode->next =3D mode_list;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 mode_list =3D mode;
+=C2=A0 =C2=A0 }
+
+=C2=A0 =C2=A0 cprinfo->modes =3D mode_list;
+=C2=A0 =C2=A0 return cprinfo;
+}
+
+void qmp_cprsave(const char *file, CprMode mode, Error **errp)
+{
+=C2=A0 =C2=A0 cprsave(file, mode, errp);
+}
+
+void qmp_cprload(const char *file, Error **errp)
+{
+=C2=A0 =C2=A0 cprload(file, errp);
+}
+
=C2=A0void qmp_system_wakeup(Error **errp)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0if (!qemu_wakeup_suspend_enabled()) {
diff --git a/qapi/cpr.json b/qapi/cpr.json
new file mode 100644
index 0000000..b6fdc89
--- /dev/null
+++ b/qapi/cpr.json
@@ -0,0 +1,74 @@
+# -*- Mode: Python -*-
+#
+# Copyright (c) 2021 Oracle and/or its affiliates.
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING file in the top-level directory.
+
+##
+# =3D CPR

Please spell it out in the d= oc at least (it's not obvious, I had to search for the meaning in list = archives ;).

+##
+
+{ 'include': 'common.json' }
+
+##
+# @CprMode:
+#
+# @reboot: checkpoint can be cprload'ed after a host kexec reboot.
+#
+# Since: 6.1
+##
+{ 'enum': 'CprMode',
+=C2=A0 'data': [ 'reboot' ] }
+
+
+##
+# @CprInfo:
+#
+# @modes: @CprMode list
+#
+# Since: 6.1
+##
+{ 'struct': 'CprInfo',
+=C2=A0 'data': { 'modes': [ 'CprMode' ] } }
+
+##
+# @cprinfo:
+#
+# Returns the modes supported by @cprsave.
+#
+# Returns: @CprInfo
+#
+# Since: 6.1
+#
+##
+{ 'command': 'cprinfo',
+=C2=A0 'returns': 'CprInfo' }
+
+##
+# @cprsave:
+#
+# Create a checkpoint of the virtual machine device state in @file.
+# Guest RAM and guest block device blocks are not saved.
+#

It would be worth highlighting the d= ifferences with snapshot-save/load.

I guess it wou= ld make sense to consider this as an extension/variant to those commands.
=C2=A0
+# @file: name of checkpoint file
+# @mode: @CprMode mode
+#
+# Since: 6.1
+##
+{ 'command': 'cprsave',
+=C2=A0 'data': { 'file': 'str',
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 'mode': 'CprMode'= ; } }
+
+##
+# @cprload:
+#
+# Start virtual machine from checkpoint file that was created earlier usin= g
+# the cprsave command.
+#
+# @file: name of checkpoint file
+#
+# Since: 6.1
+##
+{ 'command': 'cprload',
+=C2=A0 'data': { 'file': 'str' } }
diff --git a/qapi/meson.build b/qapi/meson.build
index 376f4ce..7e7c48a 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -26,6 +26,7 @@ qapi_all_modules =3D [
=C2=A0 =C2=A0'common',
=C2=A0 =C2=A0'compat',
=C2=A0 =C2=A0'control',
+=C2=A0 'cpr',
=C2=A0 =C2=A0'crypto',
=C2=A0 =C2=A0'dump',
=C2=A0 =C2=A0'error',
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 4912b97..001d790 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -77,6 +77,7 @@
=C2=A0{ 'include': 'ui.json' }
=C2=A0{ 'include': 'authz.json' }
=C2=A0{ 'include': 'migration.json' }
+{ 'include': 'cpr.json' }
=C2=A0{ 'include': 'transaction.json' }
=C2=A0{ 'include': 'trace.json' }
=C2=A0{ 'include': 'compat.json' }
--
1.8.3.1




--
Marc-Andr=C3=A9 Lureau
--0000000000004652f605c69c9de2--