All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, armbru@redhat.com, berrange@redhat.com,
	alistair.francis@xilinx.com,
	Stefano Stabellini <sstabellini@kernel.org>,
	Anthony Perard <anthony.perard@citrix.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	Juan Quintela <quintela@redhat.com>,
	"open list:X86" <xen-devel@lists.xenproject.org>
Subject: Re: [Qemu-devel] [PATCH v5 2/4] shutdown: Prepare for use of an enum in reset/shutdown_request
Date: Fri, 28 Apr 2017 09:35:04 -0500	[thread overview]
Message-ID: <3a8d9f68-f30c-1191-ca80-a93f0050f011@redhat.com> (raw)
In-Reply-To: <20170428080821.GB2085@work-vm>

[-- Attachment #1: Type: text/plain, Size: 2594 bytes --]

On 04/28/2017 03:08 AM, Dr. David Alan Gilbert wrote:
> * Eric Blake (eblake@redhat.com) wrote:
>> We want to track why a guest was shutdown; in particular, being able
>> to tell the difference between a guest request (such as ACPI request)
>> and host request (such as SIGINT) will prove useful to libvirt.
>> Since all requests eventually end up changing shutdown_requested in
>> vl.c, the logical change is to make that value track the reason,
>> rather than its current 0/1 contents.
>>

>>  ##
>> +# @ShutdownCause:
>> +#
>> +# Enumeration of various causes for shutdown.
>> +#
>> +# @host-qmp: Reaction to a QMP command, such as 'quit'
>> +# @host-signal: Reaction to a signal, such as SIGINT
>> +# @host-ui: Reaction to a UI event, such as closing the window
>> +# @host-replay: The host is replaying an earlier shutdown event
>> +# @host-error: Qemu encountered an error that prevents further use of the guest
>> +# @guest-shutdown: The guest requested a shutdown, such as via ACPI or
>> +#                  other hardware-specific action
>> +# @guest-reset: The guest requested a reset, and the command line
>> +#               response to a reset is to instead trigger a shutdown
>> +# @guest-panic: The guest panicked, and the command line response to
>> +#               a panic is to trigger a shutdown
> 
> It's a little coarse grained;  is there anyway to pass platform specific information
> for debug?  I ask because I spent a while debugging a few bugs with unexpected
> resets and had to figure out which of x86's many reset causes triggered it.

I'm open to any followup patches that add further enum values and
adjusts the various callers (patch 3 shows how MANY callers use
qemu_system_shutdown_request).  But I don't think it's necessarily in
scope for this series - remember, my goal here was merely to distinguish
between host- and guest-triggered resets (which libvirt and higher
management tasks want to know), rather than which of multiple reset
paths was taken (I agree that it is useful during a qemu debug session -
but that's a different audience).  I also don't consider myself an
expert in the many ways that x86 can reset - it was easy to blindly
rewrite qemu_system_shutdown_request() into
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN) based solely
on directory, but it would be harder to distinguish which of the
multiple files should have which finer-grained cause.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Eric Blake <eblake@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	berrange@redhat.com, Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	armbru@redhat.com, Juan Quintela <quintela@redhat.com>,
	qemu-devel@nongnu.org, alistair.francis@xilinx.com,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	"open list:X86" <xen-devel@lists.xenproject.org>,
	Anthony Perard <anthony.perard@citrix.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v5 2/4] shutdown: Prepare for use of an enum in reset/shutdown_request
Date: Fri, 28 Apr 2017 09:35:04 -0500	[thread overview]
Message-ID: <3a8d9f68-f30c-1191-ca80-a93f0050f011@redhat.com> (raw)
In-Reply-To: <20170428080821.GB2085@work-vm>


