qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Michael Tokarev <mjt@tls.msk.ru>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] coroutine-ucontext broken for x86-32
Date: Wed, 09 May 2012 12:17:30 -0500	[thread overview]
Message-ID: <4FAAA6AA.2040400@codemonkey.ws> (raw)
In-Reply-To: <4FAA5721.9060201@siemens.com>

On 05/09/2012 06:38 AM, Jan Kiszka wrote:
> On 2012-05-09 08:15, Peter Maydell wrote:
>> On 9 May 2012 11:11, Kevin Wolf<kwolf@redhat.com>  wrote:
>>> Am 08.05.2012 21:35, schrieb Jan Kiszka:
>>>> I hunted down a fairly subtle corruption of the VCPU thread signal mask
>>>> in KVM mode when using the ucontext version of coroutines:
>>>>
>>>> coroutine_new calls getcontext, makecontext, swapcontext. Those
>>>> functions get/set also the signal mask of the caller. Unfortunately,
>>>> they only use the sigprocmask syscall on i386, not the rt_sigprocmask
>>>> version. So they do not properly save/restore the blocked RT signals,
>>>> namely our SIG_IPI - it becomes unblocke this way.
>>>
>>> If other coroutine backends work (sigaltstack?), we could try to detect
>>> the situation in configure and set the right default. Not sure what the
>>> condition is, glibc + i386?
>>
>> I don't think you can do a compile-time test for this short of
>> just disabling use of the ucontext code on all i386/Linux platforms.
>>
>> I think it's becoming increasingly obvious that the setcontext/getcontext
>> code path is not very well used and prone to nasty libc bugs. Trying
>> to implement coroutines in C is just a really bad idea and I think
>> we should be trying to reduce our use of them if we possibly can,
>> presumably by switching to actually using threads where we really
>> need the parallelism.
>
> I tend to agree.
>
> FWIW, sigaltstack works around the issue here, but I'm still looking s
> bit skeptical at its implementation.

Is there any downside to using SIGUSR1?

Regards,

Anthony Liguori

>
> Jan
>

  reply	other threads:[~2012-05-09 17:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-08 19:35 [Qemu-devel] coroutine-ucontext broken for x86-32 Jan Kiszka
2012-05-09  7:32 ` Michael Tokarev
2012-05-09 11:12   ` Jan Kiszka
2012-05-09 10:11 ` Kevin Wolf
2012-05-09 10:55   ` Jan Kiszka
2012-05-09 11:15   ` Peter Maydell
2012-05-09 11:38     ` Jan Kiszka
2012-05-09 17:17       ` Anthony Liguori [this message]
2012-05-09 17:25         ` Jan Kiszka
2012-05-09 17:31           ` Anthony Liguori
2012-05-09 18:21             ` Jan Kiszka
2012-05-09 14:37     ` Avi Kivity
2012-05-09 18:05 ` Michael Tokarev

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=4FAAA6AA.2040400@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kwolf@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=peter.maydell@linaro.org \
    --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 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).