Migration pull for 9.0-rc1
- Fabiano's patch to revert fd: support on mapped-ram - Peter's fix on postcopy regression on unnecessary dirty syncs - Fabiano's fix on mapped-ram rare corrupt on zero page handling -----BEGIN PGP SIGNATURE----- iIgEABYKADAWIQS5GE3CDMRX2s990ak7X8zN86vXBgUCZf2uIxIccGV0ZXJ4QHJl ZGhhdC5jb20ACgkQO1/MzfOr1waqTgD/RjaWrcUYlHcfFcWlEQGrYqikCtZYI+oW YYdbLcCBOlQBAL/ecCbsFyaWyPnB1Eg3YFcj5g8AgogDHdg37HSxydgL =aWGi -----END PGP SIGNATURE----- Merge tag 'migration-20240322-pull-request' of https://gitlab.com/peterx/qemu into staging Migration pull for 9.0-rc1 - Fabiano's patch to revert fd: support on mapped-ram - Peter's fix on postcopy regression on unnecessary dirty syncs - Fabiano's fix on mapped-ram rare corrupt on zero page handling # -----BEGIN PGP SIGNATURE----- # # iIgEABYKADAWIQS5GE3CDMRX2s990ak7X8zN86vXBgUCZf2uIxIccGV0ZXJ4QHJl # ZGhhdC5jb20ACgkQO1/MzfOr1waqTgD/RjaWrcUYlHcfFcWlEQGrYqikCtZYI+oW # YYdbLcCBOlQBAL/ecCbsFyaWyPnB1Eg3YFcj5g8AgogDHdg37HSxydgL # =aWGi # -----END PGP SIGNATURE----- # gpg: Signature made Fri 22 Mar 2024 16:13:23 GMT # gpg: using EDDSA key B9184DC20CC457DACF7DD1A93B5FCCCDF3ABD706 # gpg: issuer "peterx@redhat.com" # gpg: Good signature from "Peter Xu <xzpeter@gmail.com>" [marginal] # gpg: aka "Peter Xu <peterx@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: B918 4DC2 0CC4 57DA CF7D D1A9 3B5F CCCD F3AB D706 * tag 'migration-20240322-pull-request' of https://gitlab.com/peterx/qemu: migration/multifd: Fix clearing of mapped-ram zero pages migration/postcopy: Fix high frequency sync migration: Revert mapped-ram multifd support to fd: URI Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
022356d79d
@ -15,42 +15,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qapi/error.h"
|
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
#include "fd.h"
|
#include "fd.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "migration.h"
|
#include "migration.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
#include "io/channel-file.h"
|
|
||||||
#include "io/channel-socket.h"
|
|
||||||
#include "io/channel-util.h"
|
#include "io/channel-util.h"
|
||||||
#include "options.h"
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
|
||||||
static struct FdOutgoingArgs {
|
|
||||||
int fd;
|
|
||||||
} outgoing_args;
|
|
||||||
|
|
||||||
int fd_args_get_fd(void)
|
|
||||||
{
|
|
||||||
return outgoing_args.fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fd_cleanup_outgoing_migration(void)
|
|
||||||
{
|
|
||||||
if (outgoing_args.fd > 0) {
|
|
||||||
close(outgoing_args.fd);
|
|
||||||
outgoing_args.fd = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
|
void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
|
||||||
{
|
{
|
||||||
QIOChannel *ioc;
|
QIOChannel *ioc;
|
||||||
int fd = monitor_get_fd(monitor_cur(), fdname, errp);
|
int fd = monitor_get_fd(monitor_cur(), fdname, errp);
|
||||||
int newfd;
|
|
||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -62,18 +39,6 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This is dup()ed just to avoid referencing an fd that might
|
|
||||||
* be already closed by the iochannel.
|
|
||||||
*/
|
|
||||||
newfd = dup(fd);
|
|
||||||
if (newfd == -1) {
|
|
||||||
error_setg_errno(errp, errno, "Could not dup FD %d", fd);
|
|
||||||
object_unref(ioc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
outgoing_args.fd = newfd;
|
|
||||||
|
|
||||||
qio_channel_set_name(ioc, "migration-fd-outgoing");
|
qio_channel_set_name(ioc, "migration-fd-outgoing");
|
||||||
migration_channel_connect(s, ioc, NULL, NULL);
|
migration_channel_connect(s, ioc, NULL, NULL);
|
||||||
object_unref(OBJECT(ioc));
|
object_unref(OBJECT(ioc));
|
||||||
@ -104,20 +69,9 @@ void fd_start_incoming_migration(const char *fdname, Error **errp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (migrate_multifd()) {
|
qio_channel_set_name(ioc, "migration-fd-incoming");
|
||||||
if (fd_is_socket(fd)) {
|
qio_channel_add_watch_full(ioc, G_IO_IN,
|
||||||
error_setg(errp,
|
fd_accept_incoming_migration,
|
||||||
"Multifd migration to a socket FD is not supported");
|
NULL, NULL,
|
||||||
object_unref(ioc);
|
g_main_context_get_thread_default());
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
file_create_incoming_channels(ioc, errp);
|
|
||||||
} else {
|
|
||||||
qio_channel_set_name(ioc, "migration-fd-incoming");
|
|
||||||
qio_channel_add_watch_full(ioc, G_IO_IN,
|
|
||||||
fd_accept_incoming_migration,
|
|
||||||
NULL, NULL,
|
|
||||||
g_main_context_get_thread_default());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,4 @@ void fd_start_incoming_migration(const char *fdname, Error **errp);
|
|||||||
|
|
||||||
void fd_start_outgoing_migration(MigrationState *s, const char *fdname,
|
void fd_start_outgoing_migration(MigrationState *s, const char *fdname,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
void fd_cleanup_outgoing_migration(void);
|
|
||||||
int fd_args_get_fd(void);
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
#include "fd.h"
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "migration.h"
|
#include "migration.h"
|
||||||
#include "io/channel-file.h"
|
#include "io/channel-file.h"
|
||||||
@ -55,27 +54,15 @@ bool file_send_channel_create(gpointer opaque, Error **errp)
|
|||||||
{
|
{
|
||||||
QIOChannelFile *ioc;
|
QIOChannelFile *ioc;
|
||||||
int flags = O_WRONLY;
|
int flags = O_WRONLY;
|
||||||
bool ret = false;
|
bool ret = true;
|
||||||
int fd = fd_args_get_fd();
|
|
||||||
|
|
||||||
if (fd && fd != -1) {
|
|
||||||
if (fd_is_socket(fd)) {
|
|
||||||
error_setg(errp,
|
|
||||||
"Multifd migration to a socket FD is not supported");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
ioc = qio_channel_file_new_dupfd(fd, errp);
|
|
||||||
} else {
|
|
||||||
ioc = qio_channel_file_new_path(outgoing_args.fname, flags, 0, errp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ioc = qio_channel_file_new_path(outgoing_args.fname, flags, 0, errp);
|
||||||
if (!ioc) {
|
if (!ioc) {
|
||||||
|
ret = false;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
multifd_channel_connect(opaque, QIO_CHANNEL(ioc));
|
multifd_channel_connect(opaque, QIO_CHANNEL(ioc));
|
||||||
ret = true;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
/*
|
/*
|
||||||
|
@ -140,10 +140,6 @@ static bool transport_supports_multi_channels(MigrationAddress *addr)
|
|||||||
if (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) {
|
if (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) {
|
||||||
SocketAddress *saddr = &addr->u.socket;
|
SocketAddress *saddr = &addr->u.socket;
|
||||||
|
|
||||||
if (saddr->type == SOCKET_ADDRESS_TYPE_FD) {
|
|
||||||
return migrate_mapped_ram();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (saddr->type == SOCKET_ADDRESS_TYPE_INET ||
|
return (saddr->type == SOCKET_ADDRESS_TYPE_INET ||
|
||||||
saddr->type == SOCKET_ADDRESS_TYPE_UNIX ||
|
saddr->type == SOCKET_ADDRESS_TYPE_UNIX ||
|
||||||
saddr->type == SOCKET_ADDRESS_TYPE_VSOCK);
|
saddr->type == SOCKET_ADDRESS_TYPE_VSOCK);
|
||||||
@ -165,15 +161,6 @@ static bool transport_supports_seeking(MigrationAddress *addr)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* At this point QEMU has not yet fetched the fd passed in by the
|
|
||||||
* user, so we cannot know for sure whether it refers to a plain
|
|
||||||
* file or a socket. Let it through anyway and check at fd.c.
|
|
||||||
*/
|
|
||||||
if (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) {
|
|
||||||
return addr->u.socket.type == SOCKET_ADDRESS_TYPE_FD;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3212,17 +3199,16 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
static MigIterateState migration_iteration_run(MigrationState *s)
|
static MigIterateState migration_iteration_run(MigrationState *s)
|
||||||
{
|
{
|
||||||
uint64_t must_precopy, can_postcopy;
|
uint64_t must_precopy, can_postcopy, pending_size;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
bool in_postcopy = s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE;
|
bool in_postcopy = s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE;
|
||||||
bool can_switchover = migration_can_switchover(s);
|
bool can_switchover = migration_can_switchover(s);
|
||||||
|
|
||||||
qemu_savevm_state_pending_estimate(&must_precopy, &can_postcopy);
|
qemu_savevm_state_pending_estimate(&must_precopy, &can_postcopy);
|
||||||
uint64_t pending_size = must_precopy + can_postcopy;
|
pending_size = must_precopy + can_postcopy;
|
||||||
|
|
||||||
trace_migrate_pending_estimate(pending_size, must_precopy, can_postcopy);
|
trace_migrate_pending_estimate(pending_size, must_precopy, can_postcopy);
|
||||||
|
|
||||||
if (must_precopy <= s->threshold_size) {
|
if (pending_size < s->threshold_size) {
|
||||||
qemu_savevm_state_pending_exact(&must_precopy, &can_postcopy);
|
qemu_savevm_state_pending_exact(&must_precopy, &can_postcopy);
|
||||||
pending_size = must_precopy + can_postcopy;
|
pending_size = must_precopy + can_postcopy;
|
||||||
trace_migrate_pending_exact(pending_size, must_precopy, can_postcopy);
|
trace_migrate_pending_exact(pending_size, must_precopy, can_postcopy);
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "exec/ramblock.h"
|
#include "exec/ramblock.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "fd.h"
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "migration.h"
|
#include "migration.h"
|
||||||
#include "migration-stats.h"
|
#include "migration-stats.h"
|
||||||
@ -112,7 +111,6 @@ void multifd_send_channel_created(void)
|
|||||||
static void multifd_set_file_bitmap(MultiFDSendParams *p)
|
static void multifd_set_file_bitmap(MultiFDSendParams *p)
|
||||||
{
|
{
|
||||||
MultiFDPages_t *pages = p->pages;
|
MultiFDPages_t *pages = p->pages;
|
||||||
uint32_t zero_num = p->pages->num - p->pages->normal_num;
|
|
||||||
|
|
||||||
assert(pages->block);
|
assert(pages->block);
|
||||||
|
|
||||||
@ -120,7 +118,7 @@ static void multifd_set_file_bitmap(MultiFDSendParams *p)
|
|||||||
ramblock_set_file_bmap_atomic(pages->block, pages->offset[i], true);
|
ramblock_set_file_bmap_atomic(pages->block, pages->offset[i], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = p->pages->num; i < zero_num; i++) {
|
for (int i = p->pages->normal_num; i < p->pages->num; i++) {
|
||||||
ramblock_set_file_bmap_atomic(pages->block, pages->offset[i], false);
|
ramblock_set_file_bmap_atomic(pages->block, pages->offset[i], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -794,7 +792,6 @@ static bool multifd_send_cleanup_channel(MultiFDSendParams *p, Error **errp)
|
|||||||
static void multifd_send_cleanup_state(void)
|
static void multifd_send_cleanup_state(void)
|
||||||
{
|
{
|
||||||
file_cleanup_outgoing_migration();
|
file_cleanup_outgoing_migration();
|
||||||
fd_cleanup_outgoing_migration();
|
|
||||||
socket_cleanup_outgoing_migration();
|
socket_cleanup_outgoing_migration();
|
||||||
qemu_sem_destroy(&multifd_send_state->channels_created);
|
qemu_sem_destroy(&multifd_send_state->channels_created);
|
||||||
qemu_sem_destroy(&multifd_send_state->channels_ready);
|
qemu_sem_destroy(&multifd_send_state->channels_ready);
|
||||||
|
@ -2536,13 +2536,6 @@ static void *migrate_precopy_fd_file_start(QTestState *from, QTestState *to)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *migrate_fd_file_mapped_ram_start(QTestState *from, QTestState *to)
|
|
||||||
{
|
|
||||||
migrate_mapped_ram_start(from, to);
|
|
||||||
|
|
||||||
return migrate_precopy_fd_file_start(from, to);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_migrate_precopy_fd_file(void)
|
static void test_migrate_precopy_fd_file(void)
|
||||||
{
|
{
|
||||||
MigrateCommon args = {
|
MigrateCommon args = {
|
||||||
@ -2553,36 +2546,6 @@ static void test_migrate_precopy_fd_file(void)
|
|||||||
};
|
};
|
||||||
test_file_common(&args, true);
|
test_file_common(&args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_migrate_precopy_fd_file_mapped_ram(void)
|
|
||||||
{
|
|
||||||
MigrateCommon args = {
|
|
||||||
.listen_uri = "defer",
|
|
||||||
.connect_uri = "fd:fd-mig",
|
|
||||||
.start_hook = migrate_fd_file_mapped_ram_start,
|
|
||||||
.finish_hook = test_migrate_fd_finish_hook
|
|
||||||
};
|
|
||||||
test_file_common(&args, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *migrate_multifd_fd_mapped_ram_start(QTestState *from,
|
|
||||||
QTestState *to)
|
|
||||||
{
|
|
||||||
migrate_multifd_mapped_ram_start(from, to);
|
|
||||||
return migrate_precopy_fd_file_start(from, to);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_multifd_fd_mapped_ram(void)
|
|
||||||
{
|
|
||||||
MigrateCommon args = {
|
|
||||||
.connect_uri = "fd:fd-mig",
|
|
||||||
.listen_uri = "defer",
|
|
||||||
.start_hook = migrate_multifd_fd_mapped_ram_start,
|
|
||||||
.finish_hook = test_migrate_fd_finish_hook
|
|
||||||
};
|
|
||||||
|
|
||||||
test_file_common(&args, true);
|
|
||||||
}
|
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
|
static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
|
||||||
@ -3687,10 +3650,6 @@ int main(int argc, char **argv)
|
|||||||
test_multifd_file_mapped_ram);
|
test_multifd_file_mapped_ram);
|
||||||
migration_test_add("/migration/multifd/file/mapped-ram/live",
|
migration_test_add("/migration/multifd/file/mapped-ram/live",
|
||||||
test_multifd_file_mapped_ram_live);
|
test_multifd_file_mapped_ram_live);
|
||||||
#ifndef _WIN32
|
|
||||||
migration_test_add("/migration/multifd/fd/mapped-ram",
|
|
||||||
test_multifd_fd_mapped_ram);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_GNUTLS
|
#ifdef CONFIG_GNUTLS
|
||||||
migration_test_add("/migration/precopy/unix/tls/psk",
|
migration_test_add("/migration/precopy/unix/tls/psk",
|
||||||
@ -3753,8 +3712,6 @@ int main(int argc, char **argv)
|
|||||||
test_migrate_precopy_fd_socket);
|
test_migrate_precopy_fd_socket);
|
||||||
migration_test_add("/migration/precopy/fd/file",
|
migration_test_add("/migration/precopy/fd/file",
|
||||||
test_migrate_precopy_fd_file);
|
test_migrate_precopy_fd_file);
|
||||||
migration_test_add("/migration/precopy/fd/file/mapped-ram",
|
|
||||||
test_migrate_precopy_fd_file_mapped_ram);
|
|
||||||
#endif
|
#endif
|
||||||
migration_test_add("/migration/validate_uuid", test_validate_uuid);
|
migration_test_add("/migration/validate_uuid", test_validate_uuid);
|
||||||
migration_test_add("/migration/validate_uuid_error",
|
migration_test_add("/migration/validate_uuid_error",
|
||||||
|
Loading…
Reference in New Issue
Block a user