qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: yong.huang@smartx.com
To: qemu-devel@nongnu.org
Cc: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>,
	Richard Henderson <richard.henderson@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	yong.huang@smartx.com
Subject: [PATCH v4 6/6] tests/migration: Add case for periodic ramblock dirty sync
Date: Thu, 17 Oct 2024 14:42:55 +0800	[thread overview]
Message-ID: <cb61504f1a1e9d5f2ca4dac12e518deb076ce9f3.1729146786.git.yong.huang@smartx.com> (raw)
In-Reply-To: <cover.1729146786.git.yong.huang@smartx.com>

From: Hyman Huang <yong.huang@smartx.com>

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
 tests/qtest/migration-test.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 95e45b5029..e6a2803e71 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -2791,6 +2791,8 @@ static void test_migrate_auto_converge(void)
      * so we need to decrease a bandwidth.
      */
     const int64_t init_pct = 5, inc_pct = 25, max_pct = 95;
+    uint64_t prev_dirty_sync_cnt, dirty_sync_cnt;
+    int max_try_count, hit = 0;
 
     if (test_migrate_start(&from, &to, uri, &args)) {
         return;
@@ -2827,6 +2829,36 @@ static void test_migrate_auto_converge(void)
     } while (true);
     /* The first percentage of throttling should be at least init_pct */
     g_assert_cmpint(percentage, >=, init_pct);
+
+    /*
+     * End the loop when the dirty sync count greater than 1.
+     */
+    while ((dirty_sync_cnt = get_migration_pass(from)) < 2) {
+        usleep(1000 * 1000);
+    }
+
+    prev_dirty_sync_cnt = dirty_sync_cnt;
+
+    /*
+     * The RAMBlock dirty sync count must changes in 5 seconds, here we set
+     * the timeout to 10 seconds to ensure it changes.
+     *
+     * Note that migrate_ensure_non_converge set the max-bandwidth to 3MB/s,
+     * while the qtest mem is >= 100MB, one iteration takes at least 33s (100/3)
+     * to complete; this ensures that the RAMBlock dirty sync occurs.
+     */
+    max_try_count = 10;
+    while (--max_try_count) {
+        dirty_sync_cnt = get_migration_pass(from);
+        if (dirty_sync_cnt != prev_dirty_sync_cnt) {
+            hit = 1;
+            break;
+        }
+        prev_dirty_sync_cnt = dirty_sync_cnt;
+        sleep(1);
+    }
+    g_assert_cmpint(hit, ==, 1);
+
     /* Now, when we tested that throttling works, let it converge */
     migrate_ensure_converge(from);
 
-- 
2.27.0



  parent reply	other threads:[~2024-10-17  6:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17  6:42 [PATCH v4 0/6] migration: auto-converge refinements for huge VM yong.huang
2024-10-17  6:42 ` [PATCH v4 1/6] accel/tcg/icount-common: Remove the reference to the unused header file yong.huang
2024-10-17 17:59   ` Fabiano Rosas
2024-10-17  6:42 ` [PATCH v4 2/6] migration: Stop CPU throttling conditionally yong.huang
2024-10-17 18:02   ` Fabiano Rosas
2024-10-17  6:42 ` [PATCH v4 3/6] migration: Move cpu-throttole.c from system to migration yong.huang
2024-10-17 18:10   ` Fabiano Rosas
2024-10-17  6:42 ` [PATCH v4 4/6] migration: Remove "rs" parameter in migration_bitmap_sync_precopy yong.huang
2024-10-17  6:42 ` [PATCH v4 5/6] migration: Support periodic RAMBlock dirty bitmap sync yong.huang
2024-10-17 18:57   ` Fabiano Rosas
2024-10-17 19:33   ` Peter Xu
2024-10-17 20:35     ` Fabiano Rosas
2024-10-18  1:55     ` Yong Huang
2024-10-17  6:42 ` yong.huang [this message]
2024-10-17 19:01   ` [PATCH v4 6/6] tests/migration: Add case for periodic ramblock dirty sync Fabiano Rosas
2024-10-18 15:08 ` [PATCH v4 0/6] migration: auto-converge refinements for huge VM Peter Xu

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=cb61504f1a1e9d5f2ca4dac12e518deb076ce9f3.1729146786.git.yong.huang@smartx.com \
    --to=yong.huang@smartx.com \
    --cc=farosas@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).