All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Gonglei <arei.gonglei@hotmail.com>,
	'Peter Maydell' <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org
Cc: "'Paolo Bonzini'" <pbonzini@redhat.com>,
	"'Alex Bennée'" <alex.bennee@linaro.org>,
	"'Stefan Hajnoczi'" <stefanha@redhat.com>,
	patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] main-loop.c: Handle SIGINT, SIGHUP and SIGTERM synchronously
Date: Sat, 25 Oct 2014 14:08:19 +0200	[thread overview]
Message-ID: <544B92B3.3060203@web.de> (raw)
In-Reply-To: <BLU437-SMTP3241424F5757A44B72D97A9F900@phx.gbl>

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

On 2014-10-25 13:34, Gonglei wrote:
> Hi,
> 
>> Subject: [Qemu-devel] [PATCH] main-loop.c: Handle SIGINT, SIGHUP and
>> SIGTERM synchronously
>>
>> Add the termination signals SIGINT, SIGHUP and SIGTERM to the
>> list of signals which we handle synchronously via a signalfd.
>> This avoids a race condition where if we took the SIGTERM
>> in the middle of qemu_shutdown_requested:
>>     int r = shutdown_requested;
>> [SIGTERM here...]
>>     shutdown_requested = 0;
>>
>> then the setting of the shutdown_requested flag by
>> termsig_handler() would be lost and QEMU would fail to
>> shut down. This was causing 'make check' to hang occasionally.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> 
> I met a really upset thing after this patch, which I can't using gdb debug
> Qemu process well. I use gdb attaching a Qemu process, and press 'c' to continue
> executing. When I want to set a breakpoint for debugging, then press 'ctrl + c',
> the Qemu will exit, because the SIGINT signal is captured by Qemu now. :(
> 
> What's your opinion? Thanks.

Confirmed, you cannot interrupt a running qemu from gdb anymore.

I think this patch has to be reverted and the original issue fixed by
making qemu_shutdown_requested signal-safe. Should be simple, just
convert shutdown_requested into a counter. Need not be atomic, all
happens over the main thread anyway.

Jan


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

      reply	other threads:[~2014-10-25 12:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25 15:51 [Qemu-devel] [PATCH] main-loop.c: Handle SIGINT, SIGHUP and SIGTERM synchronously Peter Maydell
2014-09-25 15:54 ` Paolo Bonzini
2014-09-26 10:37 ` Alex Bennée
2014-09-26 11:25   ` Peter Maydell
2014-10-25 11:34 ` Gonglei
2014-10-25 12:08   ` Jan Kiszka [this message]

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=544B92B3.3060203@web.de \
    --to=jan.kiszka@web.de \
    --cc=alex.bennee@linaro.org \
    --cc=arei.gonglei@hotmail.com \
    --cc=patches@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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.