qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] tests: add postcopy-uffd-usermode-only capability into migra


From: Lin Ma
Subject: [PATCH 3/3] tests: add postcopy-uffd-usermode-only capability into migration-test
Date: Thu, 14 Oct 2021 17:15:51 +0800

Signed-off-by: Lin Ma <lma@suse.com>
---
 tests/qtest/migration-test.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index cc5e83d98a..0cd4f49bed 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -38,6 +38,7 @@
 unsigned start_address;
 unsigned end_address;
 static bool uffd_feature_thread_id;
+static bool uffd_usermode_only;
 
 /* A downtime where the test really should converge */
 #define CONVERGE_DOWNTIME 1000
@@ -60,8 +61,12 @@ static bool ufd_version_check(void)
     int ufd = syscall(__NR_userfaultfd, O_CLOEXEC);
 
     if (ufd == -1) {
-        g_test_message("Skipping test: userfaultfd not available");
-        return false;
+        ufd = syscall(__NR_userfaultfd, O_CLOEXEC | UFFD_USER_MODE_ONLY);
+        if (ufd == -1) {
+           g_test_message("Skipping test: userfaultfd not available");
+            return false;
+       } else
+            uffd_usermode_only = true;
     }
 
     api_struct.api = UFFD_API;
@@ -670,6 +675,8 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
     }
 
     migrate_set_capability(from, "postcopy-ram", true);
+    if (uffd_usermode_only)
+        migrate_set_capability(to, "postcopy-uffd-usermode-only", true);
     migrate_set_capability(to, "postcopy-ram", true);
     migrate_set_capability(to, "postcopy-blocktime", true);
 
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]