From: "Daniel P. Berrangé" <berrange@redhat.com>
To: peterx@redhat.com
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
Prasad Pandit <ppandit@redhat.com>,
Fabiano Rosas <farosas@suse.de>
Subject: Re: [PULL 25/27] migration/multifd: Add mapped-ram support to fd: URI
Date: Mon, 11 Mar 2024 12:03:41 +0000 [thread overview]
Message-ID: <Ze7zHaHBaCRO8qKu@redhat.com> (raw)
In-Reply-To: <20240304012634.95520-26-peterx@redhat.com>
On Mon, Mar 04, 2024 at 09:26:32AM +0800, peterx@redhat.com wrote:
> From: Fabiano Rosas <farosas@suse.de>
>
> If we receive a file descriptor that points to a regular file, there's
> nothing stopping us from doing multifd migration with mapped-ram to
> that file.
>
> Enable the fd: URI to work with multifd + mapped-ram.
>
> Note that the fds passed into multifd are duplicated because we want
> to avoid cross-thread effects when doing cleanup (i.e. close(fd)). The
> original fd doesn't need to be duplicated because monitor_get_fd()
> transfers ownership to the caller.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> Reviewed-by: Peter Xu <peterx@redhat.com>
> Link: https://lore.kernel.org/r/20240229153017.2221-23-farosas@suse.de
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> migration/fd.h | 2 ++
> migration/fd.c | 44 +++++++++++++++++++++++++++++++++++++++++++
> migration/file.c | 18 ++++++++++++------
> migration/migration.c | 4 ++++
> migration/multifd.c | 2 ++
> 5 files changed, 64 insertions(+), 6 deletions(-)
>
> @@ -73,4 +98,23 @@ void fd_start_incoming_migration(const char *fdname, Error **errp)
> fd_accept_incoming_migration,
> NULL, NULL,
> g_main_context_get_thread_default());
> +
> + if (migrate_multifd()) {
> + int channels = migrate_multifd_channels();
> +
> + while (channels--) {
> + ioc = QIO_CHANNEL(qio_channel_file_new_fd(dup(fd)));
> +
> + if (QIO_CHANNEL_FILE(ioc)->fd == -1) {
> + error_setg(errp, "Failed to duplicate fd %d", fd);
> + return;
> + }
I'd suggest that Peter's comment about failure checks be fixed
by introducing a new constructor that handles the dup + error
reporting.
QIOChannel *qio_channel_file_new_dupfd(int fd, Error **errp;)
so we're not repeating the error reporting multiple places.
> +
> + 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());
> + }
> + }
> }
With regards,
Daniel
--
|: 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 :|
next prev parent reply other threads:[~2024-03-11 12:04 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 1:26 [PULL 00/27] Migration next patches peterx
2024-03-04 1:26 ` [PULL 01/27] migration: massage cpr-reboot documentation peterx
2024-03-04 1:26 ` [PULL 02/27] migration: Properly apply migration compression level parameters peterx
2024-03-04 1:26 ` [PULL 03/27] tests/migration: Set compression level in migration tests peterx
2024-03-04 1:26 ` [PULL 04/27] migration/multifd: Cleanup multifd_recv_sync_main peterx
2024-03-04 1:26 ` [PULL 05/27] io: add and implement QIO_CHANNEL_FEATURE_SEEKABLE for channel file peterx
2024-03-04 1:26 ` [PULL 06/27] io: Add generic pwritev/preadv interface peterx
2024-03-04 1:26 ` [PULL 07/27] io: implement io_pwritev/preadv for QIOChannelFile peterx
2024-03-04 1:26 ` [PULL 08/27] io: fsync before closing a file channel peterx
2024-03-04 1:26 ` [PULL 09/27] migration/qemu-file: add utility methods for working with seekable channels peterx
2024-03-04 1:26 ` [PULL 10/27] migration/ram: Introduce 'mapped-ram' migration capability peterx
2024-03-04 1:26 ` [PULL 11/27] migration: Add mapped-ram URI compatibility check peterx
2024-03-04 1:26 ` [PULL 12/27] migration/ram: Add outgoing 'mapped-ram' migration peterx
2024-03-04 1:26 ` [PULL 13/27] migration/ram: Add incoming " peterx
2024-03-04 1:26 ` [PULL 14/27] tests/qtest/migration: Add tests for mapped-ram file-based migration peterx
2024-03-04 1:26 ` [PULL 15/27] migration/multifd: Rename MultiFDSend|RecvParams::data to compress_data peterx
2024-03-04 1:26 ` [PULL 16/27] migration/multifd: Decouple recv method from pages peterx
2024-03-04 1:26 ` [PULL 17/27] migration/multifd: Allow multifd without packets peterx
2024-03-04 1:26 ` [PULL 18/27] migration/multifd: Allow receiving pages " peterx
2024-03-04 1:26 ` [PULL 19/27] migration/multifd: Add a wrapper for channels_created peterx
2024-03-04 1:26 ` [PULL 20/27] migration/multifd: Add outgoing QIOChannelFile support peterx
2024-03-04 1:26 ` [PULL 21/27] migration/multifd: Add incoming " peterx
2024-03-04 1:26 ` [PULL 22/27] migration/multifd: Prepare multifd sync for mapped-ram migration peterx
2024-03-04 1:26 ` [PULL 23/27] migration/multifd: Support outgoing mapped-ram stream format peterx
2024-03-04 1:26 ` [PULL 24/27] migration/multifd: Support incoming " peterx
2024-03-04 1:26 ` [PULL 25/27] migration/multifd: Add mapped-ram support to fd: URI peterx
2024-03-11 11:50 ` Peter Maydell
2024-03-11 11:54 ` Peter Maydell
2024-03-11 12:03 ` Daniel P. Berrangé [this message]
2024-03-11 13:30 ` Peter Xu
2024-03-04 1:26 ` [PULL 26/27] tests/qtest/migration: Add a multifd + mapped-ram migration test peterx
2024-03-04 1:26 ` [PULL 27/27] migration/multifd: Document two places for mapped-ram peterx
2024-03-05 13:44 ` [PULL 00/27] Migration next patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ze7zHaHBaCRO8qKu@redhat.com \
--to=berrange@redhat.com \
--cc=farosas@suse.de \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=ppandit@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.