All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes
@ 2018-07-05 20:08 Daniel Henrique Barboza
  2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 1/3] qmp: query-current-machine with wakeup-suspend-support Daniel Henrique Barboza
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Daniel Henrique Barboza @ 2018-07-05 20:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, armbru, mdroth, Daniel Henrique Barboza

changes in v8:
- created 'query-current-machine' API to hold the wakeup-suspend-support
  flag
- wake-up flag now considers the --no-acpi config option for PC archs
- fixes in patch 3 proposed by Markus.
Previous series link:
https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg04234.html

Daniel Henrique Barboza (3):
  qmp: query-current-machine with wakeup-suspend-support
  qga: update guest-suspend-ram and guest-suspend-hybrid descriptions
  qmp hmp: Make system_wakeup check wake-up support and run state

 hmp.c                   |  5 ++++-
 include/sysemu/sysemu.h |  1 +
 qapi/misc.json          | 29 ++++++++++++++++++++++++++++-
 qga/qapi-schema.json    | 12 ++++++------
 qmp.c                   | 11 ++++++++++-
 vl.c                    | 30 ++++++++++++++++++++++++++++++
 6 files changed, 79 insertions(+), 9 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v8 1/3] qmp: query-current-machine with wakeup-suspend-support
  2018-07-05 20:08 [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes Daniel Henrique Barboza
@ 2018-07-05 20:08 ` Daniel Henrique Barboza
  2018-09-06  0:21   ` Michael Roth
  2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 2/3] qga: update guest-suspend-ram and guest-suspend-hybrid descriptions Daniel Henrique Barboza
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Daniel Henrique Barboza @ 2018-07-05 20:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, armbru, mdroth, Daniel Henrique Barboza

When issuing the qmp/hmp 'system_wakeup' command, what happens in a
nutshell is:

- qmp_system_wakeup_request set runstate to RUNNING, sets a wakeup_reason
and notify the event
- in the main_loop, all vcpus are paused, a system reset is issued, all
subscribers of wakeup_notifiers receives a notification, vcpus are then
resumed and the wake up QAPI event is fired

Note that this procedure alone doesn't ensure that the guest will awake
from SUSPENDED state - the subscribers of the wake up event must take
action to resume the guest, otherwise the guest will simply reboot.

At this moment, there are only two subscribers of the wake up event: one
in hw/acpi/core.c and another in hw/i386/xen/xen-hvm.c. This means
that system_wakeup does not work as intended with other architectures.

However, only the presence of 'system_wakeup' is required for QGA to
support 'guest-suspend-ram' and 'guest-suspend-hybrid' at this moment.
This means that the user/management will expect to suspend the guest using
one of those suspend commands and then resume execution using system_wakeup,
regardless of the support offered in system_wakeup in the first place.

This patch creates a new API called query-current-machine [1], that holds
a new flag called 'wakeup-suspend-support', which indicates if the guest
supports wake up from suspend via system_wakeup. The guest is considered
to implement wake-up support if:

- there is at least one subscriber for the wake up event;

and, for the PC machine type:

- ACPI is enabled.

This is the expected output of query-current-machine when running a x86
guest:

{"execute" : "query-current-machine"}
{"return": {"wakeup-suspend-support": true}}

Running the same x86 guest, but with the --no-acpi option:

{"execute" : "query-current-machine"}
{"return": {"wakeup-suspend-support": false}}

This is the output when running a pseries guest:

{"execute" : "query-current-machine"}
{"return": {"wakeup-suspend-support": false}}

With this extra tool, management can avoid situations where a guest
that does not have proper suspend/wake capabilities ends up in
inconsistent state (e.g.
https://github.com/open-power-host-os/qemu/issues/31).

[1] the decision of creating the query-current-machine API is based
on discussions in the QEMU mailing list where it was decided that
query-target wasn't a proper place to store the wake-up flag, neither
was query-machines because this isn't a static property of the
machine object. This new API can then be used to store other
dynamic machine properties that are scattered around the code
ATM. More info at:
https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg04235.html

Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 qapi/misc.json | 24 ++++++++++++++++++++++++
 vl.c           | 30 ++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/qapi/misc.json b/qapi/misc.json
index 29da7856e3..266f88cb09 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -2003,6 +2003,30 @@
 ##
 { 'command': 'query-machines', 'returns': ['MachineInfo'] }
 
+##
+# @CurrentMachineParams:
+#
+# Information describing the running machine parameters.
+#
+# @wakeup-suspend-support: true if the target supports wake up from
+#                          suspend
+#
+# Since: 3.0.0
+##
+{ 'struct': 'CurrentMachineParams',
+  'data': { 'wakeup-suspend-support': 'bool'} }
+
+##
+# @query-current-machine:
+#
+# Return a list of parameters of the running machine.
+#
+# Returns: CurrentMachineParams
+#
+# Since: 3.0.0
+##
+{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
+
 ##
 # @CpuDefinitionInfo:
 #
diff --git a/vl.c b/vl.c
index ef6cfcec40..96ad448d57 100644
--- a/vl.c
+++ b/vl.c
@@ -1747,11 +1747,41 @@ void qemu_system_wakeup_enable(WakeupReason reason, bool enabled)
     }
 }
 
