Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-03-06 Thread Peter Maydell
On 14 February 2012 09:50, Paolo Bonzini wrote: > On 02/14/2012 10:24 AM, Stefan Hajnoczi wrote: >> >> setjmp() followed by return is usually bad.  We're relying on the fact >> that the return code path here does not clobber local variables 'self' >> and 'co'.  Can't we longjmp out back to the cor

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-14 Thread Stefan Hajnoczi
On Tue, Feb 14, 2012 at 1:21 PM, Alex Barcelo wrote: > On Tue, Feb 14, 2012 at 13:20, Stefan Hajnoczi wrote: >> On Tue, Feb 14, 2012 at 11:53 AM, Alex Barcelo wrote: >>> On Tue, Feb 14, 2012 at 10:24, Stefan Hajnoczi wrote: (...) What happens when a vcpu thread creates a coroutine whi

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-14 Thread Alex Barcelo
On Tue, Feb 14, 2012 at 13:20, Stefan Hajnoczi wrote: > On Tue, Feb 14, 2012 at 11:53 AM, Alex Barcelo wrote: >> On Tue, Feb 14, 2012 at 10:24, Stefan Hajnoczi wrote: >>> (...) >>> What happens when a vcpu thread creates a coroutine while another QEMU >>> thread raises SIG_IPI?  The SIG_IPI will

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-14 Thread Stefan Hajnoczi
On Tue, Feb 14, 2012 at 9:50 AM, Paolo Bonzini wrote: > On 02/14/2012 10:24 AM, Stefan Hajnoczi wrote: >> >> setjmp() followed by return is usually bad.  We're relying on the fact >> that the return code path here does not clobber local variables 'self' >> and 'co'.  Can't we longjmp out back to t

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-14 Thread Stefan Hajnoczi
On Tue, Feb 14, 2012 at 11:53 AM, Alex Barcelo wrote: > On Tue, Feb 14, 2012 at 10:24, Stefan Hajnoczi wrote: >> On Mon, Feb 13, 2012 at 03:42:28PM +0100, Alex Barcelo wrote: >>> +    /* >>> +     * Preserve the SIGUSR1 signal state, block SIGUSR1, >>> +     * and establish our signal handler. Th

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-14 Thread Alex Barcelo
On Tue, Feb 14, 2012 at 10:24, Stefan Hajnoczi wrote: > On Mon, Feb 13, 2012 at 03:42:28PM +0100, Alex Barcelo wrote: >> +    if (!setjmp(*((jmp_buf *)&tr_reenter))) { >> +        return; >> +    } > > setjmp() followed by return is usually bad.  We're relying on the fact > that the return code pa

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-14 Thread Paolo Bonzini
On 02/14/2012 10:24 AM, Stefan Hajnoczi wrote: setjmp() followed by return is usually bad. We're relying on the fact that the return code path here does not clobber local variables 'self' and 'co'. Can't we longjmp out back to the coroutine_new() function instead? http://www.gnu.org/software/

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-14 Thread Stefan Hajnoczi
On Mon, Feb 13, 2012 at 03:42:28PM +0100, Alex Barcelo wrote: > +/* > + * This is used as the signal handler. This is called with the brand new > stack > + * (thanks to sigaltstack). We have to return, given that this is a signal > + * handler and the sigmask and some other things are changed. > +

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-13 Thread Andreas Färber
Am 13.02.2012 17:31, schrieb Andreas Färber: > Further, there is no GNU Lesser General Public License 2.0, only 2.1: > http://www.gnu.org/licenses/lgpl-2.1.html > > 2.0 was the GNU Library General Public License: > http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html > > So this may even just b

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-13 Thread Andreas Färber
Am 13.02.2012 17:11, schrieb Alex Barcelo: > On Mon, Feb 13, 2012 at 16:57, Andreas Färber wrote: >> You should (need to?) use version 2.1 or later above then, too. You can >> then simply move this snippet up and drop the "Same license ..." line. > > I wanted to ask this, but it slipped my mind.

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-13 Thread Alex Barcelo
On Mon, Feb 13, 2012 at 16:57, Andreas Färber wrote: > You should (need to?) use version 2.1 or later above then, too. You can > then simply move this snippet up and drop the "Same license ..." line. I wanted to ask this, but it slipped my mind. So it's ok to change the header to a newer GNU vers

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-13 Thread Andreas Färber
Am 13.02.2012 15:42, schrieb Alex Barcelo: > This file is based in both coroutine-ucontext.c and > pth_mctx.c (from the GNU Portable Threads library). > > The mechanism used to change stacks is the sigaltstack > function (variant 2 of the pth library). > > Signed-off-by: Alex Barcelo > --- > co

Re: [Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-13 Thread Paolo Bonzini
On 02/13/2012 03:42 PM, Alex Barcelo wrote: This file is based in both coroutine-ucontext.c and pth_mctx.c (from the GNU Portable Threads library). The mechanism used to change stacks is the sigaltstack function (variant 2 of the pth library). Signed-off-by: Alex Barcelo --- coroutine-sigalts

[Qemu-devel] [PATCH 1/3] coroutine: adding sigaltstack method (.c source)

2012-02-13 Thread Alex Barcelo
This file is based in both coroutine-ucontext.c and pth_mctx.c (from the GNU Portable Threads library). The mechanism used to change stacks is the sigaltstack function (variant 2 of the pth library). Signed-off-by: Alex Barcelo --- coroutine-sigaltstack.c | 337