qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Charlie Shepherd <charlie@ctshepherd.com>
Cc: kwolf@redhat.com, pbonzini@redhat.com,
	Charlie Shepherd <cs648@cam.ac.uk>,
	gabriel@kerneis.info, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield
Date: Wed, 7 Aug 2013 21:18:05 +0200	[thread overview]
Message-ID: <20130807191805.GA16226@stefanha-thinkpad.hitronhub.home> (raw)
In-Reply-To: <1375728247-1306-3-git-send-email-charlie@ctshepherd.com>

On Mon, Aug 05, 2013 at 08:44:04PM +0200, Charlie Shepherd wrote:
> From: Charlie Shepherd <cs648@cam.ac.uk>
> 
> While it only really makes sense to call qemu_coroutine_self() in a coroutine
> context, it cannot actually yield execution itself, so remove the coroutine_fn
> annotation.
> ---
>  include/block/coroutine.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

By removing coroutine_fn the rules have changed:

It's now legal to call qemu_coroutine_self() outside a coroutine.
Previously only callers that knew the internals of the coroutine
implementation did that.

coroutine_fn gives coroutine backend implementors more flexibility in
how they choose to implement qemu_coroutine_self().  From an API
perspective I prefer to keep qemu_coroutine_self() marked as a
coroutine_fn.

I guess the practical problem is that CPC will get
upset that it's being called by the coroutine implementation from
non-coroutine contexts.  This can be solved:

1. Keep the public qemu_coroutine_self() marked coroutine_fn.

2. Have it call an internal coroutine_self() function that is not
   coroutine_fn.

This way the API stays strict and the internal implementation doesn't
violate the coroutine_fn calling rule.

Stefan

  reply	other threads:[~2013-08-07 19:18 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 [this message]
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
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=20130807191805.GA16226@stefanha-thinkpad.hitronhub.home \
    --to=stefanha@gmail.com \
    --cc=charlie@ctshepherd.com \
    --cc=cs648@cam.ac.uk \
    --cc=gabriel@kerneis.info \
    --cc=kwolf@redhat.com \
    --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).