+/*
+ * The existence of a wake-up notifier is being checked in the function
+ * qemu_wakeup_suspend_support and it's used in the logic of the
+ * wakeup-suspend-support flag of QMP 'query-current-machine' command.
+ * The idea of this flag is to indicate whether the guest supports wake-up
+ * from suspend (via system_wakeup QMP/HMP call for example), warning the
+ * user that the guest can't handle both wake-up from suspend and the
+ * suspend itself via QGA guest-suspend-ram and guest-suspend-hybrid (if
+ * it can't wake up, it can't be suspended safely).
+ *
+ * An assumption is made by the wakeup-suspend-support flag that only the
+ * guests that can go to RUN_STATE_SUSPENDED and wake up properly would
+ * be interested in this wakeup_notifier. Adding a wakeup_notifier for
+ * any other reason will break the logic of the wakeup-suspend-support
+ * flag and can lead to user/management confusion about the suspend/wake-up
+ * support of the guest.
+ */
 void qemu_register_wakeup_notifier(Notifier *notifier)
 {
     notifier_list_add(&wakeup_notifiers, notifier);
 }
 
+static bool qemu_wakeup_suspend_support(void)
+{
+    return !QLIST_EMPTY(&wakeup_notifiers.notifiers) && acpi_enabled;
+}
+
+CurrentMachineParams *qmp_query_current_machine(Error **errp)
+{
+    CurrentMachineParams *params = g_malloc0(sizeof(*params));
+    params->wakeup_suspend_support = qemu_wakeup_suspend_support();
+
+    return params;
+}
+
 void qemu_system_killed(int signal, pid_t pid)
 {
     shutdown_signal = signal;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v8 2/3] qga: update guest-suspend-ram and guest-suspend-hybrid descriptions
  2018-07-05 20:08 [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes Daniel Henrique Barboza
  2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 1/3] qmp: query-current-machine with wakeup-suspend-support Daniel Henrique Barboza
@ 2018-07-05 20:08 ` Daniel Henrique Barboza
  2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 3/3] qmp hmp: Make system_wakeup check wake-up support and run state Daniel Henrique Barboza
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Daniel Henrique Barboza @ 2018-07-05 20:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, armbru, mdroth, Daniel Henrique Barboza

This patch updates the descriptions of 'guest-suspend-ram' and
'guest-suspend-hybrid' to mention that both commands relies now
on the proper support for wake up from suspend, retrieved by the
'wakeup-suspend-support' attribute of the 'query-current-machine'
QMP command.

Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/qapi-schema.json | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index 17884c7c70..912e7505bd 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -565,9 +565,9 @@
 # For the best results it's strongly recommended to have the pm-utils
 # package installed in the guest.
 #
-# IMPORTANT: guest-suspend-ram requires QEMU to support the 'system_wakeup'
-# command.  Thus, it's *required* to query QEMU for the presence of the
-# 'system_wakeup' command before issuing guest-suspend-ram.
+# IMPORTANT: guest-suspend-ram requires working wakeup support in
+# QEMU. You *must* check QMP command query-current-machine returns
+# wakeup-suspend-support: true before issuing this command.
 #
 # This command does NOT return a response on success. There are two options
 # to check for success:
@@ -592,9 +592,9 @@
 #
 # This command requires the pm-utils package to be installed in the guest.
 #
-# IMPORTANT: guest-suspend-hybrid requires QEMU to support the 'system_wakeup'
-# command.  Thus, it's *required* to query QEMU for the presence of the
-# 'system_wakeup' command before issuing guest-suspend-hybrid.
+# IMPORTANT: guest-suspend-hybrid requires working wakeup support in
+# QEMU. You *must* check QMP command query-current-machine returns
+# wakeup-suspend-support: true before issuing this command.
 #
 # This command does NOT return a response on success. There are two options
 # to check for success:
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v8 3/3] qmp hmp: Make system_wakeup check wake-up support and run state
  2018-07-05 20:08 [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes Daniel Henrique Barboza
  2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 1/3] qmp: query-current-machine with wakeup-suspend-support Daniel Henrique Barboza
  2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 2/3] qga: update guest-suspend-ram and guest-suspend-hybrid descriptions Daniel Henrique Barboza
@ 2018-07-05 20:08 ` Daniel Henrique Barboza
  2018-09-06  0:27   ` Michael Roth
  2018-07-30 18:50 ` [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes Daniel Henrique Barboza
  2018-08-28 19:55 ` Daniel Henrique Barboza
  4 siblings, 1 reply; 10+ messages in thread
From: Daniel Henrique Barboza @ 2018-07-05 20:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, armbru, mdroth, Daniel Henrique Barboza

The qmp/hmp command 'system_wakeup' is simply a direct call to
'qemu_system_wakeup_request' from vl.c. This function verifies if
runstate is SUSPENDED and if the wake up reason is valid before
proceeding. However, no error or warning is thrown if any of those
pre-requirements isn't met. There is no way for the caller to
differentiate between a successful wakeup or an error state caused
when trying to wake up a guest that wasn't suspended.

This means that system_wakeup is silently failing, which can be
considered a bug. Adding error handling isn't an API break in this
case - applications that didn't check the result will remain broken,
the ones that check it will have a chance to deal with it.

Adding to that, the commit before previous created a new QMP API called
query-current-machine, with a new flag called wakeup-suspend-support,
that indicates if the guest has the capability of waking up from suspended
state. Although such guest will never reach SUSPENDED state and erroring
it out in this scenario would suffice, it is more informative for the user
to differentiate between a failure because the guest isn't suspended versus
a failure because the guest does not have support for wake up at all.

All this considered, this patch changes qmp_system_wakeup to:

- check if the guest has the capability to wake-up from suspend. If
not, error out informing about the lack of support;

- make the runstate verification before proceeding to call
qemu_system_wakeup_request, firing up an error message if the user tries
to wake up a machine that isn't in SUSPENDED state.

After this patch, this is the output of system_wakeup in a guest that
does not have wake-up from suspend support (ppc64):

(qemu) system_wakeup
wake-up from suspend is not supported by this guest
(qemu)

And this is the output of system_wakeup in a x86 guest that has the
support but isn't suspended:

(qemu) system_wakeup
Unable to wake up: guest is not in suspended state
(qemu)

Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hmp.c                   |  5 ++++-
 include/sysemu/sysemu.h |  1 +
 qapi/misc.json          |  5 ++++-
 qmp.c                   | 11 ++++++++++-
 vl.c                    |  2 +-
 5 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/hmp.c b/hmp.c
index 41f5e39b72..83a8041d11 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1169,7 +1169,10 @@ void hmp_cont(Monitor *mon, const QDict *qdict)
 
 void hmp_system_wakeup(Monitor *mon, const QDict *qdict)
 {
-    qmp_system_wakeup(NULL);
+    Error *err = NULL;
+
+    qmp_system_wakeup(&err);
+    hmp_handle_error(mon, &err);
 }
 
 void hmp_nmi(Monitor *mon, const QDict *qdict)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index b921c6f3b7..483f804b36 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -70,6 +70,7 @@ void qemu_exit_preconfig_request(void);
 void qemu_system_reset_request(ShutdownCause reason);
 void qemu_system_suspend_request(void);
 void qemu_register_suspend_notifier(Notifier *notifier);
+bool qemu_wakeup_suspend_support(void);
 void qemu_system_wakeup_request(WakeupReason reason);
 void qemu_system_wakeup_enable(WakeupReason reason, bool enabled);
 void qemu_register_wakeup_notifier(Notifier *notifier);
diff --git a/qapi/misc.json b/qapi/misc.json
index 266f88cb09..86195d79e9 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -1230,7 +1230,10 @@
 ##
 # @system_wakeup:
 #
-# Wakeup guest from suspend.  Does nothing in case the guest isn't suspended.
+# If the guest has wake-up from suspend support enabled
+# (wakeup-suspend-support flag from query-current-machine), wakeup guest
+# from suspend if the guest is in SUSPENDED state. Returns an error
+# otherwise.
 #
 # Since:  1.1
 #
diff --git a/qmp.c b/qmp.c
index 73e46d795f..0673ff1fa5 100644
--- a/qmp.c
+++ b/qmp.c
@@ -215,7 +215,16 @@ void qmp_cont(Error **errp)
 
 void qmp_system_wakeup(Error **errp)
 {
-    qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
+    if (!qemu_wakeup_suspend_support()) {
+        error_setg(errp,
+                   "wake-up from suspend is not supported by this guest");
+        return;
+    }
+    if (!runstate_check(RUN_STATE_SUSPENDED)) {
+        error_setg(errp,
+                   "Unable to wake up: guest is not in suspended state");
+        return;
+    }
 }
 
 ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
diff --git a/vl.c b/vl.c
index 96ad448d57..2af10b75cb 100644
--- a/vl.c
+++ b/vl.c
@@ -1769,7 +1769,7 @@ void qemu_register_wakeup_notifier(Notifier *notifier)
     notifier_list_add(&wakeup_notifiers, notifier);
 }
 
-static bool qemu_wakeup_suspend_support(void)
+bool qemu_wakeup_suspend_support(void)
 {
     return !QLIST_EMPTY(&wakeup_notifiers.notifiers) && acpi_enabled;
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes
  2018-07-05 20:08 [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes Daniel Henrique Barboza
                   ` (2 preceding siblings ...)
  2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 3/3] qmp hmp: Make system_wakeup check wake-up support and run state Daniel Henrique Barboza
