tests/qtest/migration: Restore include for postcopy
PATCH 1/1 tests/qtest/migration: Restore include for postcopy
Commit 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils") moved the ufd_version_check() function to another file but failed to bring along the <sys/syscall> include, which is necessary to pull in <asm/unistd.h> for __NR_userfaultd.
Restore the missing include.
While here, remove the ifdef __linux__ that's redundant and fix a couple of typos.
--- tests/qtest/migration/migration-util.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
tests/qtest/migration/migration-util.c +8 -4
@@ -22,8 +22,12 @@#include "migration/bootfile.h" #include "migration/migration-util.h" -/* for uffd_version_check() */ -#if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD ) +#if defined(__linux__) +#include <sys/syscall.h> +#endif + +/* for ufd_version_check() */ +#if defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD )#include <sys/eventfd.h> #include "qemu/userfaultfd.h" #endif
@@ -297,7 +301,7 @@ bool probe_o_direct_support(const char *tmpfs) }#endif -#if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD ) +#if defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD )bool ufd_version_check (bool *uffd_feature_thread_id) {struct uffdio_api api_struct;
@@ -333,7 +337,7 @@ bool ufd_version_check(bool *uffd_feature_thread_id)#else bool ufd_version_check (bool *uffd_feature_thread_id) { -g_test_message ("Skipping test: Userfault not available (builtdtime)" ); +g_test_message ("Skipping test: Userfault not available (buildtime)" );return false; }#endif
Signature · 1 line
2.35.3
Quoted 6 lines · Fabiano Rosas
Commit
124a3c58b8("tests/qtest/migration: Moveufd_version_checkto utils") moved theufd_version_check()function to another file but failed to bring along the <sys/syscall> include, which is necessary to pull in <asm/unistd.h> for__NR_userfaultd.Restore the missing include.
Ohhhhhhh.. so postcopy tests will always be skipped as of now? Maybe worth explicit mention that in the commit message if so, only when you merge.
Quoted 6 lines
While here, remove the ifdef
__linux__that's redundant and fix a couple of typos.Fixes 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils")Signed-off-by Fabiano Rosas <[email protected]>
Maybe we don't need to be as careful on old kernels anymore especially in tests, because userfaultfd syscall existed for ~10 years. So if we want we can start requiring __NR_userfaultfd present for __linux__, then no way to miss such spot next time.
Signature · 1 line
Peter Xu
Quoted 18 lines · Peter Xu
Quoted 6 lines · Fabiano Rosas
Commit
124a3c58b8("tests/qtest/migration: Moveufd_version_checkto utils") moved theufd_version_check()function to another file but failed to bring along the <sys/syscall> include, which is necessary to pull in <asm/unistd.h> for__NR_userfaultd.Restore the missing include.
Ohhhhhhh.. so postcopy tests will always be skipped as of now? Maybe worth explicit mention that in the commit message if so, only when you merge.
Quoted 6 lines
While here, remove the ifdef
__linux__that's redundant and fix a couple of typos.Fixes 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils")Signed-off-by Fabiano Rosas <[email protected]>
Quoted 6 lines
Reviewed-by Peter Xu <[email protected]>Maybe we don't need to be as careful on old kernels anymore especially in tests, because userfaultfd syscall existed for ~10 years. So if we want we can start requiring
__NR_userfaultfdpresent for__linux__, then no way to miss such spot next time.
Yes, I think that check is obsolete, based on our supported platforms list. It would suffice to just check __linux__.
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 :|
Quoted 21 lines · Daniel P. Berrangé
Quoted 20 lines · Peter Xu
Quoted 6 lines · Fabiano Rosas
Commit
124a3c58b8("tests/qtest/migration: Moveufd_version_checkto utils") moved theufd_version_check()function to another file but failed to bring along the <sys/syscall> include, which is necessary to pull in <asm/unistd.h> for__NR_userfaultd.Restore the missing include.
Ohhhhhhh.. so postcopy tests will always be skipped as of now? Maybe worth explicit mention that in the commit message if so, only when you merge.
Quoted 6 lines
While here, remove the ifdef
__linux__that's redundant and fix a couple of typos.Fixes 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils")Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Peter Xu <[email protected]>
Quoted 7 lines
Quoted 4 lines
Maybe we don't need to be as careful on old kernels anymore especially in tests, because userfaultfd syscall existed for ~10 years. So if we want we can start requiring
__NR_userfaultfdpresent for__linux__, then no way to miss such spot next time.Yes, I think that check is obsolete, based on our supported platforms list. It would suffice to just check
__linux__.
This breaks the cross builds. It seems the __NR_userfaultfd was actually stopping several archs from reaching ufd_version_check(). Since <sys/ioctl.h> is under HOST_X86_64, these new instances now fail to find the 'ioctl' symbol:
https://gitlab.com/farosas/qemu/-/pipelines/1594332399
Of course I could just include <sys/ioctl.h> unconditionally, but the fact that new code is not being built means the assumption that we can imply __NR_userfaultfd from __linux__ alone is not correct.
Quoted 36 lines · Fabiano Rosas
Quoted 21 lines · Daniel P. Berrangé
Quoted 20 lines · Peter Xu
Quoted 6 lines · Fabiano Rosas
Commit
124a3c58b8("tests/qtest/migration: Moveufd_version_checkto utils") moved theufd_version_check()function to another file but failed to bring along the <sys/syscall> include, which is necessary to pull in <asm/unistd.h> for__NR_userfaultd.Restore the missing include.
Ohhhhhhh.. so postcopy tests will always be skipped as of now? Maybe worth explicit mention that in the commit message if so, only when you merge.
Quoted 6 lines
While here, remove the ifdef
__linux__that's redundant and fix a couple of typos.Fixes 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils")Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Peter Xu <[email protected]>Quoted 7 lines
Quoted 4 lines
Maybe we don't need to be as careful on old kernels anymore especially in tests, because userfaultfd syscall existed for ~10 years. So if we want we can start requiring
__NR_userfaultfdpresent for__linux__, then no way to miss such spot next time.Yes, I think that check is obsolete, based on our supported platforms list. It would suffice to just check
__linux__.This breaks the cross builds. It seems the
__NR_userfaultfdwas actually stopping several archs from reachingufd_version_check(). Since <sys/ioctl.h> is underHOST_X86_64, these new instances now fail to find the 'ioctl' symbol:
Quoted 5 lines
https://gitlab.com/farosas/qemu/-/pipelines/1594332399
Of course I could just include <
sys/ioctl.h> unconditionally, but the fact that new code is not being built means the assumption that we can imply__NR_userfaultfdfrom__linux__alone is not correct.
What is the new code referenced here? I still don't yet understand how it would fail if we move sys/ioctl.h out.
PS: we don't necessarily need to do it right now to remove that ifdef, but I'm just curious.
Signature · 1 line
Peter Xu
Quoted 36 lines · Fabiano Rosas
Quoted 21 lines · Daniel P. Berrangé
Quoted 20 lines · Peter Xu
Quoted 6 lines · Fabiano Rosas
Commit
124a3c58b8("tests/qtest/migration: Moveufd_version_checkto utils") moved theufd_version_check()function to another file but failed to bring along the <sys/syscall> include, which is necessary to pull in <asm/unistd.h> for__NR_userfaultd.Restore the missing include.
Ohhhhhhh.. so postcopy tests will always be skipped as of now? Maybe worth explicit mention that in the commit message if so, only when you merge.
Quoted 6 lines
While here, remove the ifdef
__linux__that's redundant and fix a couple of typos.Fixes 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils")Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Peter Xu <[email protected]>Quoted 7 lines
Quoted 4 lines
Maybe we don't need to be as careful on old kernels anymore especially in tests, because userfaultfd syscall existed for ~10 years. So if we want we can start requiring
__NR_userfaultfdpresent for__linux__, then no way to miss such spot next time.Yes, I think that check is obsolete, based on our supported platforms list. It would suffice to just check
__linux__.This breaks the cross builds. It seems the
__NR_userfaultfdwas actually stopping several archs from reachingufd_version_check(). Since <sys/ioctl.h> is underHOST_X86_64, these new instances now fail to find the 'ioctl' symbol:
Quoted 5 lines
https://gitlab.com/farosas/qemu/-/pipelines/1594332399
Of course I could just include <
sys/ioctl.h> unconditionally, but the fact that new code is not being built means the assumption that we can imply__NR_userfaultfdfrom__linux__alone is not correct.
I think removing __NR_userfaultfd is still correct. The problem is that the ufd_version_check code is wrapped in a conditional that is not the same as the conditional that pulls in ioctl.h. That pre-existing bug should be fixed regardless, and once that's done, removing __NR_userfaultfd wouldn't be an issue.
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 :|
Quoted 43 lines · Daniel P. Berrangé
Quoted 36 lines · Fabiano Rosas
Quoted 21 lines · Daniel P. Berrangé
Quoted 20 lines · Peter Xu
Quoted 6 lines · Fabiano Rosas
Commit
124a3c58b8("tests/qtest/migration: Moveufd_version_checkto utils") moved theufd_version_check()function to another file but failed to bring along the <sys/syscall> include, which is necessary to pull in <asm/unistd.h> for__NR_userfaultd.Restore the missing include.
Ohhhhhhh.. so postcopy tests will always be skipped as of now? Maybe worth explicit mention that in the commit message if so, only when you merge.
Quoted 6 lines
While here, remove the ifdef
__linux__that's redundant and fix a couple of typos.Fixes 124a3c58b8 ("tests/qtest/migration: Move ufd_version_check to utils")Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Peter Xu <[email protected]>Quoted 7 lines
Quoted 4 lines
Maybe we don't need to be as careful on old kernels anymore especially in tests, because userfaultfd syscall existed for ~10 years. So if we want we can start requiring
__NR_userfaultfdpresent for__linux__, then no way to miss such spot next time.Yes, I think that check is obsolete, based on our supported platforms list. It would suffice to just check
__linux__.This breaks the cross builds. It seems the
__NR_userfaultfdwas actually stopping several archs from reachingufd_version_check(). Since <sys/ioctl.h> is underHOST_X86_64, these new instances now fail to find the 'ioctl' symbol:Quoted 5 lines
https://gitlab.com/farosas/qemu/-/pipelines/1594332399
Of course I could just include <
sys/ioctl.h> unconditionally, but the fact that new code is not being built means the assumption that we can imply__NR_userfaultfdfrom__linux__alone is not correct.
Quoted 5 lines
I think removing
__NR_userfaultfdis still correct. The problem is that theufd_version_checkcode is wrapped in a conditional that is not the same as the conditional that pulls inioctl.h. That pre-existing bug should be fixed regardless, and once that's done, removing__NR_userfaultfdwouldn't be an issue.
Ah, the <sys/ioctl.h> include used to be under the userfaultfd ifdefs. I got confused because kvm_dirty_ring_supported() also needs the ioctl and it was introduced without moving the ioctl to a common ifdef.
Quoted 3 lines
With regards,
Daniel