[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 11/12] migration/multifd: Add integration tests for multifd wi
From: |
Yichen Wang |
Subject: |
[PATCH v9 11/12] migration/multifd: Add integration tests for multifd with Intel DSA offloading. |
Date: |
Tue, 24 Dec 2024 16:59:18 -0800 |
From: Hao Xiang <hao.xiang@linux.dev>
* Add test case to start and complete multifd live migration with DSA
offloading enabled.
* Add test case to start and cancel multifd live migration with DSA
offloading enabled.
Signed-off-by: Bryan Zhang <bryan.zhang@bytedance.com>
Signed-off-by: Hao Xiang <hao.xiang@linux.dev>
Signed-off-by: Yichen Wang <yichen.wang@bytedance.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/meson.build | 10 +++++-
tests/qtest/migration-test.c | 3 ++
tests/qtest/migration/dsa-tests.c | 59 +++++++++++++++++++++++++++++++
tests/qtest/migration/framework.h | 1 +
4 files changed, 72 insertions(+), 1 deletion(-)
create mode 100644 tests/qtest/migration/dsa-tests.c
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index c5a70021c5..17ed7f3fdc 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -355,6 +355,13 @@ if gnutls.found()
endif
endif
+migration_dsa_files = []
+if config_host_data.get('CONFIG_DSA_OPT')
+ migration_dsa_files = [files(
+ 'migration/dsa-tests.c',
+ )]
+endif
+
qtests = {
'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'],
'cdrom-test': files('boot-sector.c'),
@@ -362,7 +369,8 @@ qtests = {
'migration/migration-util.c') + dbus_vmstate1,
'erst-test': files('erst-test.c'),
'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'],
- 'migration-test': migration_files + migration_tls_files,
+ 'migration-test': migration_files + migration_tls_files + \
+ migration_dsa_files,
'pxe-test': files('boot-sector.c'),
'pnv-xive2-test': files('pnv-xive2-common.c', 'pnv-xive2-flush-sync.c'),
'qos-test': [chardev, io, qos_test_ss.apply({}).sources()],
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 5cad5060b3..9f37a36377 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -30,6 +30,9 @@ int main(int argc, char **argv)
migration_test_add_precopy(env);
migration_test_add_cpr(env);
migration_test_add_misc(env);
+#ifdef CONFIG_DSA_OPT
+ migration_test_add_dsa(env);
+#endif
ret = g_test_run();
diff --git a/tests/qtest/migration/dsa-tests.c
b/tests/qtest/migration/dsa-tests.c
new file mode 100644
index 0000000000..6b45627e63
--- /dev/null
+++ b/tests/qtest/migration/dsa-tests.c
@@ -0,0 +1,59 @@
+/*
+ * QTest testcases for DSA accelerator
+ *
+ * Copyright (C) Bytedance Ltd.
+ * based on the vhost-user-test.c that is:
+ * Copyright (c) 2014 Virtual Open Systems Sarl.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "libqtest.h"
+#include "migration/framework.h"
+#include "migration/migration-qmp.h"
+#include "migration/migration-util.h"
+
+/*
+ * It requires separate steps to configure and enable DSA device.
+ * This test assumes that the configuration is done already.
+ */
+static const char *dsa_dev_path_p = "['dsa:/dev/dsa/wq4.0']";
+static const char *dsa_dev_path = "/dev/dsa/wq4.0";
+static int test_dsa_setup(void)
+{
+ int fd;
+ fd = open(dsa_dev_path, O_RDWR);
+ if (fd < 0) {
+ return -1;
+ }
+ close(fd);
+ return 0;
+}
+
+static void *test_migrate_precopy_tcp_multifd_start_dsa(QTestState *from,
+ QTestState *to)
+{
+ migrate_set_parameter_str(from, "zero-page-detection", "dsa-accel");
+ migrate_set_parameter_str(from, "accel-path", dsa_dev_path_p);
+ return migrate_hook_start_precopy_tcp_multifd_common(from, to, "none");
+}
+
+static void test_multifd_tcp_zero_page_dsa(void)
+{
+ MigrateCommon args = {
+ .listen_uri = "defer",
+ .start_hook = test_migrate_precopy_tcp_multifd_start_dsa,
+ };
+
+ test_precopy_common(&args);
+}
+
+void migration_test_add_dsa(MigrationTestEnv *env)
+{
+ if (test_dsa_setup() == 0) {
+ migration_test_add("/migration/multifd/tcp/plain/zero-page/dsa",
+ test_multifd_tcp_zero_page_dsa);
+ }
+}
diff --git a/tests/qtest/migration/framework.h
b/tests/qtest/migration/framework.h
index e9fc4ec363..6e194cda41 100644
--- a/tests/qtest/migration/framework.h
+++ b/tests/qtest/migration/framework.h
@@ -226,5 +226,6 @@ void migration_test_add_file(MigrationTestEnv *env);
void migration_test_add_precopy(MigrationTestEnv *env);
void migration_test_add_cpr(MigrationTestEnv *env);
void migration_test_add_misc(MigrationTestEnv *env);
+void migration_test_add_dsa(MigrationTestEnv *env);
#endif /* TEST_FRAMEWORK_H */
--
Yichen Wang
- [PATCH v9 01/12] meson: Introduce new instruction set enqcmd to the build system., (continued)
- [PATCH v9 01/12] meson: Introduce new instruction set enqcmd to the build system., Yichen Wang, 2024/12/24
- [PATCH v9 02/12] util/dsa: Add idxd into linux header copy list., Yichen Wang, 2024/12/24
- [PATCH v9 03/12] util/dsa: Implement DSA device start and stop logic., Yichen Wang, 2024/12/24
- [PATCH v9 04/12] util/dsa: Implement DSA task enqueue and dequeue., Yichen Wang, 2024/12/24
- [PATCH v9 05/12] util/dsa: Implement DSA task asynchronous completion thread model., Yichen Wang, 2024/12/24
- [PATCH v9 06/12] util/dsa: Implement zero page checking in DSA task., Yichen Wang, 2024/12/24
- [PATCH v9 07/12] util/dsa: Implement DSA task asynchronous submission and wait for completion., Yichen Wang, 2024/12/24
- [PATCH v9 08/12] migration/multifd: Add new migration option for multifd DSA offloading., Yichen Wang, 2024/12/24
- [PATCH v9 09/12] migration/multifd: Enable DSA offloading in multifd sender path., Yichen Wang, 2024/12/24
- [PATCH v9 10/12] util/dsa: Add unit test coverage for Intel DSA task submission and completion., Yichen Wang, 2024/12/24
- [PATCH v9 11/12] migration/multifd: Add integration tests for multifd with Intel DSA offloading.,
Yichen Wang <=
- [PATCH v9 12/12] migration/doc: Add DSA zero page detection doc, Yichen Wang, 2024/12/24