[-- Attachment #1.1.1: Type: text/plain, Size: 2594 bytes --]

On 04/28/2017 03:08 AM, Dr. David Alan Gilbert wrote:
> * Eric Blake (eblake@redhat.com) wrote:
>> We want to track why a guest was shutdown; in particular, being able
>> to tell the difference between a guest request (such as ACPI request)
>> and host request (such as SIGINT) will prove useful to libvirt.
>> Since all requests eventually end up changing shutdown_requested in
>> vl.c, the logical change is to make that value track the reason,
>> rather than its current 0/1 contents.
>>

>>  ##
>> +# @ShutdownCause:
>> +#
>> +# Enumeration of various causes for shutdown.
>> +#
>> +# @host-qmp: Reaction to a QMP command, such as 'quit'
>> +# @host-signal: Reaction to a signal, such as SIGINT
>> +# @host-ui: Reaction to a UI event, such as closing the window
>> +# @host-replay: The host is replaying an earlier shutdown event
>> +# @host-error: Qemu encountered an error that prevents further use of the guest
>> +# @guest-shutdown: The guest requested a shutdown, such as via ACPI or
>> +#                  other hardware-specific action
>> +# @guest-reset: The guest requested a reset, and the command line
>> +#               response to a reset is to instead trigger a shutdown
>> +# @guest-panic: The guest panicked, and the command line response to
>> +#               a panic is to trigger a shutdown
> 
> It's a little coarse grained;  is there anyway to pass platform specific information
> for debug?  I ask because I spent a while debugging a few bugs with unexpected
> resets and had to figure out which of x86's many reset causes triggered it.

I'm open to any followup patches that add further enum values and
adjusts the various callers (patch 3 shows how MANY callers use
qemu_system_shutdown_request).  But I don't think it's necessarily in
scope for this series - remember, my goal here was merely to distinguish
between host- and guest-triggered resets (which libvirt and higher
management tasks want to know), rather than which of multiple reset
paths was taken (I agree that it is useful during a qemu debug session -
but that's a different audience).  I also don't consider myself an
expert in the many ways that x86 can reset - it was easy to blindly
rewrite qemu_system_shutdown_request() into
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN) based solely
on directory, but it would be harder to distinguish which of the
multiple files should have which finer-grained cause.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-04-28 14:35 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28  2:13 [Qemu-devel] [PATCH v5 0/4] event: Add source information to SHUTDOWN Eric Blake
2017-04-28  2:13 ` [Qemu-devel] [PATCH v5 1/4] shutdown: Simplify shutdown_signal Eric Blake
2017-04-28 14:42   ` Markus Armbruster
2017-04-28  2:13 ` [Qemu-devel] [PATCH v5 2/4] shutdown: Prepare for use of an enum in reset/shutdown_request Eric Blake
2017-04-28  2:13   ` Eric Blake
2017-04-28  8:08   ` [Qemu-devel] " Dr. David Alan Gilbert
2017-04-28  8:08     ` Dr. David Alan Gilbert
2017-04-28 14:35     ` Eric Blake [this message]
2017-04-28 14:35       ` Eric Blake
2017-04-28 15:27       ` [Qemu-devel] " Dr. David Alan Gilbert
2017-04-28 15:27         ` Dr. David Alan Gilbert
2017-04-28 15:57         ` [Qemu-devel] " Eric Blake
2017-04-28 15:57           ` Eric Blake
2017-04-28 16:09           ` [Qemu-devel] " Dr. David Alan Gilbert
2017-04-28 16:09             ` Dr. David Alan Gilbert
2017-04-28 18:05             ` [Qemu-devel] " Eric Blake
2017-04-28 18:05               ` Eric Blake
2017-04-28 18:13               ` [Qemu-devel] " Dr. David Alan Gilbert
2017-04-28 18:13                 ` Dr. David Alan Gilbert
2017-04-28 14:45     ` [Qemu-devel] " Markus Armbruster
2017-04-28 14:45       ` Markus Armbruster
2017-04-28 14:42   ` Markus Armbruster
2017-04-28 14:42     ` Markus Armbruster
2017-04-28 22:34     ` Eric Blake
2017-04-28 22:34       ` Eric Blake
2017-05-02 11:47       ` Markus Armbruster
2017-05-02 11:47         ` Markus Armbruster
2017-04-28  2:13 ` [PATCH v5 3/4] shutdown: Add source information to SHUTDOWN and RESET Eric Blake
2017-04-28  2:13 ` Eric Blake
2017-04-28  2:13   ` [Qemu-devel] " Eric Blake
2017-04-28 15:01   ` Markus Armbruster
2017-04-28 15:01     ` Markus Armbruster
2017-04-28 22:44     ` [Qemu-devel] replay help [was: [PATCH v5 3/4] shutdown: Add source information to SHUTDOWN and RESET] Eric Blake
2017-05-02 10:54       ` Pavel Dovgalyuk
2017-05-02  8:13     ` [Qemu-devel] [PATCH v5 3/4] shutdown: Add source information to SHUTDOWN and RESET Pavel Dovgalyuk
2017-05-02  8:13       ` Pavel Dovgalyuk
2017-05-02  8:13     ` Pavel Dovgalyuk
2017-04-28 15:01   ` Markus Armbruster
2017-05-01  3:58   ` David Gibson
2017-05-01  3:58   ` David Gibson
2017-05-01  3:58     ` [Qemu-devel] " David Gibson
2017-05-05  8:36   ` Mark Cave-Ayland
2017-04-28  2:13 ` [Qemu-devel] [PATCH v5 4/4] RFC: shutdown: Expose full ShutdownCause across QMP Eric Blake
2017-04-28 22:48   ` 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=3a8d9f68-f30c-1191-ca80-a93f0050f011@redhat.com \
    --to=eblake@redhat.com \
    --cc=alistair.francis@xilinx.com \
    --cc=anthony.perard@citrix.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=zhang.zhanghailiang@huawei.com \
    /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 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.