All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org, afaria@redhat.com
Subject: [PATCH 22/26] coroutine-lock: add missing coroutine_fn annotations
Date: Thu, 22 Sep 2022 10:49:20 +0200	[thread overview]
Message-ID: <20220922084924.201610-23-pbonzini@redhat.com> (raw)
In-Reply-To: <20220922084924.201610-1-pbonzini@redhat.com>

Callers of coroutine_fn must be coroutine_fn themselves, or the call
must be within "if (qemu_in_coroutine())".  Apply coroutine_fn to
functions where this holds.

Reviewed-by: Alberto Faria <afaria@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 util/qemu-coroutine-lock.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c
index 9ad24ab1af..15c82d9348 100644
--- a/util/qemu-coroutine-lock.c
+++ b/util/qemu-coroutine-lock.c
@@ -135,7 +135,7 @@ typedef struct CoWaitRecord {
     QSLIST_ENTRY(CoWaitRecord) next;
 } CoWaitRecord;
 
-static void push_waiter(CoMutex *mutex, CoWaitRecord *w)
+static void coroutine_fn push_waiter(CoMutex *mutex, CoWaitRecord *w)
 {
     w->co = qemu_coroutine_self();
     QSLIST_INSERT_HEAD_ATOMIC(&mutex->from_push, w, next);
@@ -332,7 +332,7 @@ void qemu_co_rwlock_init(CoRwlock *lock)
 }
 
 /* Releases the internal CoMutex.  */
-static void qemu_co_rwlock_maybe_wake_one(CoRwlock *lock)
+static void coroutine_fn qemu_co_rwlock_maybe_wake_one(CoRwlock *lock)
 {
     CoRwTicket *tkt = QSIMPLEQ_FIRST(&lock->tickets);
     Coroutine *co = NULL;
@@ -365,7 +365,7 @@ static void qemu_co_rwlock_maybe_wake_one(CoRwlock *lock)
     }
 }
 
-void qemu_co_rwlock_rdlock(CoRwlock *lock)
+void coroutine_fn qemu_co_rwlock_rdlock(CoRwlock *lock)
 {
     Coroutine *self = qemu_coroutine_self();
 
@@ -390,7 +390,7 @@ void qemu_co_rwlock_rdlock(CoRwlock *lock)
     self->locks_held++;
 }
 
-void qemu_co_rwlock_unlock(CoRwlock *lock)
+void coroutine_fn qemu_co_rwlock_unlock(CoRwlock *lock)
 {
     Coroutine *self = qemu_coroutine_self();
 
@@ -408,7 +408,7 @@ void qemu_co_rwlock_unlock(CoRwlock *lock)
     qemu_co_rwlock_maybe_wake_one(lock);
 }
 
-void qemu_co_rwlock_downgrade(CoRwlock *lock)
+void coroutine_fn qemu_co_rwlock_downgrade(CoRwlock *lock)
 {
     qemu_co_mutex_lock(&lock->mutex);
     assert(lock->owners == -1);
@@ -418,7 +418,7 @@ void qemu_co_rwlock_downgrade(CoRwlock *lock)
     qemu_co_rwlock_maybe_wake_one(lock);
 }
 
-void qemu_co_rwlock_wrlock(CoRwlock *lock)
+void coroutine_fn qemu_co_rwlock_wrlock(CoRwlock *lock)
 {
     Coroutine *self = qemu_coroutine_self();
 
@@ -438,7 +438,7 @@ void qemu_co_rwlock_wrlock(CoRwlock *lock)
     self->locks_held++;
 }
 
-void qemu_co_rwlock_upgrade(CoRwlock *lock)
+void coroutine_fn qemu_co_rwlock_upgrade(CoRwlock *lock)
 {
     qemu_co_mutex_lock(&lock->mutex);
     assert(lock->owners > 0);
-- 
2.37.3



  parent reply	other threads:[~2022-09-22 10:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22  8:48 [PATCH v3 00/26] block: fix coroutine_fn annotations Paolo Bonzini
2022-09-22  8:48 ` [PATCH 01/26] block/nvme: separate nvme_get_free_req cases for coroutine/non-coroutine context Paolo Bonzini
2022-09-22  8:49 ` [PATCH 02/26] block: add missing coroutine_fn annotations Paolo Bonzini
2022-09-22 15:11   ` Alberto Campinho Faria
2022-09-24 13:41     ` Paolo Bonzini
2022-10-05 18:11       ` Alberto Campinho Faria
2022-09-22  8:49 ` [PATCH 03/26] qcow2: remove incorrect " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 04/26] nbd: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 05/26] coroutine: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 06/26] blkdebug: add missing " Paolo Bonzini
2022-10-05 10:32   ` Kevin Wolf
2022-10-05 21:11     ` Paolo Bonzini
2022-10-06  8:45       ` Kevin Wolf
2022-09-22  8:49 ` [PATCH 07/26] blkverify: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 08/26] file-posix: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 09/26] iscsi: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 10/26] nbd: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 11/26] nfs: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 12/26] nvme: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 13/26] parallels: " Paolo Bonzini
2022-10-05 10:44   ` Kevin Wolf
2022-09-22  8:49 ` [PATCH 14/26] qcow2: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 15/26] copy-before-write: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 16/26] curl: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 17/26] qed: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 18/26] quorum: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 19/26] throttle: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 20/26] vmdk: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 21/26] job: " Paolo Bonzini
2022-09-22  8:49 ` Paolo Bonzini [this message]
2022-09-22  8:49 ` [PATCH 23/26] raw-format: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 24/26] 9p: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 25/26] migration: " Paolo Bonzini
2022-09-22  8:49 ` [PATCH 26/26] test-coroutine: " Paolo Bonzini
2022-10-06 12:17 ` [PATCH v3 00/26] block: fix " Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2022-04-15 13:18 [PATCH 00/19] " Paolo Bonzini
2022-04-15 13:18 ` [PATCH 22/26] coroutine-lock: add missing " 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=20220922084924.201610-23-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaria@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 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.