From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Blake 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 Message-ID: <3a8d9f68-f30c-1191-ca80-a93f0050f011@redhat.com> References: <20170428021317.24711-1-eblake@redhat.com> <20170428021317.24711-3-eblake@redhat.com> <20170428080821.GB2085@work-vm> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2313942355726620529==" Return-path: Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d47HZ-0003Ej-A2 for xen-devel@lists.xenproject.org; Fri, 28 Apr 2017 14:54:05 +0000 In-Reply-To: <20170428080821.GB2085@work-vm> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: "Dr. David Alan Gilbert" Cc: Stefano Stabellini , berrange@redhat.com, Eduardo Habkost , "Michael S. Tsirkin" , armbru@redhat.com, Juan Quintela , qemu-devel@nongnu.org, alistair.francis@xilinx.com, zhanghailiang , "open list:X86" , Anthony Perard , Paolo Bonzini , Richard Henderson List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============2313942355726620529== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hMdpRTDDJbeuwVRvOHPbE9RdSuJpujBxr" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hMdpRTDDJbeuwVRvOHPbE9RdSuJpujBxr Content-Type: multipart/mixed; boundary="UtGrFWKAFveRTK6rLPBvMV5U4IsskJQAd"; protected-headers="v1" From: Eric Blake To: "Dr. David Alan Gilbert" Cc: qemu-devel@nongnu.org, armbru@redhat.com, berrange@redhat.com, alistair.francis@xilinx.com, Stefano Stabellini , Anthony Perard , "Michael S. Tsirkin" , Paolo Bonzini , Richard Henderson , Eduardo Habkost , zhanghailiang , Juan Quintela , "open list:X86" Message-ID: <3a8d9f68-f30c-1191-ca80-a93f0050f011@redhat.com> Subject: Re: [PATCH v5 2/4] shutdown: Prepare for use of an enum in reset/shutdown_request References: <20170428021317.24711-1-eblake@redhat.com> <20170428021317.24711-3-eblake@redhat.com> <20170428080821.GB2085@work-vm> In-Reply-To: <20170428080821.GB2085@work-vm> --UtGrFWKAFveRTK6rLPBvMV5U4IsskJQAd Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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 o= r >> +# 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 >=20 > It's a little coarse grained; is there anyway to pass platform specifi= c information > for debug? I ask because I spent a while debugging a few bugs with une= xpected > 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. --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --UtGrFWKAFveRTK6rLPBvMV5U4IsskJQAd-- --hMdpRTDDJbeuwVRvOHPbE9RdSuJpujBxr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJZA1MYAAoJEKeha0olJ0NqC7UIAKsxmtLiSvvwjrUuvuYOolZ4 Qp5aZmWeNAFn1lOGmh0tt12iRhmKPbp7bEZR9Auu1VsgIXC1lodO4ps45igNpeE8 3aAc+vR8oC65c8Pvw6whIxcv8bwqDDs3hTD89sk+gW2VE7nAhuyFtzIUnfYdgNKq z90jp8pZ50GsEgw/dVFWiCyvyIq0ADjZzeuTVqZgrRc6Uz9BHP1iF615LnwftTia gkeRn0YwupXvVjYhpJ6JpKd7ZmerjP9B42nyJrvD6CmAJ42y7A6pm4sQrFS8qQsr VgRrGOhFh5wScT60JyqmbkfXrV22Tl3lvWxjj70uOA/IR61UW9TCVi2GjxDYIMU= =fpRb -----END PGP SIGNATURE----- --hMdpRTDDJbeuwVRvOHPbE9RdSuJpujBxr-- --===============2313942355726620529== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============2313942355726620529==--