From: Hyman Huang <yong.huang@smartx.com>
To: qemu-devel@nongnu.org
Cc: "Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
"Eric Blake" <eblake@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
yong.huang@smartx.com
Subject: [PATCH RFC 07/10] tests/migration-tests: Add test case for periodic throttle
Date: Mon, 9 Sep 2024 21:47:19 +0800 [thread overview]
Message-ID: <8903506e56f2c1d36cb83b54fe4875a1253b7691.1725889277.git.yong.huang@smartx.com> (raw)
In-Reply-To: <cover.1725889277.git.yong.huang@smartx.com>
To make sure periodic throttle feature doesn't regression
any features and functionalities, enable this feature in
the auto-converge migration test.
Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
tests/qtest/migration-test.c | 56 +++++++++++++++++++++++++++++++++++-
1 file changed, 55 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 2fb10658d4..61d7182f88 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -281,6 +281,11 @@ static uint64_t get_migration_pass(QTestState *who)
return read_ram_property_int(who, "iteration-count");
}
+static uint64_t get_migration_dirty_sync_count(QTestState *who)
+{
+ return read_ram_property_int(who, "dirty-sync-count");
+}
+
static void read_blocktime(QTestState *who)
{
QDict *rsp_return;
@@ -710,6 +715,11 @@ typedef struct {
PostcopyRecoveryFailStage postcopy_recovery_fail_stage;
} MigrateCommon;
+typedef struct {
+ /* CPU throttle parameters */
+ bool periodic;
+} AutoConvergeArgs;
+
static int test_migrate_start(QTestState **from, QTestState **to,
const char *uri, MigrateStart *args)
{
@@ -2778,12 +2788,13 @@ static void test_validate_uri_channels_none_set(void)
* To make things even worse, we need to run the initial stage at
* 3MB/s so we enter autoconverge even when host is (over)loaded.
*/
-static void test_migrate_auto_converge(void)
+static void test_migrate_auto_converge_args(AutoConvergeArgs *input_args)
{
g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
MigrateStart args = {};
QTestState *from, *to;
int64_t percentage;
+ bool periodic = (input_args && input_args->periodic);
/*
* We want the test to be stable and as fast as possible.
@@ -2791,6 +2802,7 @@ 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;
+ const int64_t periodic_throttle_interval = 2;
if (test_migrate_start(&from, &to, uri, &args)) {
return;
@@ -2801,6 +2813,12 @@ static void test_migrate_auto_converge(void)
migrate_set_parameter_int(from, "cpu-throttle-increment", inc_pct);
migrate_set_parameter_int(from, "max-cpu-throttle", max_pct);
+ if (periodic) {
+ migrate_set_parameter_bool(from, "cpu-periodic-throttle", true);
+ migrate_set_parameter_int(from, "cpu-periodic-throttle-interval",
+ periodic_throttle_interval);
+ }
+
/*
* Set the initial parameters so that the migration could not converge
* without throttling.
@@ -2827,6 +2845,29 @@ 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);
+
+ if (periodic) {
+ /*
+ * Check if periodic sync take effect, set the timeout with 20s
+ * (max_try_count * 1s), if extra sync doesn't show up, fail test.
+ */
+ uint64_t iteration_count, dirty_sync_count;
+ bool extra_sync = false;
+ int max_try_count = 20;
+
+ /* Check if periodic sync take effect */
+ while (--max_try_count) {
+ usleep(1000 * 1000);
+ iteration_count = get_migration_pass(from);
+ dirty_sync_count = get_migration_dirty_sync_count(from);
+ if (dirty_sync_count > iteration_count) {
+ extra_sync = true;
+ break;
+ }
+ }
+ g_assert(extra_sync);
+ }
+
/* Now, when we tested that throttling works, let it converge */
migrate_ensure_converge(from);
@@ -2849,6 +2890,17 @@ static void test_migrate_auto_converge(void)
test_migrate_end(from, to, true);
}
+static void test_migrate_auto_converge(void)
+{
+ test_migrate_auto_converge_args(NULL);
+}
+
+static void test_migrate_auto_converge_periodic_throttle(void)
+{
+ AutoConvergeArgs args = {.periodic = true};
+ test_migrate_auto_converge_args(&args);
+}
+
static void *
test_migrate_precopy_tcp_multifd_start_common(QTestState *from,
QTestState *to,
@@ -3900,6 +3952,8 @@ int main(int argc, char **argv)
if (g_test_slow()) {
migration_test_add("/migration/auto_converge",
test_migrate_auto_converge);
+ migration_test_add("/migration/auto_converge_periodic_throttle",
+ test_migrate_auto_converge_periodic_throttle);
if (g_str_equal(arch, "x86_64") &&
has_kvm && kvm_dirty_ring_supported()) {
migration_test_add("/migration/dirty_limit",
--
2.39.1
next prev parent reply other threads:[~2024-09-09 13:49 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 13:47 [PATCH RFC 00/10] migration: auto-converge refinements for huge VM Hyman Huang
2024-09-09 13:47 ` [PATCH RFC 01/10] migration: Introduce structs for periodic CPU throttle Hyman Huang
2024-09-09 13:47 ` [PATCH RFC 02/10] migration: Refine util functions to support " Hyman Huang
2024-09-09 13:47 ` [PATCH RFC 03/10] qapi/migration: Introduce periodic CPU throttling parameters Hyman Huang
2024-09-09 13:47 ` [PATCH RFC 04/10] qapi/migration: Introduce the iteration-count Hyman Huang
2024-09-09 13:47 ` [PATCH RFC 05/10] migration: Introduce util functions for periodic CPU throttle Hyman Huang
2024-09-09 13:47 ` [PATCH RFC 06/10] migration: Support " Hyman Huang
2024-09-09 13:47 ` Hyman Huang [this message]
2024-09-09 13:47 ` [PATCH RFC 08/10] migration: Introduce cpu-responsive-throttle parameter Hyman Huang
2024-09-09 13:47 ` [PATCH RFC 09/10] migration: Support responsive CPU throttle Hyman Huang
2024-09-09 13:47 ` [PATCH RFC 10/10] tests/migration-tests: Add test case for " Hyman Huang
2024-09-09 14:02 ` Peter Maydell
2024-09-09 14:36 ` Peter Xu
2024-09-09 21:54 ` Fabiano Rosas
2024-09-10 21:22 ` Peter Xu
2024-09-10 22:23 ` Fabiano Rosas
2024-09-11 15:59 ` Peter Xu
2024-09-11 19:48 ` Fabiano Rosas
2024-09-11 20:37 ` Peter Xu
2024-09-11 21:26 ` Fabiano Rosas
2024-09-12 8:13 ` Peter Maydell
2024-09-12 13:48 ` Fabiano Rosas
2024-09-12 14:09 ` Peter Maydell
2024-09-12 14:28 ` Fabiano Rosas
2024-09-12 15:09 ` Peter Xu
2024-09-12 15:14 ` Peter Maydell
2024-09-13 15:02 ` Peter Xu
2024-09-12 15:37 ` Fabiano Rosas
2024-09-12 22:52 ` Fabiano Rosas
2024-09-13 15:00 ` Peter Xu
2024-09-13 15:09 ` Fabiano Rosas
2024-09-13 15:17 ` Fabiano Rosas
2024-09-13 15:38 ` Peter Xu
2024-09-13 17:51 ` Fabiano Rosas
2024-09-09 14:43 ` Yong Huang
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=8903506e56f2c1d36cb83b54fe4875a1253b7691.1725889277.git.yong.huang@smartx.com \
--to=yong.huang@smartx.com \
--cc=armbru@redhat.com \
--cc=david@redhat.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.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 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).