qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Alex Barcelo <abarcelo@ac.upc.edu>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Coroutines and ucontext
Date: Tue, 7 Feb 2012 11:18:37 +0000	[thread overview]
Message-ID: <CAJSP0QWMv3vzZF9FteNDSopKY4Ms7urRpNtE5RDFXHF1Sg_fRw@mail.gmail.com> (raw)
In-Reply-To: <CAFKAgTdJRiAsL--VgQQ3r_01W4tmnsw4Q22v8kCvobEZL1fPyA@mail.gmail.com>

On Sat, Jan 28, 2012 at 9:31 AM, Alex Barcelo <abarcelo@ac.upc.edu> 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

  reply	other threads:[~2012-02-07 11:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 12:39 [Qemu-devel] Coroutines and ucontext Alex Barcelo
2012-01-27 14:39 ` Paolo Bonzini
2012-01-27 14:48   ` Daniel P. Berrange
2012-01-28  9:31   ` Alex Barcelo
2012-02-07 11:18     ` Stefan Hajnoczi [this message]
2012-02-07 16:06       ` Alex Barcelo
2012-02-07 16:23         ` Paolo Bonzini

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=CAJSP0QWMv3vzZF9FteNDSopKY4Ms7urRpNtE5RDFXHF1Sg_fRw@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=abarcelo@ac.upc.edu \
    --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 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).