All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Alexandre Raymond <cerbere@gmail.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"andreas.faerber@web.de" <andreas.faerber@web.de>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"agraf@suse.de" <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH] Fix signal handling of SIG_IPI when io-thread is enabled
Date: Wed, 15 Jun 2011 09:38:28 +0200	[thread overview]
Message-ID: <4DF86174.7090406@siemens.com> (raw)
In-Reply-To: <1308115231-33690-1-git-send-email-cerbere@gmail.com>

On 2011-06-15 07:20, Alexandre Raymond wrote:
> Both the signal thread (via sigwait()) and the cpu thread (via
> a normal signal handler) were attempting to catch SIG_IPI.

Why? Ahh, because of qemu_cpu_kick_self: raise(SIG_IPI)! That should
generate a per-process SIG_IPI. And that may not only affect Darwin.
Looks good.

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

> 
> This resulted in random freezes under Darwin.
> 
> This patch separates SIG_IPI from the rest of the signals handled
> by the signal thread, because it is independently caught by the cpu
> thread.
> 
> Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
> ---
>  cpus.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 18a1522..84ffd1c 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -394,10 +394,18 @@ static int qemu_signal_init(void)
>      sigaddset(&set, SIGUSR2);
>      pthread_sigmask(SIG_UNBLOCK, &set, NULL);
>  
> +    /*
> +     * SIG_IPI must be blocked in the main thread and must not be caught
> +     * by sigwait() in the signal thread. Otherwise, the cpu thread will
> +     * not catch it reliably.
> +     */
> +    sigemptyset(&set);
> +    sigaddset(&set, SIG_IPI);
> +    pthread_sigmask(SIG_BLOCK, &set, NULL);
> +
>      sigemptyset(&set);
>      sigaddset(&set, SIGIO);
>      sigaddset(&set, SIGALRM);
> -    sigaddset(&set, SIG_IPI);
>      sigaddset(&set, SIGBUS);
>  #else
>      sigemptyset(&set);

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  reply	other threads:[~2011-06-15  7:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15  5:20 [Qemu-devel] [PATCH] Fix signal handling of SIG_IPI when io-thread is enabled Alexandre Raymond
2011-06-15  7:38 ` Jan Kiszka [this message]
2011-06-15 14:11   ` Alexandre Raymond
2011-07-09  2:33     ` Alexandre Raymond
2011-07-16 19:44       ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DF86174.7090406@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=agraf@suse.de \
    --cc=andreas.faerber@web.de \
    --cc=cerbere@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.