From: Gonglei <arei.gonglei@huawei.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
qemu-devel <qemu-devel@nongnu.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
Gonglei <arei.gonglei@hotmail.com>
Subject: Re: [Qemu-devel] [PATCH] Make qemu_shutdown_requested signal-safe
Date: Sun, 26 Oct 2014 17:43:28 +0800 [thread overview]
Message-ID: <544CC240.8020508@huawei.com> (raw)
In-Reply-To: <544CBFA1.1090108@web.de>
On 2014/10/26 17:32, 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)
Looks good to me, so
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Best regards,
-Gonglei
next prev parent reply other threads:[~2014-10-26 9:45 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 [this message]
2014-10-27 9:09 ` Paolo Bonzini
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=544CC240.8020508@huawei.com \
--to=arei.gonglei@huawei.com \
--cc=alex.bennee@linaro.org \
--cc=arei.gonglei@hotmail.com \
--cc=jan.kiszka@web.de \
--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 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).