mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
tests/qtest/migration: Move kvm_dirty_ring_supported to utils
Move kvm_dirty_ring_supported() to migration-util.c. Similarly to ufd_version_check(), this function is used during test definition so put it in the utils file. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
124a3c58b8
commit
2fa72ba79b
3 changed files with 30 additions and 29 deletions
|
@ -32,12 +32,6 @@
|
||||||
# endif /* CONFIG_TASN1 */
|
# endif /* CONFIG_TASN1 */
|
||||||
#endif /* CONFIG_GNUTLS */
|
#endif /* CONFIG_GNUTLS */
|
||||||
|
|
||||||
/* 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
|
|
||||||
|
|
||||||
unsigned start_address;
|
unsigned start_address;
|
||||||
unsigned end_address;
|
unsigned end_address;
|
||||||
static bool uffd_feature_thread_id;
|
static bool uffd_feature_thread_id;
|
||||||
|
@ -3435,29 +3429,6 @@ static void test_dirty_limit(void)
|
||||||
migrate_end(from, to, true);
|
migrate_end(from, to, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool kvm_dirty_ring_supported(void)
|
|
||||||
{
|
|
||||||
#if defined(__linux__) && defined(HOST_X86_64)
|
|
||||||
int ret, kvm_fd = open("/dev/kvm", O_RDONLY);
|
|
||||||
|
|
||||||
if (kvm_fd < 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ioctl(kvm_fd, KVM_CHECK_EXTENSION, KVM_CAP_DIRTY_LOG_RING);
|
|
||||||
close(kvm_fd);
|
|
||||||
|
|
||||||
/* We test with 4096 slots */
|
|
||||||
if (ret < 4096) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
bool has_kvm, has_tcg;
|
bool has_kvm, has_tcg;
|
||||||
|
|
|
@ -28,6 +28,12 @@
|
||||||
#include "qemu/userfaultfd.h"
|
#include "qemu/userfaultfd.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
|
||||||
|
|
||||||
static char *SocketAddress_to_str(SocketAddress *addr)
|
static char *SocketAddress_to_str(SocketAddress *addr)
|
||||||
{
|
{
|
||||||
|
@ -331,3 +337,26 @@ bool ufd_version_check(bool *uffd_feature_thread_id)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool kvm_dirty_ring_supported(void)
|
||||||
|
{
|
||||||
|
#if defined(__linux__) && defined(HOST_X86_64)
|
||||||
|
int ret, kvm_fd = open("/dev/kvm", O_RDONLY);
|
||||||
|
|
||||||
|
if (kvm_fd < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ioctl(kvm_fd, KVM_CHECK_EXTENSION, KVM_CAP_DIRTY_LOG_RING);
|
||||||
|
close(kvm_fd);
|
||||||
|
|
||||||
|
/* We test with 4096 slots */
|
||||||
|
if (ret < 4096) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ static inline bool probe_o_direct_support(const char *tmpfs)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool ufd_version_check(bool *uffd_feature_thread_id);
|
bool ufd_version_check(bool *uffd_feature_thread_id);
|
||||||
|
bool kvm_dirty_ring_supported(void);
|
||||||
void migration_test_add(const char *path, void (*fn)(void));
|
void migration_test_add(const char *path, void (*fn)(void));
|
||||||
char *migrate_get_connect_uri(QTestState *who);
|
char *migrate_get_connect_uri(QTestState *who);
|
||||||
void migrate_set_ports(QTestState *to, QList *channel_list);
|
void migrate_set_ports(QTestState *to, QList *channel_list);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue