Skip to contentSkip to conversation

migration: Fix postcopy tests

PATCH In review Fabiano Rosas 3 participants 5 messages Dec 18, 2024 – Dec 20, 2024

lore
Share & tools
lore
#0 lore raw

v2 cover migration: Fix postcopy tests

I messed up the includes when splitting the tests and the postcopy tests got disabled.

- patch 1: fix the problem, re-enabling the tests
- patch 2: imply __NR_userfaultfd from __linux__ [Peter]

Fabiano Rosas (2):
tests/qtest/migration: Re-enable postcopy tests tests/qtest/migration: Stop checking __NR_userfaultfd

 tests/qtest/migration/migration-util.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH v2 1/2 tests/qtest/migration: Re-enable postcopy tests

Postcopy tests have been inadvertently disabled since commit 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils"). That commit moved the ufd_version_check() function to another file but failed to make sense of the ifdefs and includes:

The <sys/syscall> include was incorrectly dropped. It is needed to pull in <asm/unistd.h> for __NR_userfaultfd.

The <sys/ioctl.h> was moved under the wrong ifdef.

Fixes 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils")
---
 tests/qtest/migration/migration-util.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tests/qtest/migration/migration-util.c +5 -1
index 525bf1eed4..eb3640e27e 100644
@@ -22,6 +22,11 @@
 #include "migration/bootfile.h"
 #include "migration/migration-util.h"
 
+#if defined(__linux__)
+#include <sys/ioctl.h>
+#include <sys/syscall.h>
+#endif
+
 /* for uffd_version_check() */
 #if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD)
 #include <sys/eventfd.h>
@@ -31,7 +36,6 @@
 /* For dirty ring test; so far only x86_64 is supported */
 #if defined(__linux__) && defined(HOST_X86_64)
 #include "linux/kvm.h"
-#include <sys/ioctl.h>
 #endif
 
 
Signature · 1 line
2.35.3
#2 lore raw

PATCH v2 2/2 tests/qtest/migration: Stop checking __NR_userfaultfd

In reply to Fabiano Rosas

We don't need to check for __NR_userfaultfd in the tests anymore, the syscall has been present in Linux for a long time now.

---
 tests/qtest/migration/migration-util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/qtest/migration/migration-util.c +3 -3
index eb3640e27e..23e0163945 100644
@@ -27,8 +27,8 @@
 #include <sys/syscall.h>
 #endif
 
-/* for uffd_version_check() */
-#if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD)
+/* for ufd_version_check() */
+#if defined(__linux__) && defined(CONFIG_EVENTFD)
 #include <sys/eventfd.h>
 #include "qemu/userfaultfd.h"
 #endif
@@ -301,7 +301,7 @@ bool probe_o_direct_support(const char *tmpfs)
 }
 #endif
 
-#if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD)
+#if defined(__linux__) && defined(CONFIG_EVENTFD)
 bool ufd_version_check(bool *uffd_feature_thread_id)
 {
     struct uffdio_api api_struct;
Signature · 1 line
2.35.3
#4 lore raw

Re: [PATCH v2 2/2] tests/qtest/migration: Stop checking __NR_userfaultfd

In reply to Fabiano Rosas
Quoted 2 lines · Fabiano Rosas

We don't need to check for __NR_userfaultfd in the tests anymore, the syscall has been present in Linux for a long time now.

The same is true of the migration/postcopy-ram.c code too which I think should be changed at the same time as its tests.

There are a few other places in QEMU also checking __NR_userfaultfd but not directly under migration subsystem, so change those ones at your discretion.

Quoted 34 lines
---
 tests/qtest/migration/migration-util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/qtest/migration/migration-util.c +3 -3
index eb3640e27e..23e0163945 100644
@@ -27,8 +27,8 @@
 #include <sys/syscall.h>
 #endif
 
-/* for uffd_version_check() */
-#if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD)
+/* for ufd_version_check() */
+#if defined(__linux__) && defined(CONFIG_EVENTFD)
 #include <sys/eventfd.h>
 #include "qemu/userfaultfd.h"
 #endif
@@ -301,7 +301,7 @@ bool probe_o_direct_support(const char *tmpfs)
 }
 #endif
 
-#if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD)
+#if defined(__linux__) && defined(CONFIG_EVENTFD)
 bool ufd_version_check(bool *uffd_feature_thread_id)
 {
     struct uffdio_api api_struct;
Signature · 1 line
2.35.3

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|