qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	qemu-stable <qemu-stable@nongnu.org>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	Gonglei <arei.gonglei@hotmail.com>
Subject: Re: [Qemu-devel] [PATCH] Make qemu_shutdown_requested signal-safe
Date: Mon, 27 Oct 2014 10:09:40 +0100	[thread overview]
Message-ID: <544E0BD4.9010803@redhat.com> (raw)
In-Reply-To: <544CBFA1.1090108@web.de>

On 10/26/2014 10:32 AM, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> qemu_shutdown_requested may be interrupted by qemu_system_killed. 
> If the latter sets shutdown_requested after qemu_shutdown_requested
> has read it but before it was cleared, the shutdown event is lost.
> Fix this by using atomic_xchg.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> --- vl.c | 4 
> +--- 1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/vl.c b/vl.c index 2f81384..f6b3546 100644 --- a/vl.c 
> +++ b/vl.c @@ -1609,9 +1609,7 @@ int 
> qemu_reset_requested_get(void)
> 
> static int qemu_shutdown_requested(void) { -    int r = 
> shutdown_requested; -    shutdown_requested = 0; -    return r; + 
> return atomic_xchg(&shutdown_requested, 0); }
> 
> static void qemu_kill_report(void)
> 

Cc: qemu-stable@nongnu.org
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Are you going to send a pull request yourself?

  parent reply	other threads:[~2014-10-27  9:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26  9:32 [Qemu-devel] [PATCH] Make qemu_shutdown_requested signal-safe Jan Kiszka
2014-10-26  9:43 ` Gonglei
2014-10-27  9:09 ` Paolo Bonzini [this message]
2014-10-27  9:11   ` Jan Kiszka

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