All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 04/35] coroutine: remove coroutine_fn from qemu_coroutine_self()
Date: Wed, 5 Jul 2017 09:39:00 -0400 (EDT)	[thread overview]
Message-ID: <1631360003.47097808.1499261940413.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <f00c4251-ad8d-475b-5c3c-653835791552@redhat.com>

Hi

----- Original Message -----
> On 05/07/2017 00:03, Marc-André Lureau wrote:
> > The function may be safely called from non-coroutine context.
> > 
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> It can, but it shouldn't...  What are the callers?

There is aio_co_enter() & qemu_aio_coroutine_enter() that call it without coroutine context, but they are probably safe and can be manually tagged as coroutine-section.

This help reveal a few more functions to be marked coroutine_fn:

diff --git a/block/io.c b/block/io.c
index a53a86df3e..e2dc1bf061 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1952,6 +1952,7 @@ int coroutine_fn bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num,
  *  allocated/unallocated state.
  *
  */
+coroutine_fn
 int bdrv_is_allocated_above(BlockDriverState *top,
                             BlockDriverState *base,
                             int64_t sector_num,
diff --git a/block/iscsi.c b/block/iscsi.c
index e16311cb4a..5af98d9e99 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -310,6 +310,7 @@ out:
     }
 }
 
+coroutine_fn
 static void iscsi_co_init_iscsitask(IscsiLun *iscsilun, struct IscsiTask *iTask)
 {
     *iTask = (struct IscsiTask) {
diff --git a/block/nfs.c b/block/nfs.c
index 3f393a95a4..9198d4406e 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -220,6 +220,7 @@ static void nfs_process_write(void *arg)
     qemu_mutex_unlock(&client->mutex);
 }
 
+coroutine_fn
 static void nfs_co_init_task(BlockDriverState *bs, NFSRPC *task)
 {
     *task = (NFSRPC) {
diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
index 1d25147392..9891908970 100644
--- a/block/qcow2-cache.c
+++ b/block/qcow2-cache.c
@@ -164,6 +164,7 @@ static int qcow2_cache_flush_dependency(BlockDriverState *bs, Qcow2Cache *c)
     return 0;
 }
 
+coroutine_fn
 static int qcow2_cache_entry_flush(BlockDriverState *bs, Qcow2Cache *c, int i)
 {
     BDRVQcow2State *s = bs->opaque;
@@ -221,6 +222,7 @@ static int qcow2_cache_entry_flush(BlockDriverState *bs, Qcow2Cache *c, int i)
     return 0;
 }
 
+coroutine_fn
 int qcow2_cache_write(BlockDriverState *bs, Qcow2Cache *c)
 {
     BDRVQcow2State *s = bs->opaque;
@@ -240,6 +242,7 @@ int qcow2_cache_write(BlockDriverState *bs, Qcow2Cache *c)
     return result;
 }
 
+coroutine_fn
 int qcow2_cache_flush(BlockDriverState *bs, Qcow2Cache *c)
 {
     int result = qcow2_cache_write(bs, c);
@@ -282,6 +285,7 @@ void qcow2_cache_depends_on_flush(Qcow2Cache *c)
     c->depends_on_flush = true;
 }
 
+coroutine_fn
 int qcow2_cache_empty(BlockDriverState *bs, Qcow2Cache *c)
 {
     int ret, i;
@@ -304,6 +308,7 @@ int qcow2_cache_empty(BlockDriverState *bs, Qcow2Cache *c)
     return 0;
 }
 
+coroutine_fn
 static int qcow2_cache_do_get(BlockDriverState *bs, Qcow2Cache *c,
     uint64_t offset, void **table, bool read_from_disk)
 {
@@ -378,12 +383,14 @@ found:
     return 0;
 }
 
+coroutine_fn
 int qcow2_cache_get(BlockDriverState *bs, Qcow2Cache *c, uint64_t offset,
     void **table)
 {
     return qcow2_cache_do_get(bs, c, offset, table, true);
 }
 
+coroutine_fn
 int qcow2_cache_get_empty(BlockDriverState *bs, Qcow2Cache *c, uint64_t offset,
     void **table)
 {
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 964d23aee8..da4d0c2b98 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1087,6 +1087,7 @@ handle_dependencies(BlockDriverState *bs, uint64_t guest_offset,
  *
  *  -errno: in error cases
  */
+coroutine_fn
 static int handle_copied(BlockDriverState *bs, uint64_t guest_offset,
     uint64_t *host_offset, uint64_t *bytes, QCowL2Meta **m)
 {
@@ -1195,6 +1196,7 @@ out:
  * function has been waiting for another request and the allocation must be
  * restarted, but the whole request should not be failed.
  */
+coroutine_fn
 static int do_alloc_cluster_offset(BlockDriverState *bs, uint64_t guest_offset,
                                    uint64_t *host_offset, uint64_t *nb_clusters)
 {
@@ -1243,6 +1245,7 @@ static int do_alloc_cluster_offset(BlockDriverState *bs, uint64_t guest_offset,
  *
  *  -errno: in error cases
  */
+coroutine_fn
 static int handle_alloc(BlockDriverState *bs, uint64_t guest_offset,
     uint64_t *host_offset, uint64_t *bytes, QCowL2Meta **m)
 {
diff --git a/block/quorum.c b/block/quorum.c
index b086d70daa..9772b20a78 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -154,6 +154,7 @@ static bool quorum_64bits_compare(QuorumVoteValue *a, QuorumVoteValue *b)
     return a->l == b->l;
 }
 
+coroutine_fn
 static QuorumAIOCB *quorum_aio_get(BlockDriverState *bs,
                                    QEMUIOVector *qiov,
                                    uint64_t offset,
diff --git a/nbd/server.c b/nbd/server.c
index 4112b4b184..eb7f98ba32 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -995,6 +995,7 @@ nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len)
  * the client (although the caller may still need to disconnect after reporting
  * the error).
  */
+coroutine_fn
 static int nbd_co_receive_request(NBDRequestData *req, NBDRequest *request)
 {
     NBDClient *client = req->client;
diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c
index b44b5d55eb..a15cdfc6cd 100644
--- a/util/qemu-coroutine-lock.c
+++ b/util/qemu-coroutine-lock.c
@@ -173,6 +173,7 @@ typedef struct CoWaitRecord {
     QSLIST_ENTRY(CoWaitRecord) next;
 } CoWaitRecord;
 
+coroutine_fn
 static void push_waiter(CoMutex *mutex, CoWaitRecord *w)
 {
     w->co = qemu_coroutine_self();

  reply	other threads:[~2017-07-05 13:39 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04 22:03 [Qemu-devel] [PATCH 00/35] RFC: coroutine annotations & clang check Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 01/35] WIP: coroutine: annotate coroutine with clang thread safety attributes Marc-André Lureau
2017-07-05 11:39   ` Paolo Bonzini
2017-07-05 14:11     ` Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 02/35] WIP: coroutine: manually tag the fast-paths Marc-André Lureau
2017-07-11 15:23   ` Stefan Hajnoczi
2017-07-11 15:41     ` Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 03/35] test-coroutine: fix coroutine attribute Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 04/35] coroutine: remove coroutine_fn from qemu_coroutine_self() Marc-André Lureau
2017-07-05 10:56   ` Paolo Bonzini
2017-07-05 13:39     ` Marc-André Lureau [this message]
2017-07-05 13:43       ` Paolo Bonzini
2017-07-04 22:03 ` [Qemu-devel] [PATCH 05/35] coroutine: remove coroutine_fn from qemu_co_queue_run_restart() Marc-André Lureau
2017-07-11 15:26   ` Stefan Hajnoczi
2017-07-04 22:03 ` [Qemu-devel] [PATCH 06/35] coroutine: mark CoRwLock coroutine_fn Marc-André Lureau
2017-07-11 15:26   ` Stefan Hajnoczi
2017-07-04 22:03 ` [Qemu-devel] [PATCH 07/35] blockjob: mark coroutine_fn Marc-André Lureau
2017-07-11 15:27   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-07-04 22:03 ` [Qemu-devel] [PATCH 08/35] block: all bdrv_aio callbacks are coroutine_fn Marc-André Lureau
2017-07-05 10:53   ` Paolo Bonzini
2017-07-05 14:21     ` Marc-André Lureau
2017-07-05 14:44       ` Paolo Bonzini
2017-07-05 16:06         ` Marc-André Lureau
2017-07-05 16:10           ` Paolo Bonzini
2017-07-05 16:40             ` Marc-André Lureau
2017-07-05 16:42               ` Paolo Bonzini
2017-07-04 22:03 ` [Qemu-devel] [PATCH 09/35] block: bdrv_create() and bdrv_debug_event() " Marc-André Lureau
2017-07-11 16:04   ` Stefan Hajnoczi
2017-07-04 22:03 ` [Qemu-devel] [PATCH 10/35] vmdk: mark coroutine_fn Marc-André Lureau
2017-07-11 16:04   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-07-04 22:03 ` [Qemu-devel] [PATCH 11/35] qcow2: " Marc-André Lureau
2017-07-11 16:04   ` Stefan Hajnoczi
2017-07-04 22:03 ` [Qemu-devel] [PATCH 12/35] raw: " Marc-André Lureau
2017-07-11 16:06   ` Stefan Hajnoczi
2017-07-04 22:03 ` [Qemu-devel] [PATCH 13/35] nbd: " Marc-André Lureau
2017-07-06 14:33   ` Eric Blake
2017-07-04 22:03 ` [Qemu-devel] [PATCH 14/35] migration: " Marc-André Lureau
2017-07-11 16:06   ` Stefan Hajnoczi
2017-07-18 16:04   ` Juan Quintela
2017-07-18 16:21     ` Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 15/35] backup: " Marc-André Lureau
2017-07-11 18:53   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-07-04 22:03 ` [Qemu-devel] [PATCH 16/35] crypto: " Marc-André Lureau
2017-07-18 19:27   ` Eric Blake
2017-07-04 22:03 ` [Qemu-devel] [PATCH 17/35] curl: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 18/35] gluster: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 19/35] nfs: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 20/35] quorum: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 21/35] rbd: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 22/35] sheepdog: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 23/35] ssh: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 24/35] null: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 25/35] mirror: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 26/35] iscsi: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 27/35] file-posix: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 28/35] 9p: " Marc-André Lureau
2017-07-05  9:45   ` Greg Kurz
2017-07-04 22:03 ` [Qemu-devel] [PATCH 29/35] block: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 30/35] block-backend: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 31/35] parallels: " Marc-André Lureau
2017-07-05 14:11   ` Denis V. Lunev
2017-07-04 22:03 ` [Qemu-devel] [PATCH 32/35] qed: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 33/35] vdi: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 34/35] vhdx: " Marc-André Lureau
2017-07-04 22:03 ` [Qemu-devel] [PATCH 35/35] vpc: " Marc-André Lureau
2017-07-05  5:25 ` [Qemu-devel] [PATCH 00/35] RFC: coroutine annotations & clang check Markus Armbruster
2017-07-05  9:34   ` Marc-André Lureau

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=1631360003.47097808.1499261940413.JavaMail.zimbra@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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.