[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 20/29] migration/multifd: Add incoming QIOChannelFile supp
|
From: |
Fabiano Rosas |
|
Subject: |
Re: [PATCH v2 20/29] migration/multifd: Add incoming QIOChannelFile support |
|
Date: |
Wed, 25 Oct 2023 11:18:29 -0300 |
Daniel P. Berrangé <berrange@redhat.com> writes:
> On Mon, Oct 23, 2023 at 05:35:59PM -0300, Fabiano Rosas wrote:
>> On the receiving side we don't need to differentiate between main
>> channel and threads, so whichever channel is defined first gets to be
>> the main one. And since there are no packets, use the atomic channel
>> count to index into the params array.
>>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>> migration/file.c | 39 +++++++++++++++++++++++++++++----------
>> migration/migration.c | 2 ++
>> migration/multifd.c | 7 ++++++-
>> migration/multifd.h | 1 +
>> 4 files changed, 38 insertions(+), 11 deletions(-)
>>
>> diff --git a/migration/file.c b/migration/file.c
>> index 93b9b7bf5d..ad75225f43 100644
>> --- a/migration/file.c
>> +++ b/migration/file.c
>> @@ -6,13 +6,15 @@
>> */
>>
>> #include "qemu/osdep.h"
>> -#include "qemu/cutils.h"
>> #include "qapi/error.h"
>> +#include "qemu/cutils.h"
>> +#include "qemu/error-report.h"
>> #include "channel.h"
>> #include "file.h"
>> #include "migration.h"
>> #include "io/channel-file.h"
>> #include "io/channel-util.h"
>> +#include "options.h"
>> #include "trace.h"
>>
>> #define OFFSET_OPTION ",offset="
>> @@ -136,7 +138,8 @@ void file_start_incoming_migration(const char *filespec,
>> Error **errp)
>> g_autofree char *filename = g_strdup(filespec);
>> QIOChannelFile *fioc = NULL;
>> uint64_t offset = 0;
>> - QIOChannel *ioc;
>> + int channels = 1;
>> + int i = 0, fd;
>>
>> trace_migration_file_incoming(filename);
>>
>> @@ -146,16 +149,32 @@ void file_start_incoming_migration(const char
>> *filespec, Error **errp)
>>
>> fioc = qio_channel_file_new_path(filename, O_RDONLY, 0, errp);
>> if (!fioc) {
>> - return;
>> + goto out;
>> + }
>> +
>> + if (migrate_multifd()) {
>> + channels += migrate_multifd_channels();
>> }
>>
>> - ioc = QIO_CHANNEL(fioc);
>> - if (offset && qio_channel_io_seek(ioc, offset, SEEK_SET, errp) < 0) {
>> + fd = fioc->fd;
>> +
>> + do {
>> + QIOChannel *ioc = QIO_CHANNEL(fioc);
>> +
>> + if (offset && qio_channel_io_seek(ioc, offset, SEEK_SET, errp) < 0)
>> {
>> + return;
>> + }
>> +
>> + qio_channel_set_name(ioc, "migration-file-incoming");
>> + qio_channel_add_watch_full(ioc, G_IO_IN,
>> + file_accept_incoming_migration,
>> + NULL, NULL,
>> + g_main_context_get_thread_default());
>> + } while (++i < channels && (fioc = qio_channel_file_new_fd(fd)));
>
> IIUC, this loop is failing to call qio_channel_io_seek to set
> the offset on the last 'fioc' that is created.
>
Ah, this is actually bogus. We don't need to offset the secondary
channels. That does nothing since we carry pointers to everything in the
fixed-ram header. This should be out of the loop.
- [PATCH v2 19/29] migration/multifd: Add outgoing QIOChannelFile support, (continued)
Re: [PATCH v2 19/29] migration/multifd: Add outgoing QIOChannelFile support, Peter Xu, 2023/10/31
[PATCH v2 18/29] migration/multifd: Allow multifd without packets, Fabiano Rosas, 2023/10/23
[PATCH v2 20/29] migration/multifd: Add incoming QIOChannelFile support, Fabiano Rosas, 2023/10/23
[PATCH v2 24/29] migration/ram: Ignore multifd flush when doing fixed-ram migration, Fabiano Rosas, 2023/10/23
[PATCH v2 21/29] migration/multifd: Add pages to the receiving side, Fabiano Rosas, 2023/10/23
[PATCH v2 22/29] io: Add a pwritev/preadv version that takes a discontiguous iovec, Fabiano Rosas, 2023/10/23
[PATCH v2 23/29] migration/ram: Add a wrapper for fixed-ram shadow bitmap, Fabiano Rosas, 2023/10/23
[PATCH v2 25/29] migration/multifd: Support outgoing fixed-ram stream format, Fabiano Rosas, 2023/10/23