From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH RESEND 1/1] qmp.c: system_wakeup: adding RUN_STATE_SUSPENDED check before proceeding
Date: Tue, 2 Jan 2018 18:39:45 -0200 [thread overview]
Message-ID: <5bfd4a4e-26d9-8595-fc30-43c54b9f6bad@linux.vnet.ibm.com> (raw)
In-Reply-To: <ece03c18-76c3-294d-9c2a-778a23e8d9b4@redhat.com>
On 01/02/2018 06:03 PM, Eric Blake wrote:
> On 01/02/2018 11:06 AM, Daniel Henrique Barboza wrote:
>> 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.
>>
>> This leads to situations such as the one described in
>> https://github.com/open-power-host-os/qemu/issues/31, where one
>> can induce the OS to be suspended by using pm-suspend (via
>> dompmsuspend, for example) but for some reason the machine failed to
>> go to the SUSPENDED runstate, staying at runstate RUNNING. The user
>> then tries to wake up the guest using system_wakeup (or dompmwakeup),
>> no error is thrown but nothing happened either because the wake up
>> wasn't fired at all. In the end, the user is left with a guest that
>> is dormant and believing that system_wakeup isn't working.
>>
>> This patch changes qmp_system_wakeup to 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. The change isn't made inside
>> qemu_system_wakeup_request because it is used in migration,
>> ACPI and others where this usage might be valid. This patch
>> by no means fixes the situation described above, but it can direct
>> the user/management closer to the real problem.
> Converting something that silently did nothing successfully into now
> returning an error is somewhat backwards-incompatible. Is this
> something that needs to go through a deprecation cycle, to give people a
> chance to fix QMP scripts that were relying on the previous no-op
> behavior to now work with the new semantics? Or should we add an
> optional bool parameter to the command, where omitting the parameter
> gives the old semantics, but new enough clients can pass the bool to
> choose which behavior (no-op or error) they prefer?
Good point. Back when I first coded this patch I made sure that no QEMU test
were broken, but I didn't consider that existing user scripts that uses
system_wakeup might now yield a different result.
The extra optional parameter seems a good approach to take here IMO. The
current system_wakeup implementation works fine if the user is careful
enough to not call it if the guest isn't on SUSPENDED state, so I am unsure
if deprecating this behavior in favor of this new one is a bit too extreme.
Thanks,
Daniel
>
>> +++ b/qmp.c
>> @@ -201,6 +201,11 @@ void qmp_cont(Error **errp)
>>
>> void qmp_system_wakeup(Error **errp)
>> {
>> + if (!runstate_check(RUN_STATE_SUSPENDED)) {
>> + error_setg(errp,
>> + "Unable to wake up: guest is not in suspended state");
>> + return;
>> + }
>> qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
>> }
>>
>>
next prev parent reply other threads:[~2018-01-02 20:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-02 17:06 [Qemu-devel] [PATCH RESEND 1/1] qmp.c: system_wakeup: adding RUN_STATE_SUSPENDED check before proceeding Daniel Henrique Barboza
2018-01-02 20:03 ` Eric Blake
2018-01-02 20:39 ` Daniel Henrique Barboza [this message]
2018-01-03 13:41 ` Markus Armbruster
2018-01-03 15:52 ` Daniel Henrique Barboza
2018-01-22 9:29 ` Daniel Henrique Barboza
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5bfd4a4e-26d9-8595-fc30-43c54b9f6bad@linux.vnet.ibm.com \
--to=danielhb@linux.vnet.ibm.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).