All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charlie Shepherd <charlie@ctshepherd.com>
To: Gabriel Kerneis <gabriel@kerneis.info>
Cc: kwolf@redhat.com, Stefan Hajnoczi <stefanha@gmail.com>,
	qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield
Date: Thu, 08 Aug 2013 10:10:18 +0100	[thread overview]
Message-ID: <5203607A.3020104@ctshepherd.com> (raw)
In-Reply-To: <20130808061619.GA4736@kerneis.info>

On 08/08/2013 07:16, Gabriel Kerneis wrote:
> On Thu, Aug 08, 2013 at 02:29:39AM +0100, Charlie Shepherd wrote:
>> On 07/08/2013 23:13, Gabriel Kerneis wrote:
>>> On Wed, Aug 07, 2013 at 09:18:05PM +0200, Stefan Hajnoczi wrote:
>>>> I guess the practical problem is that CPC will get
>>>> upset that it's being called by the coroutine implementation from
>>>> non-coroutine contexts.
>>> But is it really the case? If Charlie added an annotation, it probably means
>>> that in practice it was only called from coroutine context anyway.
>> It was also called from coroutine implementation in functions that
>> weren't annotated coroutine_fn (qemu_coroutine_switch() and
>> friends).
> In that case, the interface/implementation split suggested by Stefan makes
> sense.
>
> Note that qemu_coroutine_self() in principle really needs to be annotated
> coroutine_fn since it accesses (and returns) its execution context. The fact
> that it is implemented with thread-local variables in Qemu is an implementation
> detail, almost a hack (however smart); the "natural" CPC way would be to just
> return the coroutine associated with the current continuation. So keeping the
> annotation definitely makes sense.

While that would be the natural way, we are going to need the thread 
local variables regardless due to the use of the "leader" coroutine I 
believe (Stefan is this correct?). Also implementing the split in the 
way Stefan suggests would mean it's not possible to return the CPC 
continuation without a hack like the last hack I did for 
qemu_coroutine_yield(), as internal_qemu_coroutine_self() (I guess this 
function needs a better name too) would be marked as non coroutine 
across all coroutine implementions (ie in coroutine_int.h).


Charlie

  reply	other threads:[~2013-08-08  9:10 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05 18:44 [Qemu-devel] RFC: [PATCH 0/5] Explicitly annotating coroutine_fn functions Charlie Shepherd
2013-08-05 18:44 ` [Qemu-devel] [PATCH 1/5] Add an explanation of when a function should be marked coroutine_fn Charlie Shepherd
2013-08-06  8:39   ` Stefan Hajnoczi
2013-08-08  1:20     ` Charlie Shepherd
2013-08-05 18:44 ` [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield Charlie Shepherd
2013-08-07 19:18   ` Stefan Hajnoczi
2013-08-07 22:13     ` Gabriel Kerneis
2013-08-08  1:29       ` Charlie Shepherd
2013-08-08  6:16         ` Gabriel Kerneis
2013-08-08  9:10           ` Charlie Shepherd [this message]
2013-08-08  9:12             ` Gabriel Kerneis
2013-08-08  1:25     ` Charlie Shepherd
2013-08-05 18:44 ` [Qemu-devel] [PATCH 3/5] Convert BlockDriver to explicit coroutine annotations Charlie Shepherd
2013-08-05 19:23   ` Gabriel Kerneis
2013-08-05 19:33     ` Charlie Shepherd
2013-08-05 20:05       ` Gabriel Kerneis
2013-08-06  9:04         ` Kevin Wolf
2013-08-07 19:30       ` Stefan Hajnoczi
2013-08-08  1:31         ` Charlie Shepherd
2013-08-08  6:27         ` Gabriel Kerneis
2013-08-06  9:24   ` Kevin Wolf
2013-08-08  1:14     ` Charlie Shepherd
2013-08-05 18:44 ` [Qemu-devel] [PATCH 4/5] Convert block functions to coroutine versions Charlie Shepherd
2013-08-05 20:01   ` Gabriel Kerneis
2013-08-06  9:36   ` Kevin Wolf
2013-08-08  1:17     ` Charlie Shepherd
2013-08-05 18:44 ` [Qemu-devel] [PATCH 5/5] Convert block layer callers' annotations Charlie Shepherd
2013-08-05 20:15   ` Gabriel Kerneis
2013-08-08  1:19     ` Charlie Shepherd
2013-08-05 19:25 ` [Qemu-devel] RFC: [PATCH 0/5] Explicitly annotating coroutine_fn functions Charlie Shepherd
2013-08-06  7:06 ` Gabriel Kerneis
2013-08-06  9:37 ` Kevin Wolf
2013-08-08  1:22   ` Charlie Shepherd
2013-08-08  7:15     ` Kevin Wolf
2013-08-08  9:36       ` Charlie Shepherd

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=5203607A.3020104@ctshepherd.com \
    --to=charlie@ctshepherd.com \
    --cc=gabriel@kerneis.info \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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.