diff mbox

Revert "main-loop.c: Handle SIGINT, SIGHUP and SIGTERM, synchronously"

Message ID 544CBFB0.7010701@web.de
State New
Headers show

Commit Message

Jan Kiszka Oct. 26, 2014, 9:32 a.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

This reverts commit 15124e142034d21341ec9f1a304a1dc5a6c25681. It breaks
debuggability of qemu.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Feel free to apply this before or after "Make qemu_shutdown_requested
signal-safe".

 main-loop.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Gonglei (Arei) Oct. 26, 2014, 9:42 a.m. UTC | #1
On 2014/10/26 17:32, Jan Kiszka wrote:

> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> This reverts commit 15124e142034d21341ec9f1a304a1dc5a6c25681. It breaks
> debuggability of qemu.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 

Thanks, please add my 'Reported-by' tag and

Reviewed-by: Gonglei <arei.gonglei@huawei.com>

> Feel free to apply this before or after "Make qemu_shutdown_requested
> signal-safe".
> 
>  main-loop.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/main-loop.c b/main-loop.c
> index d2e64f1..53393a4 100644
> --- a/main-loop.c
> +++ b/main-loop.c
> @@ -84,9 +84,6 @@ static int qemu_signal_init(void)
>      sigaddset(&set, SIGIO);
>      sigaddset(&set, SIGALRM);
>      sigaddset(&set, SIGBUS);
> -    sigaddset(&set, SIGINT);
> -    sigaddset(&set, SIGHUP);
> -    sigaddset(&set, SIGTERM);
>      pthread_sigmask(SIG_BLOCK, &set, NULL);
>  
>      sigdelset(&set, SIG_IPI);
Peter Maydell Oct. 27, 2014, 2:18 p.m. UTC | #2
On 26 October 2014 09:32, Jan Kiszka <jan.kiszka@web.de> wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This reverts commit 15124e142034d21341ec9f1a304a1dc5a6c25681. It breaks
> debuggability of qemu.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> Feel free to apply this before or after "Make qemu_shutdown_requested
> signal-safe".
>
>  main-loop.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/main-loop.c b/main-loop.c
> index d2e64f1..53393a4 100644
> --- a/main-loop.c
> +++ b/main-loop.c
> @@ -84,9 +84,6 @@ static int qemu_signal_init(void)
>      sigaddset(&set, SIGIO);
>      sigaddset(&set, SIGALRM);
>      sigaddset(&set, SIGBUS);
> -    sigaddset(&set, SIGINT);
> -    sigaddset(&set, SIGHUP);
> -    sigaddset(&set, SIGTERM);

I'm planning to apply this patch but with the following
comment added here:
    /* Note that the SIGINT, SIGTERM and SIGHUP signals are not handled
     * via signalfd, and so their handlers will still be invoked
     * asynchronously. This is done so that ^C can be used to interrupt
     * QEMU when it is being run under gdb.
     */

(which does make the commit not a pure revert).

>      pthread_sigmask(SIG_BLOCK, &set, NULL);
>
>      sigdelset(&set, SIG_IPI);
> --
> 1.8.4.5

thanks
-- PMM
Paolo Bonzini Oct. 27, 2014, 2:39 p.m. UTC | #3
On 10/27/2014 03:18 PM, Peter Maydell wrote:
> On 26 October 2014 09:32, Jan Kiszka <jan.kiszka@web.de> wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> This reverts commit 15124e142034d21341ec9f1a304a1dc5a6c25681. It breaks
>> debuggability of qemu.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>
>> Feel free to apply this before or after "Make qemu_shutdown_requested
>> signal-safe".
>>
>>  main-loop.c | 3 ---
>>  1 file changed, 3 deletions(-)
>>
>> diff --git a/main-loop.c b/main-loop.c
>> index d2e64f1..53393a4 100644
>> --- a/main-loop.c
>> +++ b/main-loop.c
>> @@ -84,9 +84,6 @@ static int qemu_signal_init(void)
>>      sigaddset(&set, SIGIO);
>>      sigaddset(&set, SIGALRM);
>>      sigaddset(&set, SIGBUS);
>> -    sigaddset(&set, SIGINT);
>> -    sigaddset(&set, SIGHUP);
>> -    sigaddset(&set, SIGTERM);
> 
> I'm planning to apply this patch but with the following
> comment added here:
>     /* Note that the SIGINT, SIGTERM and SIGHUP signals are not handled
>      * via signalfd, and so their handlers will still be invoked
>      * asynchronously. This is done so that ^C can be used to interrupt
>      * QEMU when it is being run under gdb.
>      */

