From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XigLb-0004JD-T4 for qemu-devel@nongnu.org; Mon, 27 Oct 2014 05:12:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XigLW-0002pt-IQ for qemu-devel@nongnu.org; Mon, 27 Oct 2014 05:12:19 -0400 Message-ID: <544E0C55.8010109@web.de> Date: Mon, 27 Oct 2014 10:11:49 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <544CBFA1.1090108@web.de> <544E0BD4.9010803@redhat.com> In-Reply-To: <544E0BD4.9010803@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RILTs0cPpt6opawihpQfSJiLLPDwwS03v" Subject: Re: [Qemu-devel] [PATCH] Make qemu_shutdown_requested signal-safe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Peter Maydell , qemu-devel Cc: =?UTF-8?B?QWxleCBCZW5uw6ll?= , qemu-stable , Stefan Hajnoczi , Gonglei This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --RILTs0cPpt6opawihpQfSJiLLPDwwS03v Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2014-10-27 10:09, Paolo Bonzini wrote: > On 10/26/2014 10:32 AM, Jan Kiszka wrote: >> From: Jan Kiszka >> >> qemu_shutdown_requested may be interrupted by qemu_system_killed.=20 >> 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 --- vl.c | 4=20 >> +--- 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/vl.c b/vl.c index 2f81384..f6b3546 100644 --- a/vl.c=20 >> +++ b/vl.c @@ -1609,9 +1609,7 @@ int=20 >> qemu_reset_requested_get(void) >> >> static int qemu_shutdown_requested(void) { - int r =3D=20 >> shutdown_requested; - shutdown_requested =3D 0; - return r; +=20 >> return atomic_xchg(&shutdown_requested, 0); } >> >> static void qemu_kill_report(void) >> >=20 > Cc: qemu-stable@nongnu.org > Reviewed-by: Paolo Bonzini >=20 > Are you going to send a pull request yourself? >=20 I was assuming Peter would merge (and decide about the ordering). Jan --RILTs0cPpt6opawihpQfSJiLLPDwwS03v 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.0.22 (GNU/Linux) iEYEARECAAYFAlRODFUACgkQitSsb3rl5xSxLQCgvxjruFMDlRjSR3nsUK6tdExT +ckAnRhcORiVwvZvEl1bppls8wzhTF4G =WUZn -----END PGP SIGNATURE----- --RILTs0cPpt6opawihpQfSJiLLPDwwS03v--