qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Coroutines and ucontext


From: Alex Barcelo
Subject: Re: [Qemu-devel] Coroutines and ucontext
Date: Tue, 7 Feb 2012 17:06:10 +0100

On Tue, Feb 7, 2012 at 12:18, Stefan Hajnoczi <address@hidden> wrote:
> On Sat, Jan 28, 2012 at 9:31 AM, Alex Barcelo <address@hidden> wrote:
>> On Fri, Jan 27, 2012 at 15:39, Paolo Bonzini wrote:
>>>> I have a patch that uses sigsetjmp and siglongjmp instead of
>>>> makecontext and getcontext (and all the ucontext stuff), and it
>>>> *seems* to work... but I'm not sure if it works "by accident" (not
>>>> sure what I'm doing to the stack, not sure what I should be doing to
>>>> the stack).
>>>
>>> You can post it, don't worry.  I'm curious how you are switching stacks when
>>> creating the coroutine.
>>>
>>
>> I think that I'm not switching, so at first I didn't understand why
>> could it run at all. Now I think that qemu-img is too simple and a new
>> stack is not really needed (probably only one coroutine and
>> straightforward, I'll check it). So it doesn't crash.
>>
>> Thank you very much for the advice and comments. I'll do some more
>> tests, I expect to achieve something useful ^^
>
> The way that you can use the setjmp/longjmp family of functions for
> creating stacks is by manipulating the fields inside jmpbuf.  However,
> it seemed slightly more portable and less hacky to use ucontext
> functions instead of doing that.
>
> Stefan

Yes, I agree. But makecontext and swapcontext are not OK for my
project (mainly because makecontext and swapcontext are not supported
by qemu under PPC) so I was looking for alternatives. My best shot at
the moment is using sigaltstack, if it works I will post a patch for
coroutines using sigaltstack, which is also quite portable (GNU
Portable Thread can use both, so I was trying to copy its
functionality).

Alex



reply via email to

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