qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1.1] coroutine: Fix setup of sigaltstack coroutines
@ 2012-05-09 17:23 Jan Kiszka
  2012-05-10  7:29 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2012-05-09 17:23 UTC (permalink / raw)
  To: Kevin Wolf, qemu-devel

Use pthread_kill instead of process-wide kill to invoke the signal
handler used for stack switching. This may fix spurious lock-ups with
this backend, easily triggerable by extending the time window between
kill and sigsuspend.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 coroutine-sigaltstack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/coroutine-sigaltstack.c b/coroutine-sigaltstack.c
index 7ff2d33..b2e316c 100644
--- a/coroutine-sigaltstack.c
+++ b/coroutine-sigaltstack.c
@@ -226,7 +226,7 @@ static Coroutine *coroutine_new(void)
      * called.
      */
     coTS->tr_called = 0;
-    kill(getpid(), SIGUSR2);
+    pthread_kill(pthread_self(), SIGUSR2);
     sigfillset(&sigs);
     sigdelset(&sigs, SIGUSR2);
     while (!coTS->tr_called) {
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 1.1] coroutine: Fix setup of sigaltstack coroutines
  2012-05-09 17:23 [Qemu-devel] [PATCH 1.1] coroutine: Fix setup of sigaltstack coroutines Jan Kiszka
@ 2012-05-10  7:29 ` Paolo Bonzini
  2012-05-10  8:07   ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2012-05-10  7:29 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Kevin Wolf, qemu-devel

Il 09/05/2012 19:23, Jan Kiszka ha scritto:
> Use pthread_kill instead of process-wide kill to invoke the signal
> handler used for stack switching. This may fix spurious lock-ups with
> this backend, easily triggerable by extending the time window between
> kill and sigsuspend.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  coroutine-sigaltstack.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/coroutine-sigaltstack.c b/coroutine-sigaltstack.c
> index 7ff2d33..b2e316c 100644
> --- a/coroutine-sigaltstack.c
> +++ b/coroutine-sigaltstack.c
> @@ -226,7 +226,7 @@ static Coroutine *coroutine_new(void)
>       * called.
>       */
>      coTS->tr_called = 0;
> -    kill(getpid(), SIGUSR2);
> +    pthread_kill(pthread_self(), SIGUSR2);
>      sigfillset(&sigs);
>      sigdelset(&sigs, SIGUSR2);
>      while (!coTS->tr_called) {

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 1.1] coroutine: Fix setup of sigaltstack coroutines
  2012-05-10  7:29 ` Paolo Bonzini
@ 2012-05-10  8:07   ` Kevin Wolf
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2012-05-10  8:07 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Jan Kiszka, qemu-devel

Am 10.05.2012 09:29, schrieb Paolo Bonzini:
> Il 09/05/2012 19:23, Jan Kiszka ha scritto:
>> Use pthread_kill instead of process-wide kill to invoke the signal
>> handler used for stack switching. This may fix spurious lock-ups with
>> this backend, easily triggerable by extending the time window between
>> kill and sigsuspend.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>  coroutine-sigaltstack.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/coroutine-sigaltstack.c b/coroutine-sigaltstack.c
>> index 7ff2d33..b2e316c 100644
>> --- a/coroutine-sigaltstack.c
>> +++ b/coroutine-sigaltstack.c
>> @@ -226,7 +226,7 @@ static Coroutine *coroutine_new(void)
>>       * called.
>>       */
>>      coTS->tr_called = 0;
>> -    kill(getpid(), SIGUSR2);
>> +    pthread_kill(pthread_self(), SIGUSR2);
>>      sigfillset(&sigs);
>>      sigdelset(&sigs, SIGUSR2);
>>      while (!coTS->tr_called) {
> 
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Thanks, applied to the block branch for 1.1.

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-10  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-09 17:23 [Qemu-devel] [PATCH 1.1] coroutine: Fix setup of sigaltstack coroutines Jan Kiszka
2012-05-10  7:29 ` Paolo Bonzini
2012-05-10  8:07   ` Kevin Wolf

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).