From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: peterx@redhat.com, "Daniel P . Berrangé" <berrange@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Avihai Horon" <avihaih@nvidia.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Leonardo Bras Soares Passos" <lsoaresp@redhat.com>
Subject: [PATCH 2/2] qtest/migration: Use switchover-hold to speedup
Date: Fri, 2 Jun 2023 10:47:15 -0400 [thread overview]
Message-ID: <20230602144715.249002-3-peterx@redhat.com> (raw)
In-Reply-To: <20230602144715.249002-1-peterx@redhat.com>
This solution is heavily based on Daniel's original approach here, but
hopefully a cleaner way to impl:
https://lore.kernel.org/r/20230601161347.1803440-11-berrange@redhat.com
The difference is we use the switchover-hold flag rather than tuning
bw+downtime to guide test convergence, comparing to use the magic offset.
One thing needs caution is the postcopy test - we used to only make it
non-converge for precopy. Now we need the paired migrate_ensure_converge()
to make sure postcopy can still complete or otherwise the flag will stops
the final switchover from postcopy->finish.
This can achieve similar goal of previous patch "tests/qtest: massively
speed up migration-test" but without magic offset to write or monitoring.
With this flag, we can safely always run migration tests with full
speed (bw=0).
The initial solution can reduce migration-test time from 8min to 1min40s,
this patch can further reduce it from 1m40s to ~1m per my local test.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
tests/qtest/migration-test.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index b0c355bbd9..3a583238e1 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -433,16 +433,13 @@ static void migrate_set_parameter_bool(QTestState *who, const char *parameter,
static void migrate_ensure_non_converge(QTestState *who)
{
- /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */
- migrate_set_parameter_int(who, "max-bandwidth", 3 * 1000 * 1000);
- migrate_set_parameter_int(who, "downtime-limit", 1);
+ /* Hold off switchover for precopy only */
+ migrate_set_parameter_bool(who, "switchover-hold", true);
}
static void migrate_ensure_converge(QTestState *who)
{
- /* Should converge with 30s downtime + 1 gbs bandwidth limit */
- migrate_set_parameter_int(who, "max-bandwidth", 1 * 1000 * 1000 * 1000);
- migrate_set_parameter_int(who, "downtime-limit", 30 * 1000);
+ migrate_set_parameter_bool(who, "switchover-hold", false);
}
static void migrate_pause(QTestState *who)
@@ -492,6 +489,13 @@ static void migrate_postcopy_start(QTestState *from, QTestState *to)
}
qtest_qmp_eventwait(to, "RESUME");
+
+ /*
+ * Now allow precopy switchover (which will allow completion). This
+ * needs to be done after migrate-start-postcopy to make sure we switch
+ * to postcopy first.
+ */
+ migrate_ensure_converge(from);
}
typedef struct {
@@ -736,6 +740,14 @@ static int test_migrate_start(QTestState **from, QTestState **to,
unlink(shmem_path);
}
+ /*
+ * By default, use full speed for precopy in qtests as that will reduce
+ * the time of testing. The default bandwidth (128MB/s) may be too slow
+ * in this case. Specific test can overwrite this value after the
+ * function returns but before starting migration.
+ */
+ migrate_set_parameter_int(*from, "max-bandwidth", 0);
+
return 0;
}
--
2.40.1
prev parent reply other threads:[~2023-06-02 14:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 14:47 [PATCH 0/2] migration: switchover-hold flag Peter Xu
2023-06-02 14:47 ` [PATCH 1/2] migration: switchover-hold parameter Peter Xu
2023-06-05 12:27 ` Avihai Horon
2023-06-05 16:06 ` Peter Xu
2023-06-06 12:34 ` Avihai Horon
2023-06-06 15:58 ` Peter Xu
2023-06-02 14:47 ` Peter Xu [this message]
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=20230602144715.249002-3-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=avihaih@nvidia.com \
--cc=berrange@redhat.com \
--cc=lsoaresp@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thuth@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 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).