On Fri, May 18, 2018 at 10:48:31AM +0200, Markus Armbruster wrote:
Cc'ing a few more people.
Daniel Henrique Barboza <danielhb(a)linux.ibm.com> writes:
> 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 one 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 adds a new flag called 'wakeup-suspend-support' in TargetInfo
> that allows the caller to query if the guest supports wake up from
> suspend via system_wakeup. It goes over the subscribers of the wake up
> event and, if it's empty, it assumes that the guest does not support
> wake up from suspend (and thus, pm-suspend itself).
>
> This is the expected output of query-target when running a x86 guest:
>
> {"execute" : "query-target"}
> {"return": {"arch": "x86_64",
"wakeup-suspend-support": true}}
>
> This is the output when running a pseries guest:
>
> {"execute" : "query-target"}
> {"return": {"arch": "ppc64",
"wakeup-suspend-support": false}}
>
> Given that the TargetInfo structure is read-only, adding a new flag to
> it is backwards compatible. There is no need to deprecate the old
> TargetInfo format.
>
> 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).
>
> Reported-by: Balamuruhan S <bala24(a)linux.vnet.ibm.com>
> Signed-off-by: Daniel Henrique Barboza <danielhb(a)linux.ibm.com>
Is query-target is the right place to carry this flag? v7 is rather
late for this kind of question; my sincere apologies.
[...]
Issue#2: the flag isn't a property of the target. Due to -no-acpi, it's
not even a property of the machine type. If it was, query-machines
would be the natural owner of the flag.
Perhaps query-machines is still the proper owner. The value of
wakeup-suspend-support would have to depend on -no-acpi for the machine
types that honor it. Not ideal; I'd prefer MachineInfo to be static.
Tolerable? I guess that's also a libvirt question.
It depends when libvirt is going to query it. Is it OK to only
query it after the VM is already up and running? If it is, then
we can simply expose it as a read-only property of the machine
object.
Or, if we don't want to rely on qom-get as a stable API, we can
add a new query command (query-machine? query-power-management?)
--
Eduardo