What about:

    /* SIGINT cannot be handled via signalfd, so that ^C can be used
     * to interrupt QEMU when it is being run under gdb.  SIGHUP and
     * SIGTERM are also handled asynchronously, even though it is not
     * strictly necessary, because they use the same handler as SIGINT.
     */

> (which does make the commit not a pure revert).
> 
>>      pthread_sigmask(SIG_BLOCK, &set, NULL);
>>
>>      sigdelset(&set, SIG_IPI);
>> --
>> 1.8.4.5
> 
> thanks
> -- PMM
>
Peter Maydell Oct. 27, 2014, 3:05 p.m. UTC | #4
On 27 October 2014 14:39, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 10/27/2014 03:18 PM, Peter Maydell wrote:
>> On 26 October 2014 09:32, Jan Kiszka <jan.kiszka@web.de> wrote:
>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>>> This reverts commit 15124e142034d21341ec9f1a304a1dc5a6c25681. It breaks
>>> debuggability of qemu.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>> ---
>>>
>>> Feel free to apply this before or after "Make qemu_shutdown_requested
>>> signal-safe".
>>>
>>>  main-loop.c | 3 ---
>>>  1 file changed, 3 deletions(-)
>>>
>>> diff --git a/main-loop.c b/main-loop.c
>>> index d2e64f1..53393a4 100644
>>> --- a/main-loop.c
>>> +++ b/main-loop.c
>>> @@ -84,9 +84,6 @@ static int qemu_signal_init(void)
>>>      sigaddset(&set, SIGIO);
>>>      sigaddset(&set, SIGALRM);
>>>      sigaddset(&set, SIGBUS);
>>> -    sigaddset(&set, SIGINT);
>>> -    sigaddset(&set, SIGHUP);
>>> -    sigaddset(&set, SIGTERM);
>>
>> I'm planning to apply this patch but with the following
>> comment added here:
>>     /* Note that the SIGINT, SIGTERM and SIGHUP signals are not handled
>>      * via signalfd, and so their handlers will still be invoked
>>      * asynchronously. This is done so that ^C can be used to interrupt
>>      * QEMU when it is being run under gdb.
>>      */
>
> What about:
>
>     /* SIGINT cannot be handled via signalfd, so that ^C can be used
>      * to interrupt QEMU when it is being run under gdb.  SIGHUP and
>      * SIGTERM are also handled asynchronously, even though it is not
>      * strictly necessary, because they use the same handler as SIGINT.
>      */

Looks good to me, I'll use that wording.

-- PMM
Peter Maydell Oct. 27, 2014, 4:39 p.m. UTC | #5
On 27 October 2014 15:05, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 27 October 2014 14:39, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> What about:
>>
>>     /* SIGINT cannot be handled via signalfd, so that ^C can be used
>>      * to interrupt QEMU when it is being run under gdb.  SIGHUP and
>>      * SIGTERM are also handled asynchronously, even though it is not
>>      * strictly necessary, because they use the same handler as SIGINT.
>>      */
>
> Looks good to me, I'll use that wording.

Applied this and the other patch to master, thanks.

-- PMM
diff mbox

Patch

diff --git a/main-loop.c b/main-loop.c
index d2e64f1..53393a4 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -84,9 +84,6 @@  static int qemu_signal_init(void)
     sigaddset(&set, SIGIO);
     sigaddset(&set, SIGALRM);
     sigaddset(&set, SIGBUS);
-    sigaddset(&set, SIGINT);
-    sigaddset(&set, SIGHUP);
-    sigaddset(&set, SIGTERM);
     pthread_sigmask(SIG_BLOCK, &set, NULL);
 
     sigdelset(&set, SIG_IPI);