From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
"open list:Overall" <kvm@vger.kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org, Scott Wood <scottwood@freescale.com>,
Gerd Hoffmann <kraxel@redhat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Rob Herring <robh@kernel.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Magnus Damm <magnus.damm@gmail.com>,
Alexander Graf <agraf@suse.de>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Anthony Perard <anthony.perard@citrix.com>,
"open list:X86" <xen-devel@lists.xenproject.org>,
Richard Henderson <rth@twiddle.net>,
Artyom Tarasenko <atar4qemu@gmail.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Stefan Weil <sw@weilnetz.de>,
Alistair Francis <alistair.francis@xilinx.com>,
"open list:Calxeda Highbank" <qemu-arm@nongnu.org>,
Jan Kiszka <jan.kiszka@web.de>
Subject: Re: [Qemu-devel] [PATCH v2] event: Add source information to SHUTDOWN
Date: Thu, 20 Apr 2017 18:18:26 +0200 [thread overview]
Message-ID: <87lgqv833h.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1adf2797-b86a-00be-bb98-658ee8d0a55d@redhat.com> (Eric Blake's message of "Thu, 20 Apr 2017 08:31:13 -0500")
Eric Blake <eblake@redhat.com> writes:
> On 04/20/2017 06:59 AM, Markus Armbruster wrote:
>
>>
>> No objection to Alistair's idea to turn this into an enumeration.
>
> Question - should the enum be more than just 'guest' and 'host'? For
> example, my patch proves that we have a lot of places that handle
> complimentary machine commands to reset and shutdown, and that whether
> 'reset' triggers a reset (and the guest keeps running as if rebooted) or
> a shutdown is then based on the command-line arguments given to qemu.
> So having the enum differentiate between 'guest-reset' and
> 'guest-shutdown' would be a possibility, if we want the enum to have
> additional states.
I don't know. What I do know is that we better get the enum right:
while adding members is backwards-compatible, changing the member sent
for a specific trigger is not. If we want to reserve the option to do
that anyway, we need suitable documentation.
>>> +++ b/vl.c
>>> @@ -1717,7 +1717,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
>>> if (!no_shutdown) {
>>> qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF,
>>> !!info, info, &error_abort);
>>> - qemu_system_shutdown_request();
>>> + qemu_system_shutdown_request(false);
>>
>> Panicking is a guest action. Whether the shutdown on panic should be
>> attributed to guest or host is perhaps debatable.
>
> And it relates to the idea that a guest request for a 'reset' turns into
> a qemu response of 'shutdown'. After all, whether a guest panic results
> in a shutdown action is determined by command-line arguments to qemu.
> So if we DO want to differentiate between a guest panic and a normal
> guest shutdown, when both events are wired at the command line to cause
> the SHUTDOWN action, then that's another enum to add to my list.
>
>
>>> +++ b/replay/replay.c
>>> @@ -51,7 +51,10 @@ bool replay_next_event_is(int event)
>>> switch (replay_state.data_kind) {
>>> case EVENT_SHUTDOWN:
>>> replay_finish_event();
>>> - qemu_system_shutdown_request();
>>> + /* TODO: track source of shutdown request, to replay a
>>> + * guest-initiated request rather than always claiming to
>>> + * be from the host? */
>>> + qemu_system_shutdown_request(false);
>>
>> This is what your "need a followup patch" refers to. I'd like to have
>> an opinion from someone familiar with replay on what exactly we need
>> here.
>
> replay-internal.h has an enum ReplayEvents, which is a list of one-byte
> codes used in the replay data stream to record which event to replay. I
> don't know if it is easier to change the replay stream to add a 2-byte
> code (shutdown-with-cause, followed by an encoding of the cause enum),
> or a range of one-byte codes (one new code per number of enum members).
> I also don't know how easy or hard it is to extend the enum (are we free
> to add events in the middle, or are we worried about back-compat to an
> older replay stream that must still play correctly with a newer qemu,
> such that new events must be higher than all existing events).
>
> So yes, I'm hoping for feedback from someone familiar with replay.
>
>>
>> Amazing number of ways to shut down or reset a machine.
>
> And as I said, it would be easier to submit a patch with less churn by
> having the uncommon case (host-triggered) call a new
> qemu_system_shutdown_request_reason(enum), while the common case
> (guest-triggered) be handled by having qemu_system_shutdown_request()
> with no arguments call
> qemu_system_shutdown_request_reason(SHUTDOWN_GUEST). I'm just worried
> that doing it that way makes it easy for yet another new host shutdown
> method to use the wrong wrapper.
I don't mind the churn. It does simplify review.
>> Looks sane on first glance.
>>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-04-20 16:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 22:22 [PATCH v2] event: Add source information to SHUTDOWN Eric Blake
2017-04-19 22:36 ` [Qemu-devel] " Alistair Francis
2017-04-20 1:11 ` Eric Blake
2017-04-20 11:59 ` Markus Armbruster
2017-04-20 12:09 ` Daniel P. Berrange
2017-04-20 13:20 ` Eric Blake
2017-04-20 16:12 ` Markus Armbruster
2017-04-20 18:12 ` Eric Blake
2017-04-20 13:31 ` Eric Blake
2017-04-20 16:18 ` Markus Armbruster [this message]
2017-04-20 19:05 ` Eric Blake
2017-04-20 22:55 ` Alistair Francis
2017-04-20 20:28 ` Eric Blake
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=87lgqv833h.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=agraf@suse.de \
--cc=alistair.francis@xilinx.com \
--cc=anthony.perard@citrix.com \
--cc=atar4qemu@gmail.com \
--cc=borntraeger@de.ibm.com \
--cc=eblake@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=jan.kiszka@web.de \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=robh@kernel.org \
--cc=rth@twiddle.net \
--cc=scottwood@freescale.com \
--cc=sstabellini@kernel.org \
--cc=sw@weilnetz.de \
--cc=xen-devel@lists.xenproject.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