From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d46zS-0003K2-2v for qemu-devel@nongnu.org; Fri, 28 Apr 2017 10:35:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d46zO-0001nQ-3i for qemu-devel@nongnu.org; Fri, 28 Apr 2017 10:35:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39450) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d46zN-0001n0-Q1 for qemu-devel@nongnu.org; Fri, 28 Apr 2017 10:35:18 -0400 References: <20170428021317.24711-1-eblake@redhat.com> <20170428021317.24711-3-eblake@redhat.com> <20170428080821.GB2085@work-vm> From: Eric Blake Message-ID: <3a8d9f68-f30c-1191-ca80-a93f0050f011@redhat.com> Date: Fri, 28 Apr 2017 09:35:04 -0500 MIME-Version: 1.0 In-Reply-To: <20170428080821.GB2085@work-vm> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hMdpRTDDJbeuwVRvOHPbE9RdSuJpujBxr" Subject: Re: [Qemu-devel] [PATCH v5 2/4] shutdown: Prepare for use of an enum in reset/shutdown_request List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hMdpRTDDJbeuwVRvOHPbE9RdSuJpujBxr 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> Content-Type: text/plain; charset=utf-8 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 --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--