From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org, Stefan Weil <sw@weilnetz.de>
Subject: Re: [Qemu-devel] [PATCH] event: Add signal information to SHUTDOWN
Date: Wed, 12 Apr 2017 09:03:54 -0500 [thread overview]
Message-ID: <480c1dd8-fcd1-212c-a2c0-8170da3a7629@redhat.com> (raw)
In-Reply-To: <87vaq97mxf.fsf@dusky.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 2617 bytes --]
On 04/12/2017 08:52 AM, Markus Armbruster wrote:
>>> In other words, these three signals are polite requests to terminate
>>> QEMU.
>>>
>>> Stefan, are there equivalent requests under Windows? I guess there
>>> might be one at least for SIGINT, namely whatever happens when you hit
>>> ^C on the console.
>>
>> Mingw has SIGINT (C99 requires it), and that's presumably what happens
>> for ^C,...
>>
>>>
>>> Could we arrange to run qemu_system_killed() then?
>>
>> ...but I don't know why it is not currently wired up to call
>> qemu_system_killed(), nor do I have enough Windows programming expertise
>> to try and write such a patch. But I think that is an orthogonal
>> improvement. On the other hand, mingw has a definition for SIGTERM (but
>> I'm not sure how it gets triggered) and no definition at all for SIGHUP
>> (as evidenced by the #ifdef'fery in the patch to get it to compile under
>> docker targetting mingw).
>
> If all we need is distingishing host- and guest-initiated shutdown, then
> detecting the latter reliably lets us stay away from OS-specific stuff.
> Can we do that?
I'll simplify what I can; I still can't guarantee that mingw will be
setting the bool correctly in all cases, but setting a bool is easier
than trying to set a signal name.
>> There are other reasons too: a guest can request shutdown immediately
>> before the host sends SIGINT. Based on when things are processed, you
>> could see either the guest or the host as the initiator. And the race
>> is not entirely implausible - when trying to shut down a guest, libvirt
>> first tries to inform the guest to initiate things (whether by interrupt
>> or guest agent), but after a given amount of time, assumes the guest is
>> unresponsive and resorts to a signal to qemu. A heavily loaded guest
>> that takes its time in responding could easily overlap with the timeout
>> resorting to a host-side action.
>
> This race doesn't worry me. If both host and guest have initiated a
> shutdown, then reporting whichever of the two finishes first seems fair.
So maybe I just tone down the docs and not even mention it.
>
> Additional ways to terminate QEMU: HMP and QMP command "quit", and the
> various GUI controls such "close SDL window".
Good points. I have no idea what exit path those take (if they
raise(SIGINT) internally, it's quite easy - but if they go through some
other exit path, then I'll need to wire in something else).
--
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 --]
next prev parent reply other threads:[~2017-04-12 14:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 21:09 [Qemu-devel] [PATCH] event: Add signal information to SHUTDOWN Eric Blake
2017-04-07 9:35 ` Daniel P. Berrange
2017-04-07 13:45 ` Eric Blake
2017-04-13 6:04 ` Paolo Bonzini
2017-04-12 11:02 ` Markus Armbruster
2017-04-12 11:05 ` Daniel P. Berrange
2017-04-12 13:15 ` Eric Blake
2017-04-12 13:52 ` Markus Armbruster
2017-04-12 14:03 ` Eric Blake [this message]
2017-04-12 14:33 ` Markus Armbruster
2017-04-12 14:48 ` Eric Blake
2017-04-13 6:11 ` Paolo Bonzini
2017-04-13 6:11 ` Paolo Bonzini
2017-04-13 7:30 ` Markus Armbruster
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=480c1dd8-fcd1-212c-a2c0-8170da3a7629@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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).