On 10/26/2014 10:32 AM, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kis...@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.kis...@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-sta...@nongnu.org
Reviewed-by: Paolo Bonzini <pbonz...@redhat.com>

Are you going to send a pull request yourself?


Reply via email to