@ 2018-07-30 18:50 ` Daniel Henrique Barboza
  2018-08-28 19:55 ` Daniel Henrique Barboza
  4 siblings, 0 replies; 10+ messages in thread
From: Daniel Henrique Barboza @ 2018-07-30 18:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, armbru, mdroth

Ping

On 07/05/2018 05:08 PM, Daniel Henrique Barboza wrote:
> changes in v8:
> - created 'query-current-machine' API to hold the wakeup-suspend-support
>    flag
> - wake-up flag now considers the --no-acpi config option for PC archs
> - fixes in patch 3 proposed by Markus.
> Previous series link:
> https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg04234.html
>
> Daniel Henrique Barboza (3):
>    qmp: query-current-machine with wakeup-suspend-support
>    qga: update guest-suspend-ram and guest-suspend-hybrid descriptions
>    qmp hmp: Make system_wakeup check wake-up support and run state
>
>   hmp.c                   |  5 ++++-
>   include/sysemu/sysemu.h |  1 +
>   qapi/misc.json          | 29 ++++++++++++++++++++++++++++-
>   qga/qapi-schema.json    | 12 ++++++------
>   qmp.c                   | 11 ++++++++++-
>   vl.c                    | 30 ++++++++++++++++++++++++++++++
>   6 files changed, 79 insertions(+), 9 deletions(-)
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes
  2018-07-05 20:08 [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes Daniel Henrique Barboza
                   ` (3 preceding siblings ...)
  2018-07-30 18:50 ` [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes Daniel Henrique Barboza
@ 2018-08-28 19:55 ` Daniel Henrique Barboza
  4 siblings, 0 replies; 10+ messages in thread
From: Daniel Henrique Barboza @ 2018-08-28 19:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, armbru, mdroth

Ping

On 07/05/2018 05:08 PM, Daniel Henrique Barboza wrote:
> changes in v8:
> - created 'query-current-machine' API to hold the wakeup-suspend-support
>    flag
> - wake-up flag now considers the --no-acpi config option for PC archs
> - fixes in patch 3 proposed by Markus.
> Previous series link:
> https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg04234.html
>
> Daniel Henrique Barboza (3):
>    qmp: query-current-machine with wakeup-suspend-support
>    qga: update guest-suspend-ram and guest-suspend-hybrid descriptions
>    qmp hmp: Make system_wakeup check wake-up support and run state
>
>   hmp.c                   |  5 ++++-
>   include/sysemu/sysemu.h |  1 +
>   qapi/misc.json          | 29 ++++++++++++++++++++++++++++-
>   qga/qapi-schema.json    | 12 ++++++------
>   qmp.c                   | 11 ++++++++++-
>   vl.c                    | 30 ++++++++++++++++++++++++++++++
>   6 files changed, 79 insertions(+), 9 deletions(-)
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v8 1/3] qmp: query-current-machine with wakeup-suspend-support
  2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 1/3] qmp: query-current-machine with wakeup-suspend-support Daniel Henrique Barboza
@ 2018-09-06  0:21   ` Michael Roth
  2018-09-06 12:53     ` Daniel Henrique Barboza
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Roth @ 2018-09-06  0:21 UTC (permalink / raw)
  To: Daniel Henrique Barboza, qemu-devel; +Cc: ehabkost, armbru

Quoting Daniel Henrique Barboza (2018-07-05 15:08:11)
> When issuing the qmp/hmp 'system_wakeup' command, what happens in a
> nutshell is:
> 
> - qmp_system_wakeup_request set runstate to RUNNING, sets a wakeup_reason
> and notify the event
> - in the main_loop, all vcpus are paused, a system reset is issued, all
> subscribers of wakeup_notifiers receives a notification, vcpus are then
> resumed and the wake up QAPI event is fired
> 
> Note that this procedure alone doesn't ensure that the guest will awake
> from SUSPENDED state - the subscribers of the wake up event must take
> action to resume the guest, otherwise the guest will simply reboot.
> 
> At this moment, there are only two subscribers of the wake up event: one
> in hw/acpi/core.c and another in hw/i386/xen/xen-hvm.c. This means
> that system_wakeup does not work as intended with other architectures.
> 
> However, only the presence of 'system_wakeup' is required for QGA to
> support 'guest-suspend-ram' and 'guest-suspend-hybrid' at this moment.
> This means that the user/management will expect to suspend the guest using
> one of those suspend commands and then resume execution using system_wakeup,
> regardless of the support offered in system_wakeup in the first place.
> 
> This patch creates a new API called query-current-machine [1], that holds
> a new flag called 'wakeup-suspend-support', which indicates if the guest
> supports wake up from suspend via system_wakeup. The guest is considered
> to implement wake-up support if:
> 
> - there is at least one subscriber for the wake up event;
> 
> and, for the PC machine type:
> 
> - ACPI is enabled.
> 
> This is the expected output of query-current-machine when running a x86
> guest:
> 
> {"execute" : "query-current-machine"}
> {"return": {"wakeup-suspend-support": true}}
> 
> Running the same x86 guest, but with the --no-acpi option:
> 
> {"execute" : "query-current-machine"}
> {"return": {"wakeup-suspend-support": false}}
> 
> This is the output when running a pseries guest:
> 
> {"execute" : "query-current-machine"}
> {"return": {"wakeup-suspend-support": false}}
> 
> With this extra tool, management can avoid situations where a guest
> that does not have proper suspend/wake capabilities ends up in
> inconsistent state (e.g.
> https://github.com/open-power-host-os/qemu/issues/31).
> 
> [1] the decision of creating the query-current-machine API is based
> on discussions in the QEMU mailing list where it was decided that
> query-target wasn't a proper place to store the wake-up flag, neither
> was query-machines because this isn't a static property of the
> machine object. This new API can then be used to store other
> dynamic machine properties that are scattered around the code
> ATM. More info at:
> https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg04235.html
> 
> Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
>  qapi/misc.json | 24 ++++++++++++++++++++++++
>  vl.c           | 30 ++++++++++++++++++++++++++++++
>  2 files changed, 54 insertions(+)
> 
> diff --git a/qapi/misc.json b/qapi/misc.json
> index 29da7856e3..266f88cb09 100644
> --- a/qapi/misc.json
> +++ b/qapi/misc.json
> @@ -2003,6 +2003,30 @@
>  ##
>  { 'command': 'query-machines', 'returns': ['MachineInfo'] }
> 
> +##
> +# @CurrentMachineParams:
> +#
> +# Information describing the running machine parameters.
> +#
> +# @wakeup-suspend-support: true if the target supports wake up from
> +#                          suspend
> +#
> +# Since: 3.0.0

3.1.0 now (hopefully :))

> +##
> +{ 'struct': 'CurrentMachineParams',
> +  'data': { 'wakeup-suspend-support': 'bool'} }
> +
> +##
> +# @query-current-machine:
> +#
> +# Return a list of parameters of the running machine.
> +#
> +# Returns: CurrentMachineParams
> +#
> +# Since: 3.0.0
> +##
> +{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
> +
>  ##
>  # @CpuDefinitionInfo:
>  #
> diff --git a/vl.c b/vl.c
> index ef6cfcec40..96ad448d57 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1747,11 +1747,41 @@ void qemu_system_wakeup_enable(WakeupReason reason, bool enabled)
>      }
>  }
> 
> +/*
> + * The existence of a wake-up notifier is being checked in the function
> + * qemu_wakeup_suspend_support and it's used in the logic of the
> + * wakeup-suspend-support flag of QMP 'query-current-machine' command.
> + * The idea of this flag is to indicate whether the guest supports wake-up
> + * from suspend (via system_wakeup QMP/HMP call for example), warning the
> + * user that the guest can't handle both wake-up from suspend and the
> + * suspend itself via QGA guest-suspend-ram and guest-suspend-hybrid (if
> + * it can't wake up, it can't be suspended safely).
> + *
> + * An assumption is made by the wakeup-suspend-support flag that only the
> + * guests that can go to RUN_STATE_SUSPENDED and wake up properly would
> + * be interested in this wakeup_notifier. Adding a wakeup_notifier for
> + * any other reason will break the logic of the wakeup-suspend-support
> + * flag and can lead to user/management confusion about the suspend/wake-up
> + * support of the guest.
> + */
>  void qemu_register_wakeup_notifier(Notifier *notifier)
>  {
>      notifier_list_add(&wakeup_notifiers, notifier);
>  }
> 
> +static bool qemu_wakeup_suspend_support(void)
> +{
> +    return !QLIST_EMPTY(&wakeup_notifiers.notifiers) && acpi_enabled;
> +}

I think this would need to be re-worked for any machine types that
eventually implement wakeup even though acpi_enabled == false. It was
maybe a bit hacky, but kind of nice that registering a wakeup notifier
implicitly registered support for wakeup, but now that we already have
these sorts of edge cases to consider maybe it's best to just add an
explicit qemu_register_wakeup_support() that just sets a flag in
vl.c and add call that at the appropriate locations for known supported
configurations. Maybe one call in acpi_pm1_cnt_init() might be enough?

Though I'm noticing mips malta board also calls that, would be curious
if that actually supports wake-from-suspend. If not, maybe the callers
are where we should declare support (ich9_pm_init and piix4_pm_realize
currently)?

> +
> +CurrentMachineParams *qmp_query_current_machine(Error **errp)
> +{
> +    CurrentMachineParams *params = g_malloc0(sizeof(*params));
> +    params->wakeup_suspend_support = qemu_wakeup_suspend_support();
> +
> +    return params;
> +}
> +
>  void qemu_system_killed(int signal, pid_t pid)
>  {
>      shutdown_signal = signal;
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v8 3/3] qmp hmp: Make system_wakeup check wake-up support and run state
  2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 3/3] qmp hmp: Make system_wakeup check wake-up support and run state Daniel Henrique Barboza
@ 2018-09-06  0:27   ` Michael Roth
  2018-09-06 10:54     ` Daniel Henrique Barboza
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Roth @ 2018-09-06  0:27 UTC (permalink / raw)
  To: Daniel Henrique Barboza, qemu-devel; +Cc: ehabkost, armbru

Quoting Daniel Henrique Barboza (2018-07-05 15:08:13)
> The qmp/hmp command 'system_wakeup' is simply a direct call to
> 'qemu_system_wakeup_request' from vl.c. This function verifies if
> runstate is SUSPENDED and if the wake up reason is valid before
> proceeding. However, no error or warning is thrown if any of those
> pre-requirements isn't met. There is no way for the caller to
> differentiate between a successful wakeup or an error state caused
> when trying to wake up a guest that wasn't suspended.
> 
> This means that system_wakeup is silently failing, which can be
> considered a bug. Adding error handling isn't an API break in this
> case - applications that didn't check the result will remain broken,
> the ones that check it will have a chance to deal with it.
> 
> Adding to that, the commit before previous created a new QMP API called
> query-current-machine, with a new flag called wakeup-suspend-support,
> that indicates if the guest has the capability of waking up from suspended
> state. Although such guest will never reach SUSPENDED state and erroring
> it out in this scenario would suffice, it is more informative for the user
> to differentiate between a failure because the guest isn't suspended versus
> a failure because the guest does not have support for wake up at all.
> 
> All this considered, this patch changes qmp_system_wakeup to:
> 
> - check if the guest has the capability to wake-up from suspend. If
> not, error out informing about the lack of support;
> 
> - make the runstate verification before proceeding to call
> qemu_system_wakeup_request, firing up an error message if the user tries
> to wake up a machine that isn't in SUSPENDED state.
> 
> After this patch, this is the output of system_wakeup in a guest that
> does not have wake-up from suspend support (ppc64):
> 
> (qemu) system_wakeup
> wake-up from suspend is not supported by this guest
> (qemu)
> 
> And this is the output of system_wakeup in a x86 guest that has the
> support but isn't suspended:
> 
> (qemu) system_wakeup
> Unable to wake up: guest is not in suspended state
> (qemu)
> 
> Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
>  hmp.c                   |  5 ++++-
>  include/sysemu/sysemu.h |  1 +
>  qapi/misc.json          |  5 ++++-
>  qmp.c                   | 11 ++++++++++-
>  vl.c                    |  2 +-
>  5 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/hmp.c b/hmp.c
> index 41f5e39b72..83a8041d11 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1169,7 +1169,10 @@ void hmp_cont(Monitor *mon, const QDict *qdict)
> 
>  void hmp_system_wakeup(Monitor *mon, const QDict *qdict)
>  {
> -    qmp_system_wakeup(NULL);
> +    Error *err = NULL;
> +
> +    qmp_system_wakeup(&err);
> +    hmp_handle_error(mon, &err);
>  }
> 
>  void hmp_nmi(Monitor *mon, const QDict *qdict)
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index b921c6f3b7..483f804b36 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -70,6 +70,7 @@ void qemu_exit_preconfig_request(void);
>  void qemu_system_reset_request(ShutdownCause reason);
>  void qemu_system_suspend_request(void);
>  void qemu_register_suspend_notifier(Notifier *notifier);
> +bool qemu_wakeup_suspend_support(void);
>  void qemu_system_wakeup_request(WakeupReason reason);
>  void qemu_system_wakeup_enable(WakeupReason reason, bool enabled);
>  void qemu_register_wakeup_notifier(Notifier *notifier);
> diff --git a/qapi/misc.json b/qapi/misc.json
> index 266f88cb09..86195d79e9 100644
> --- a/qapi/misc.json
> +++ b/qapi/misc.json
> @@ -1230,7 +1230,10 @@
>  ##
>  # @system_wakeup:
>  #
> -# Wakeup guest from suspend.  Does nothing in case the guest isn't suspended.
> +# If the guest has wake-up from suspend support enabled
> +# (wakeup-suspend-support flag from query-current-machine), wakeup guest
> +# from suspend if the guest is in SUSPENDED state. Returns an error
> +# otherwise.
>  #
>  # Since:  1.1
>  #
> diff --git a/qmp.c b/qmp.c
> index 73e46d795f..0673ff1fa5 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -215,7 +215,16 @@ void qmp_cont(Error **errp)
> 
>  void qmp_system_wakeup(Error **errp)
>  {
> -    qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
> +    if (!qemu_wakeup_suspend_support()) {
> +        error_setg(errp,
> +                   "wake-up from suspend is not supported by this guest");
> +        return;
> +    }
> +    if (!runstate_check(RUN_STATE_SUSPENDED)) {
> +        error_setg(errp,
> +                   "Unable to wake up: guest is not in suspended state");
> +        return;
> +    }
>  }

Was removing qemu_system_wakeup_request() intentional or did that just get
lost somehow?

> 
>  ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
> diff --git a/vl.c b/vl.c
> index 96ad448d57..2af10b75cb 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1769,7 +1769,7 @@ void qemu_register_wakeup_notifier(Notifier *notifier)
>      notifier_list_add(&wakeup_notifiers, notifier);
>  }
> 
> -static bool qemu_wakeup_suspend_support(void)
> +bool qemu_wakeup_suspend_support(void)
>  {
>      return !QLIST_EMPTY(&wakeup_notifiers.notifiers) && acpi_enabled;
>  }
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v8 3/3] qmp hmp: Make system_wakeup check wake-up support and run state
  2018-09-06  0:27   ` Michael Roth
@ 2018-09-06 10:54     ` Daniel Henrique Barboza
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Henrique Barboza @ 2018-09-06 10:54 UTC (permalink / raw)
  To: Michael Roth, qemu-devel; +Cc: ehabkost, armbru



On 09/05/2018 09:27 PM, Michael Roth wrote:
> Quoting Daniel Henrique Barboza (2018-07-05 15:08:13)
>> The qmp/hmp command 'system_wakeup' is simply a direct call to
>> 'qemu_system_wakeup_request' from vl.c. This function verifies if
>> runstate is SUSPENDED and if the wake up reason is valid before
>> proceeding. However, no error or warning is thrown if any of those
>> pre-requirements isn't met. There is no way for the caller to
>> differentiate between a successful wakeup or an error state caused
>> when trying to wake up a guest that wasn't suspended.
>>
>> This means that system_wakeup is silently failing, which can be
>> considered a bug. Adding error handling isn't an API break in this
>> case - applications that didn't check the result will remain broken,
>> the ones that check it will have a chance to deal with it.
>>
>> Adding to that, the commit before previous created a new QMP API called
>> query-current-machine, with a new flag called wakeup-suspend-support,
>> that indicates if the guest has the capability of waking up from suspended
>> state. Although such guest will never reach SUSPENDED state and erroring
>> it out in this scenario would suffice, it is more informative for the user
>> to differentiate between a failure because the guest isn't suspended versus
>> a failure because the guest does not have support for wake up at all.
>>
>> All this considered, this patch changes qmp_system_wakeup to:
>>
>> - check if the guest has the capability to wake-up from suspend. If
>> not, error out informing about the lack of support;
>>
>> - make the runstate verification before proceeding to call
>> qemu_system_wakeup_request, firing up an error message if the user tries
>> to wake up a machine that isn't in SUSPENDED state.
>>
>> After this patch, this is the output of system_wakeup in a guest that
>> does not have wake-up from suspend support (ppc64):
>>
>> (qemu) system_wakeup
>> wake-up from suspend is not supported by this guest
>> (qemu)
>>
>> And this is the output of system_wakeup in a x86 guest that has the
>> support but isn't suspended:
>>
>> (qemu) system_wakeup
>> Unable to wake up: guest is not in suspended state
>> (qemu)
>>
>> Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
>> ---
>>   hmp.c                   |  5 ++++-
>>   include/sysemu/sysemu.h |  1 +
>>   qapi/misc.json          |  5 ++++-
>>   qmp.c                   | 11 ++++++++++-
>>   vl.c                    |  2 +-
>>   5 files changed, 20 insertions(+), 4 deletions(-)
>>
>> diff --git a/hmp.c b/hmp.c
>> index 41f5e39b72..83a8041d11 100644
>> --- a/hmp.c
>> +++ b/hmp.c
>> @@ -1169,7 +1169,10 @@ void hmp_cont(Monitor *mon, const QDict *qdict)
>>
>>   void hmp_system_wakeup(Monitor *mon, const QDict *qdict)
>>   {
>> -    qmp_system_wakeup(NULL);
>> +    Error *err = NULL;
>> +
>> +    qmp_system_wakeup(&err);
>> +    hmp_handle_error(mon, &err);
>>   }
>>
>>   void hmp_nmi(Monitor *mon, const QDict *qdict)
>> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>> index b921c6f3b7..483f804b36 100644
>> --- a/include/sysemu/sysemu.h
>> +++ b/include/sysemu/sysemu.h
>> @@ -70,6 +70,7 @@ void qemu_exit_preconfig_request(void);
>>   void qemu_system_reset_request(ShutdownCause reason);
>>   void qemu_system_suspend_request(void);
>>   void qemu_register_suspend_notifier(Notifier *notifier);
>> +bool qemu_wakeup_suspend_support(void);
>>   void qemu_system_wakeup_request(WakeupReason reason);
>>   void qemu_system_wakeup_enable(WakeupReason reason, bool enabled);
>>   void qemu_register_wakeup_notifier(Notifier *notifier);
>> diff --git a/qapi/misc.json b/qapi/misc.json
>> index 266f88cb09..86195d79e9 100644
>> --- a/qapi/misc.json
>> +++ b/qapi/misc.json
>> @@ -1230,7 +1230,10 @@
>>   ##
>>   # @system_wakeup:
>>   #
>> -# Wakeup guest from suspend.  Does nothing in case the guest isn't suspended.
>> +# If the guest has wake-up from suspend support enabled
>> +# (wakeup-suspend-support flag from query-current-machine), wakeup guest
>> +# from suspend if the guest is in SUSPENDED state. Returns an error
>> +# otherwise.
>>   #
>>   # Since:  1.1
>>   #
>> diff --git a/qmp.c b/qmp.c
>> index 73e46d795f..0673ff1fa5 100644
>> --- a/qmp.c
>> +++ b/qmp.c
>> @@ -215,7 +215,16 @@ void qmp_cont(Error **errp)
>>
>>   void qmp_system_wakeup(Error **errp)
>>   {
>> -    qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
>> +    if (!qemu_wakeup_suspend_support()) {
>> +        error_setg(errp,
>> +                   "wake-up from suspend is not supported by this guest");
>> +        return;
>> +    }
>> +    if (!runstate_check(RUN_STATE_SUSPENDED)) {
>> +        error_setg(errp,
>> +                   "Unable to wake up: guest is not in suspended state");
>> +        return;
>> +    }
>>   }
> Was removing qemu_system_wakeup_request() intentional or did that just get
> lost somehow?

WOW! That was a mistake! Thanks for spotting it Mike! I'll re-insert it back
in the next spin.

>
>>   ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
>> diff --git a/vl.c b/vl.c
>> index 96ad448d57..2af10b75cb 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -1769,7 +1769,7 @@ void qemu_register_wakeup_notifier(Notifier *notifier)
>>       notifier_list_add(&wakeup_notifiers, notifier);
>>   }
>>
>> -static bool qemu_wakeup_suspend_support(void)
>> +bool qemu_wakeup_suspend_support(void)
>>   {
>>       return !QLIST_EMPTY(&wakeup_notifiers.notifiers) && acpi_enabled;
>>   }
>> -- 
>> 2.17.1
>>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v8 1/3] qmp: query-current-machine with wakeup-suspend-support
  2018-09-06  0:21   ` Michael Roth
@ 2018-09-06 12:53     ` Daniel Henrique Barboza
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Henrique Barboza @ 2018-09-06 12:53 UTC (permalink / raw)
  To: Michael Roth, qemu-devel; +Cc: ehabkost, armbru



On 09/05/2018 09:21 PM, Michael Roth wrote:
> Quoting Daniel Henrique Barboza (2018-07-05 15:08:11)
>> When issuing the qmp/hmp 'system_wakeup' command, what happens in a
>> nutshell is:
>>
>> - qmp_system_wakeup_request set runstate to RUNNING, sets a wakeup_reason
>> and notify the event
>> - in the main_loop, all vcpus are paused, a system reset is issued, all
>> subscribers of wakeup_notifiers receives a notification, vcpus are then
>> resumed and the wake up QAPI event is fired
>>
>> Note that this procedure alone doesn't ensure that the guest will awake
>> from SUSPENDED state - the subscribers of the wake up event must take
>> action to resume the guest, otherwise the guest will simply reboot.
>>
>> At this moment, there are only two subscribers of the wake up event: one
>> in hw/acpi/core.c and another in hw/i386/xen/xen-hvm.c. This means
>> that system_wakeup does not work as intended with other architectures.
>>
>> However, only the presence of 'system_wakeup' is required for QGA to
>> support 'guest-suspend-ram' and 'guest-suspend-hybrid' at this moment.
>> This means that the user/management will expect to suspend the guest using
>> one of those suspend commands and then resume execution using system_wakeup,
>> regardless of the support offered in system_wakeup in the first place.
>>
>> This patch creates a new API called query-current-machine [1], that holds
>> a new flag called 'wakeup-suspend-support', which indicates if the guest
>> supports wake up from suspend via system_wakeup. The guest is considered
>> to implement wake-up support if:
>>
>> - there is at least one subscriber for the wake up event;
>>
>> and, for the PC machine type:
>>
>> - ACPI is enabled.
>>
>> This is the expected output of query-current-machine when running a x86
>> guest:
>>
>> {"execute" : "query-current-machine"}
>> {"return": {"wakeup-suspend-support": true}}
>>
>> Running the same x86 guest, but with the --no-acpi option:
>>
>> {"execute" : "query-current-machine"}
>> {"return": {"wakeup-suspend-support": false}}
>>
>> This is the output when running a pseries guest:
>>
>> {"execute" : "query-current-machine"}
>> {"return": {"wakeup-suspend-support": false}}
>>
>> With this extra tool, management can avoid situations where a guest
>> that does not have proper suspend/wake capabilities ends up in
>> inconsistent state (e.g.
>> https://github.com/open-power-host-os/qemu/issues/31).
>>
>> [1] the decision of creating the query-current-machine API is based
>> on discussions in the QEMU mailing list where it was decided that
>> query-target wasn't a proper place to store the wake-up flag, neither
>> was query-machines because this isn't a static property of the
>> machine object. This new API can then be used to store other
>> dynamic machine properties that are scattered around the code
>> ATM. More info at:
>> https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg04235.html
>>
>> Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
>> ---
>>   qapi/misc.json | 24 ++++++++++++++++++++++++
>>   vl.c           | 30 ++++++++++++++++++++++++++++++
>>   2 files changed, 54 insertions(+)
>>
>> diff --git a/qapi/misc.json b/qapi/misc.json
>> index 29da7856e3..266f88cb09 100644
>> --- a/qapi/misc.json
>> +++ b/qapi/misc.json
>> @@ -2003,6 +2003,30 @@
>>   ##
>>   { 'command': 'query-machines', 'returns': ['MachineInfo'] }
>>
>> +##
>> +# @CurrentMachineParams:
>> +#
>> +# Information describing the running machine parameters.
>> +#
>> +# @wakeup-suspend-support: true if the target supports wake up from
>> +#                          suspend
>> +#
>> +# Since: 3.0.0
> 3.1.0 now (hopefully :))
>
>> +##
>> +{ 'struct': 'CurrentMachineParams',
>> +  'data': { 'wakeup-suspend-support': 'bool'} }
>> +
>> +##
>> +# @query-current-machine:
>> +#
>> +# Return a list of parameters of the running machine.
>> +#
>> +# Returns: CurrentMachineParams
>> +#
>> +# Since: 3.0.0
>> +##
>> +{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
>> +
>>   ##
>>   # @CpuDefinitionInfo:
>>   #
>> diff --git a/vl.c b/vl.c
>> index ef6cfcec40..96ad448d57 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -1747,11 +1747,41 @@ void qemu_system_wakeup_enable(WakeupReason reason, bool enabled)
>>       }
>>   }
>>
>> +/*
>> + * The existence of a wake-up notifier is being checked in the function
>> + * qemu_wakeup_suspend_support and it's used in the logic of the
>> + * wakeup-suspend-support flag of QMP 'query-current-machine' command.
>> + * The idea of this flag is to indicate whether the guest supports wake-up
>> + * from suspend (via system_wakeup QMP/HMP call for example), warning the
>> + * user that the guest can't handle both wake-up from suspend and the
>> + * suspend itself via QGA guest-suspend-ram and guest-suspend-hybrid (if
>> + * it can't wake up, it can't be suspended safely).
>> + *
>> + * An assumption is made by the wakeup-suspend-support flag that only the
>> + * guests that can go to RUN_STATE_SUSPENDED and wake up properly would
>> + * be interested in this wakeup_notifier. Adding a wakeup_notifier for
>> + * any other reason will break the logic of the wakeup-suspend-support
>> + * flag and can lead to user/management confusion about the suspend/wake-up
>> + * support of the guest.
>> + */
>>   void qemu_register_wakeup_notifier(Notifier *notifier)
>>   {
>>       notifier_list_add(&wakeup_notifiers, notifier);
>>   }
>>
>> +static bool qemu_wakeup_suspend_support(void)
>> +{
>> +    return !QLIST_EMPTY(&wakeup_notifiers.notifiers) && acpi_enabled;
>> +}
> I think this would need to be re-worked for any machine types that
> eventually implement wakeup even though acpi_enabled == false. It was
> maybe a bit hacky, but kind of nice that registering a wakeup notifier
> implicitly registered support for wakeup, but now that we already have
> these sorts of edge cases to consider maybe it's best to just add an
> explicit qemu_register_wakeup_support() that just sets a flag in
> vl.c and add call that at the appropriate locations for known supported
> configurations. Maybe one call in acpi_pm1_cnt_init() might be enough?

I like the idea of qemu_register_wakeup_support(). This avoids
overloading the existing wakeup_notifiers with an extra assumption
like I am doing up there. New implementations will need to call
this register function to let the new API aware of the support, but
I don't see it as a huge deal.

>
> Though I'm noticing mips malta board also calls that, would be curious
> if that actually supports wake-from-suspend. If not, maybe the callers
> are where we should declare support (ich9_pm_init and piix4_pm_realize
> currently)?
>
>> +
>> +CurrentMachineParams *qmp_query_current_machine(Error **errp)
>> +{
>> +    CurrentMachineParams *params = g_malloc0(sizeof(*params));
>> +    params->wakeup_suspend_support = qemu_wakeup_suspend_support();
>> +
>> +    return params;
>> +}
>> +
>>   void qemu_system_killed(int signal, pid_t pid)
>>   {
>>       shutdown_signal = signal;
>> -- 
>> 2.17.1
>>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-09-06 12:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-05 20:08 [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes Daniel Henrique Barboza
2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 1/3] qmp: query-current-machine with wakeup-suspend-support Daniel Henrique Barboza
2018-09-06  0:21   ` Michael Roth
2018-09-06 12:53     ` Daniel Henrique Barboza
2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 2/3] qga: update guest-suspend-ram and guest-suspend-hybrid descriptions Daniel Henrique Barboza
2018-07-05 20:08 ` [Qemu-devel] [PATCH v8 3/3] qmp hmp: Make system_wakeup check wake-up support and run state Daniel Henrique Barboza
2018-09-06  0:27   ` Michael Roth
2018-09-06 10:54     ` Daniel Henrique Barboza
2018-07-30 18:50 ` [Qemu-devel] [PATCH v8 0/3] wakeup-from-suspend and system_wakeup changes Daniel Henrique Barboza
2018-08-28 19:55 ` Daniel Henrique Barboza

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.