From: Shota Imamura <cosocaf@gmail.com>
To: qemu-devel@nongnu.org
Cc: Shota Imamura <cosocaf@gmail.com>, Peter Xu <peterx@redhat.com>,
Fabiano Rosas <farosas@suse.de>, Thomas Huth <thuth@redhat.com>,
Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH 2/2] qtest/migration: Add dirty ring tests
Date: Thu, 20 Jun 2024 18:47:14 +0900 [thread overview]
Message-ID: <20240620094714.871727-3-cosocaf@gmail.com> (raw)
In-Reply-To: <20240620094714.871727-1-cosocaf@gmail.com>
This commit adds tests for migration using the dirty ring. To avoid
confusion with KVM's dirty ring, use_dirty_ring has been changed to
use_kvm_dirty_ring, and use_qemu_dirty_ring has been added.
Signed-off-by: Shota Imamura <cosocaf@gmail.com>
---
tests/qtest/migration-test.c | 78 ++++++++++++++++++++++++++++++++----
1 file changed, 70 insertions(+), 8 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 0dccb4beff..a8151b9470 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -556,7 +556,8 @@ typedef struct {
/* only launch the target process */
bool only_target;
/* Use dirty ring if true; dirty logging otherwise */
- bool use_dirty_ring;
+ bool use_kvm_dirty_ring;
+ bool use_qemu_dirty_ring;
const char *opts_source;
const char *opts_target;
/* suspend the src before migrating to dest. */
@@ -675,6 +676,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
g_autofree char *shmem_opts = NULL;
g_autofree char *shmem_path = NULL;
const char *kvm_opts = NULL;
+ const char *migration_ops = NULL;
const char *arch = qtest_get_arch();
const char *memory_size;
const char *machine_alias, *machine_opts = "";
@@ -754,10 +756,16 @@ static int test_migrate_start(QTestState **from, QTestState **to,
memory_size, shmem_path);
}
- if (args->use_dirty_ring) {
+ if (args->use_kvm_dirty_ring) {
kvm_opts = ",dirty-ring-size=4096";
}
+ if (args->use_qemu_dirty_ring) {
+ migration_ops = "dirty-logging=ring,dirty-ring-size=32768";
+ } else {
+ migration_ops = "dirty-logging=bitmap";
+ }
+
if (!qtest_has_machine(machine_alias)) {
g_autofree char *msg = g_strdup_printf("machine %s not supported", machine_alias);
g_test_skip(msg);
@@ -774,10 +782,12 @@ static int test_migrate_start(QTestState **from, QTestState **to,
"-name source,debug-threads=on "
"-m %s "
"-serial file:%s/src_serial "
+ "-migration %s "
"%s %s %s %s %s",
kvm_opts ? kvm_opts : "",
machine, machine_opts,
memory_size, tmpfs,
+ migration_ops,
arch_opts ? arch_opts : "",
arch_source ? arch_source : "",
shmem_opts ? shmem_opts : "",
@@ -1796,12 +1806,27 @@ static void test_precopy_unix_suspend_notlive(void)
test_precopy_common(&args);
}
-static void test_precopy_unix_dirty_ring(void)
+static void test_precopy_unix_qemu_dirty_ring(void)
{
g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
MigrateCommon args = {
.start = {
- .use_dirty_ring = true,
+ .use_qemu_dirty_ring = true,
+ },
+ .listen_uri = uri,
+ .connect_uri = uri,
+ .live = true,
+ };
+
+ test_precopy_common(&args);
+}
+
+static void test_precopy_unix_kvm_dirty_ring(void)
+{
+ g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+ MigrateCommon args = {
+ .start = {
+ .use_kvm_dirty_ring = true,
},
.listen_uri = uri,
.connect_uri = uri,
@@ -1815,6 +1840,22 @@ static void test_precopy_unix_dirty_ring(void)
test_precopy_common(&args);
}
+static void test_precopy_unix_kvm_and_qemu_dirty_ring(void)
+{
+ g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+ MigrateCommon args = {
+ .start = {
+ .use_kvm_dirty_ring = true,
+ .use_qemu_dirty_ring = true,
+ },
+ .listen_uri = uri,
+ .connect_uri = uri,
+ .live = true,
+ };
+
+ test_precopy_common(&args);
+}
+
#ifdef CONFIG_GNUTLS
static void test_precopy_unix_tls_psk(void)
{
@@ -1942,6 +1983,21 @@ static void test_precopy_file(void)
test_file_common(&args, true);
}
+static void test_precopy_file_dirty_ring(void)
+{
+ g_autofree char *uri = g_strdup_printf("file:%s/%s", tmpfs,
+ FILE_TEST_FILENAME);
+ MigrateCommon args = {
+ .start = {
+ .use_qemu_dirty_ring = true,
+ },
+ .connect_uri = uri,
+ .listen_uri = "defer",
+ };
+
+ test_file_common(&args, true);
+}
+
static void file_offset_finish_hook(QTestState *from, QTestState *to,
void *opaque)
{
@@ -3298,7 +3354,7 @@ static void test_migrate_dirty_limit(void)
MigrateCommon args = {
.start = {
.hide_stderr = true,
- .use_dirty_ring = true,
+ .use_kvm_dirty_ring = true,
},
.listen_uri = uri,
.connect_uri = uri,
@@ -3342,7 +3398,7 @@ static void test_migrate_dirty_limit(void)
args = (MigrateCommon) {
.start = {
.only_target = true,
- .use_dirty_ring = true,
+ .use_kvm_dirty_ring = true,
},
.listen_uri = uri,
.connect_uri = uri,
@@ -3504,10 +3560,14 @@ int main(int argc, char **argv)
migration_test_add("/migration/precopy/unix/plain",
test_precopy_unix_plain);
+ migration_test_add("/migration/precopy/unix/dirty_ring",
+ test_precopy_unix_qemu_dirty_ring);
migration_test_add("/migration/precopy/unix/xbzrle",
test_precopy_unix_xbzrle);
migration_test_add("/migration/precopy/file",
test_precopy_file);
+ migration_test_add("/migration/precopy/file/dirty_ring",
+ test_precopy_file_dirty_ring);
migration_test_add("/migration/precopy/file/offset",
test_precopy_file_offset);
migration_test_add("/migration/precopy/file/offset/bad",
@@ -3660,8 +3720,10 @@ int main(int argc, char **argv)
#endif /* CONFIG_GNUTLS */
if (g_str_equal(arch, "x86_64") && has_kvm && kvm_dirty_ring_supported()) {
- migration_test_add("/migration/dirty_ring",
- test_precopy_unix_dirty_ring);
+ migration_test_add("/migration/precopy/unix/kvm_dirty_ring",
+ test_precopy_unix_kvm_dirty_ring);
+ migration_test_add("/migration/precopy/unix/kvm_and_qemu_dirty_ring",
+ test_precopy_unix_kvm_and_qemu_dirty_ring);
migration_test_add("/migration/vcpu_dirty_limit",
test_vcpu_dirty_limit);
}
--
2.34.1
prev parent reply other threads:[~2024-06-20 13:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 9:47 [PATCH 0/2] Implement dirty ring for pre-copy migration Shota Imamura
2024-06-20 9:47 ` [PATCH 1/2] migration: Implement dirty ring Shota Imamura
2024-06-24 19:08 ` Peter Xu
2024-06-25 11:10 ` Shota Imamura
2024-06-25 21:51 ` Peter Xu
2024-06-20 9:47 ` Shota Imamura [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=20240620094714.871727-3-cosocaf@gmail.com \
--to=cosocaf@gmail.com \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--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 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.