qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Make qemu_shutdown_requested signal-safe


From: Gonglei
Subject: Re: [Qemu-devel] [PATCH] Make qemu_shutdown_requested signal-safe
Date: Sun, 26 Oct 2014 17:43:28 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 2014/10/26 17:32, Jan Kiszka wrote:

> From: Jan Kiszka <address@hidden>
> 
> 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 <address@hidden>
> ---
>  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 <address@hidden>

Best regards,
-Gonglei




reply via email to

[Prev in Thread] Current Thread [Next in Thread]