All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: hreitz@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org,
	sguelton@redhat.com
Subject: [PATCH 13/35] /basic/yield
Date: Thu, 10 Mar 2022 13:43:51 +0100	[thread overview]
Message-ID: <20220310124413.1102441-14-pbonzini@redhat.com> (raw)
In-Reply-To: <20220310124413.1102441-1-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/unit/test-coroutine.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c
index 3670750c5b..ae06e97c95 100644
--- a/tests/unit/test-coroutine.c
+++ b/tests/unit/test-coroutine.c
@@ -141,15 +141,33 @@ static void test_nesting(void)
  * Check that yield/enter transfer control correctly
  */
 
-static void coroutine_fn yield_5_times(void *opaque)
+#endif
+CO_DECLARE_FRAME(yield_5_times, void *opaque, int i);
+static CoroutineAction co__yield_5_times(void *_frame)
 {
+    struct FRAME__yield_5_times *_f = _frame;
+    CO_ARG(opaque);
     bool *done = opaque;
-    int i;
+    CO_DECLARE(i);
 
+switch(_f->_step) {
+case 0:
     for (i = 0; i < 5; i++) {
-        qemu_coroutine_yield();
+CO_SAVE(i);
+_f->_step = 1;
+        return qemu_coroutine_yield();
+case 1:
+CO_LOAD(i);
     }
     *done = true;
+    break;
+}
+return stack_free(&_f->common);
+}
+
+static CoroutineAction yield_5_times(void *opaque)
+{
+    return CO_INIT_FRAME(yield_5_times, opaque);
 }
 
 static void test_yield(void)
@@ -166,6 +184,7 @@ static void test_yield(void)
     g_assert_cmpint(i, ==, 5); /* coroutine must yield 5 times */
 }
 
+#if 0
 static void coroutine_fn c2_fn(void *opaque)
 {
     qemu_coroutine_yield();
@@ -659,8 +678,8 @@ int main(int argc, char **argv)
 #endif
 
     g_test_add_func("/basic/lifecycle", test_lifecycle);
-#if 0
     g_test_add_func("/basic/yield", test_yield);
+#if 0
     g_test_add_func("/basic/nesting", test_nesting);
     g_test_add_func("/basic/self", test_self);
     g_test_add_func("/basic/entered", test_entered);
-- 
2.35.1




  parent reply	other threads:[~2022-03-10 12:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 12:43 [PATCH experiment 00/35] stackless coroutine backend Paolo Bonzini
2022-03-10 12:43 ` [PATCH 01/35] coroutine: add missing coroutine_fn annotations for CoRwlock functions Paolo Bonzini
2022-03-10 12:43 ` [PATCH 02/35] coroutine: qemu_coroutine_get_aio_context is not a coroutine_fn Paolo Bonzini
2022-03-10 12:43 ` [PATCH 03/35] coroutine: introduce QemuCoLockable Paolo Bonzini
2022-03-10 12:43 ` [PATCH 04/35] coroutine: introduce coroutine_only_fn Paolo Bonzini
2022-03-10 12:43 ` [PATCH 05/35] coroutine: small code cleanup in qemu_co_rwlock_wrlock Paolo Bonzini
2022-03-10 14:10   ` Philippe Mathieu-Daudé
2022-03-10 12:43 ` [PATCH 06/35] disable some code Paolo Bonzini
2022-03-10 12:43 ` [PATCH 07/35] coroutine: introduce the "stackless coroutine" backend Paolo Bonzini
2022-03-10 12:43 ` [PATCH 08/35] /basic/lifecycle Paolo Bonzini
2022-03-10 12:43 ` [PATCH 09/35] convert qemu-coroutine-sleep.c to stackless coroutines Paolo Bonzini
2022-03-10 12:43 ` [PATCH 10/35] enable tail call optimization of qemu_co_mutex_lock Paolo Bonzini
2022-03-10 12:43 ` [PATCH 11/35] convert CoMutex to stackless coroutines Paolo Bonzini
2022-03-10 12:43 ` [PATCH 12/35] define magic macros for " Paolo Bonzini
2022-03-10 12:43 ` Paolo Bonzini [this message]
2022-03-10 12:43 ` [PATCH 14/35] /basic/nesting Paolo Bonzini
2022-03-10 12:43 ` [PATCH 15/35] /basic/self Paolo Bonzini
2022-03-10 12:43 ` [PATCH 16/35] /basic/entered Paolo Bonzini
2022-03-10 12:43 ` [PATCH 17/35] /basic/in_coroutine Paolo Bonzini
2022-03-10 12:43 ` [PATCH 18/35] /basic/order Paolo Bonzini
2022-03-10 12:43 ` [PATCH 19/35] /perf/lifecycle Paolo Bonzini
2022-03-10 12:43 ` [PATCH 20/35] /perf/nesting Paolo Bonzini
2022-03-10 12:43 ` [PATCH 21/35] /perf/yield Paolo Bonzini
2022-03-10 12:44 ` [PATCH 22/35] /perf/function-call Paolo Bonzini
2022-03-10 12:44 ` [PATCH 23/35] /perf/cost Paolo Bonzini
2022-03-10 12:44 ` [PATCH 24/35] /basic/no-dangling-access Paolo Bonzini
2022-03-10 12:44 ` [PATCH 25/35] /locking/co-mutex Paolo Bonzini
2022-03-10 12:44 ` [PATCH 26/35] convert qemu_co_mutex_lock_slowpath to magic macros Paolo Bonzini
2022-03-10 12:44 ` [PATCH 27/35] /locking/co-mutex/lockable Paolo Bonzini
2022-03-10 12:44 ` [PATCH 28/35] qemu_co_rwlock_maybe_wake_one Paolo Bonzini
2022-03-10 12:44 ` [PATCH 29/35] qemu_co_rwlock_rdlock Paolo Bonzini
2022-03-10 12:44 ` [PATCH 30/35] qemu_co_rwlock_unlock Paolo Bonzini
2022-03-10 12:44 ` [PATCH 31/35] qemu_co_rwlock_downgrade Paolo Bonzini
2022-03-10 12:44 ` [PATCH 32/35] qemu_co_rwlock_wrlock Paolo Bonzini
2022-03-10 12:44 ` [PATCH 33/35] qemu_co_rwlock_upgrade Paolo Bonzini
2022-03-10 12:44 ` [PATCH 34/35] /locking/co-rwlock/upgrade Paolo Bonzini
2022-03-10 12:44 ` [PATCH 35/35] /locking/co-rwlock/downgrade Paolo Bonzini
2022-03-10 17:42 ` [PATCH experiment 00/35] stackless coroutine backend Stefan Hajnoczi
2022-03-10 20:14   ` Paolo Bonzini
2022-03-11  9:27     ` Stefan Hajnoczi
2022-03-11 12:04       ` Paolo Bonzini
2022-03-11 12:17         ` Daniel P. Berrangé
2022-03-13 15:18           ` Paolo Bonzini
2022-03-14 13:43             ` Stefan Hajnoczi

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=20220310124413.1102441-14-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sguelton@redhat.com \
    --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.