[PATCH v3 06/14] io: add and implement QIO_CHANNEL_FEATURE_SEEKABLE for channel file

2022-10-28 Thread Nikolay Borisov
Add a generic QIOChannel feature SEEKABLE which would be used by the qemu_file* apis. For the time being this will be only implemented for file channels. Signed-off-by: Nikolay Borisov --- include/io/channel.h | 1 + io/channel-file.c| 9 + 2 files changed, 10 insertions(+) diff

[PATCH v3 00/14] File-based migration support and fixed-ram features

2022-10-28 Thread Nikolay Borisov
-related helpers from the patch introducing the io interfaces. - Added qtests for the file-based migration as well as for the fixed-ram feature. [0] https://lore.kernel.org/qemu-devel/20221004123733.2745519-1-nbori...@suse.com/ Nikolay Borisov (14): migration: support file: uri for source migration

[PATCH v3 10/14] migration/ram: Introduce 'fixed-ram' migration stream capability

2022-10-28 Thread Nikolay Borisov
e dirty pages for a ramblock follow its header. Since all pages have a fixed location RAM_SAVE_FLAG_EOS is no longer generated on every migration iteration but there is effectively a single RAM_SAVE_FLAG_EOS right at the end. Signed-off-by: Nikolay Borisov --- include/exec/ramblock.h | 7 +++ migratio

[PATCH v3 02/14] migration: Add support for 'file:' uri for incoming migration

2022-10-28 Thread Nikolay Borisov
management applications. Reviewed-by: Daniel P. Berrangé Signed-off-by: Nikolay Borisov --- migration/file.c | 15 +++ migration/file.h | 1 + migration/migration.c | 2 ++ 3 files changed, 18 insertions(+) diff --git a/migration/file.c b/migration/file.c index 02896a7cab99

[PATCH v3 11/14] migration: Refactor precopy ram loading code

2022-10-28 Thread Nikolay Borisov
To facilitate easier implementaiton of the 'fixed-ram' migration restore factor out the code responsible for parsing the ramblocks headers. This also makes ram_load_precopy easier to comprehend. Signed-off-by: Nikolay Borisov --- migration/ram.c | 142

[PATCH v3 14/14] tests/qtest: migration-test: Add tests for file-based migration

2022-10-28 Thread Nikolay Borisov
Add basic tests for file-based migration as well as for the 'fixed-ram' feature. Signed-off-by: Nikolay Borisov --- tests/qtest/migration-test.c | 46 1 file changed, 46 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c

[PATCH v3 05/14] io: implement io_pwritev for QIOChannelFile

2022-10-28 Thread Nikolay Borisov
The upcoming 'fixed-ram' feature would require qemu to write data at specific offsets of the file. Add a minimal implementation of pwritev and expose it via the io_pwritev interface. Signed-off-by: Nikolay Borisov --- io/channel-file.c | 25 + 1 file changed, 25

[PATCH v3 09/14] migration: add qemu_get_buffer_at

2022-10-28 Thread Nikolay Borisov
Restoring a 'fixed-ram' enabled migration stream would require reading from specific offsets in the file so add a helper to QEMUFile that uses the newly introduced qio_channel_file_preadv. Signed-off-by: Nikolay Borisov --- migration/qemu-file.c | 23 +++ migration/qemu

[PATCH v3 13/14] tests: Add migrate_incoming_qmp helper

2022-10-28 Thread Nikolay Borisov
file-based migration requires the target to initiate its migration after the source has finished writing out the data in the file. Currently there's no easy way to initiate 'migrate-incoming', allow this by introducing migrate_incoming_qmp helper, similarly to migrate_qmp. Signed-off-by: Nikolay

[PATCH v3 01/14] migration: support file: uri for source migration

2022-10-28 Thread Nikolay Borisov
: Daniel P. Berrangé Signed-off-by: Nikolay Borisov --- migration/file.c | 23 +++ migration/file.h | 9 + migration/meson.build | 1 + migration/migration.c | 3 +++ 4 files changed, 36 insertions(+) create mode 100644 migration/file.c create mode 100644

[PATCH v3 07/14] migration/qemu-file: add utility methods for working with seekable channels

2022-10-28 Thread Nikolay Borisov
Add qemu_file_is_seekable/qemu_put_buffer_at/qemu_set_offset/qemu_get_offset as those utility methods will be needed when implementing 'fixed-ram' migration capability. Signed-off-by: Nikolay Borisov --- include/migration/qemu-file-types.h | 2 + migration/qemu-file.c | 59

[PATCH v3 04/14] io: Add generic pwritev/preadv interface

2022-10-28 Thread Nikolay Borisov
Introduce basic pwriteve/preadv support in the generic channel layer. SPecific implementation will follow for the file channel as this is required in order to support migration streams with fixed location of each ram page. Signed-off-by: Nikolay Borisov --- include/io/channel.h | 49

[PATCH v3 03/14] migration: Initial support of fixed-ram feature for analyze-migration.py

2022-10-28 Thread Nikolay Borisov
the configuration object be serialized to json. Signed-off-by: Nikolay Borisov --- migration/migration.c| 5 migration/migration.h| 3 +++ migration/savevm.c | 47 ++ scripts/analyze-migration.py | 49 +--- 4 files

[PATCH v3 08/14] io: Add preadv support to QIOChannelFile

2022-10-28 Thread Nikolay Borisov
preadv is going to be needed when 'fixed-ram'-enabled stream are to be restored. Add a minimal implementation of preadv for file channels and expose it via the generic io_preadv interface. Signed-off-by: Nikolay Borisov --- io/channel-file.c | 27 +++ 1 file changed, 27

[PATCH v3 12/14] migration: Add support for 'fixed-ram' migration restore

2022-10-28 Thread Nikolay Borisov
CTION_(PART|END) flags). Signed-off-by: Nikolay Borisov --- migration/migration.h | 2 + migration/ram.c | 95 ++- 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 9aab1b16f407..7a832d

Re: [PATCH v2 03/11] migration: Make migration json writer part of MigrationState struct

2022-10-19 Thread Nikolay Borisov
On 18.10.22 г. 13:06 ч., Daniel P. Berrangé wrote: On Mon, Oct 10, 2022 at 04:34:00PM +0300, Nikolay Borisov wrote: This is required so that migration stream configuration is written to the migration stream. This would allow analyze-migration to parse enabled capabilities for the migration

Re: [PATCH v2 05/11] io: Add support for seekable channels

2022-10-18 Thread Nikolay Borisov
On 18.10.22 г. 13:14 ч., Daniel P. Berrangé wrote: On Mon, Oct 10, 2022 at 04:34:02PM +0300, Nikolay Borisov wrote: Add a bunch of auxiliarry methods and a feature flag to work with SEEKABLE channels. Currently the only channel considered seekable is QIOChannelFile. Also add a bunch

Re: [PATCH v2 01/11] migration: support file: uri for source migration

2022-10-18 Thread Nikolay Borisov
On 18.10.22 г. 12:10 ч., Daniel P. Berrangé wrote: On Mon, Oct 10, 2022 at 04:33:58PM +0300, Nikolay Borisov wrote: Implement support for a "file:" uri so that a migration can be initiated directly to a file from QEMU. Can we add a reminder here Unlike other migration protoco

[PATCH v2 09/11] migration: Refactor precopy ram loading code

2022-10-10 Thread Nikolay Borisov
To facilitate easier implementaiton of the 'fixed-ram' migration restore factor out the code responsible for parsing the ramblocks headers. This also makes ram_load_precopy easier to comprehend. Signed-off-by: Nikolay Borisov --- migration/ram.c | 142

[PATCH v2 11/11] analyze-migration.py: add initial support for fixed ram streams

2022-10-10 Thread Nikolay Borisov
This commit introduces the minimum code necessary to support parsing migration strems with 'fixed-ram' capability set. The only thing really missing is the implementation of write_or_dump_fixed_ram() which deals with '-x'/'-m' options. Signed-off-by: Nikolay Borisov --- scripts/analyze

[PATCH v2 05/11] io: Add support for seekable channels

2022-10-10 Thread Nikolay Borisov
-ram' migration stream feature. Signed-off-by: Nikolay Borisov --- include/io/channel.h| 1 + include/migration/qemu-file-types.h | 2 + io/channel-file.c | 5 +++ migration/qemu-file.c | 59 + migration/qemu-file.h

[PATCH v2 06/11] io: Add preadv support to QIOChannelFile

2022-10-10 Thread Nikolay Borisov
preadv is going to be needed when 'fixed-ram'-enabled stream are to be restored. Simply add a wrapper around preadv that's specific to QIOChannelFile. Signed-off-by: Nikolay Borisov --- include/io/channel-file.h | 5 + io/channel-file.c | 26 ++ 2 files

[PATCH v2 00/11] Add support for fixed ram offsets during migration

2022-10-10 Thread Nikolay Borisov
-devel/20221004123733.2745519-1-nbori...@suse.com/ Nikolay Borisov (11): migration: support file: uri for source migration migration: Add support for 'file:' uri for incoming migration migration: Make migration json writer part of MigrationState struct io: add pwritev support

[PATCH v2 02/11] migration: Add support for 'file:' uri for incoming migration

2022-10-10 Thread Nikolay Borisov
This is a counterpart to the 'file:' uri support for source migration, now a file can also serve as the source of an incoming migration. Signed-off-by: Nikolay Borisov --- migration/file.c | 15 +++ migration/file.h | 1 + migration/migration.c | 2 ++ 3 files changed

[PATCH v2 04/11] io: add pwritev support to QIOChannelFile

2022-10-10 Thread Nikolay Borisov
seeks. Signed-off-by: Nikolay Borisov --- include/io/channel-file.h | 5 + io/channel-file.c | 24 2 files changed, 29 insertions(+) diff --git a/include/io/channel-file.h b/include/io/channel-file.h index 50e8eb113868..0a5d54f5e58e 100644 --- a/include/io

[PATCH v2 08/11] migration/ram: Introduce 'fixed-ram' migration stream capability

2022-10-10 Thread Nikolay Borisov
e dirty pages for a ramblock follow its header. Since all pages have a fixed location RAM_SAVE_FLAG_EOS is no longer generated on every migration iteration but there is effectively a single RAM_SAVE_FLAG_EOS right at the end. Signed-off-by: Nikolay Borisov --- include/exec/ramblock.h | 7 +++ migratio

[PATCH v2 03/11] migration: Make migration json writer part of MigrationState struct

2022-10-10 Thread Nikolay Borisov
format changes. Signed-off-by: Nikolay Borisov --- migration/migration.c | 5 + migration/migration.h | 3 +++ migration/savevm.c| 38 ++ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index

[PATCH v2 07/11] migration: add qemu_get_buffer_at

2022-10-10 Thread Nikolay Borisov
Restoring a 'fixed-ram' enabled migration stream would require reading from specific offsets in the file so add a helper to QEMUFile that uses the newly introduced qio_channel_file_preadv. Signed-off-by: Nikolay Borisov --- migration/qemu-file.c | 23 +++ migration/qemu

[PATCH v2 10/11] migration: Add support for 'fixed-ram' migration restore

2022-10-10 Thread Nikolay Borisov
CTION_(PART|END) flags). Signed-off-by: Nikolay Borisov --- migration/migration.h | 2 + migration/ram.c | 95 ++- 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 9aab1b16f407..7a832d

[PATCH v2 01/11] migration: support file: uri for source migration

2022-10-10 Thread Nikolay Borisov
Implement support for a "file:" uri so that a migration can be initiated directly to a file from QEMU. Signed-off-by: Nikolay Borisov --- migration/file.c | 23 +++ migration/file.h | 9 + migration/meson.build | 1 + migration/migration.c |

[PATCH 09/11] migration: Refactor precopy ram loading code

2022-10-04 Thread Nikolay Borisov
To facilitate easier implementaiton of the 'fixed-ram' migration restore factor out the code responsible for parsing the ramblocks headers. This also makes ram_load_precopy easier to comprehend. Signed-off-by: Nikolay Borisov --- migration/ram.c | 142

[PATCH 05/11] io: Add support for seekable channels

2022-10-04 Thread Nikolay Borisov
-ram' migration stream feature. Signed-off-by: Nikolay Borisov --- include/io/channel.h| 1 + include/migration/qemu-file-types.h | 2 + io/channel-file.c | 5 +++ migration/qemu-file.c | 59 + migration/qemu-file.h

[PATCH 07/11] migration: add qemu_get_buffer_at

2022-10-04 Thread Nikolay Borisov
Restoring a 'fixed-ram' enabled migration stream would require reading from specific offsets in the file so add a helper to QEMUFile that uses the newly introduced qio_channel_file_preadv. Signed-off-by: Nikolay Borisov --- migration/qemu-file.c | 23 +++ migration/qemu

[PATCH 06/11] io: Add preadv support to QIOChannelFile

2022-10-04 Thread Nikolay Borisov
preadv is going to be needed when 'fixed-ram'-enabled stream are to be restored. Simply add a wrapper around preadv that's specific to QIOChannelFile. Signed-off-by: Nikolay Borisov --- include/io/channel-file.h | 5 + io/channel-file.c | 26 ++ 2 files

[PATCH 02/11] migration: Add support for 'file:' uri for incoming migration

2022-10-04 Thread Nikolay Borisov
This is a counterpart to the 'file:' uri support for source migration, now a file can also serve as the source of an incoming migration. Signed-off-by: Nikolay Borisov --- migration/file.c | 15 +++ migration/file.h | 1 + migration/migration.c | 2 ++ 3 files changed

[PATCH 08/11] migration/ram: Introduce 'fixed-ram' migration stream capability

2022-10-04 Thread Nikolay Borisov
e dirty pages for a ramblock follow its header. Since all pages have a fixed location RAM_SAVE_FLAG_EOS is no longer generated on every migration iteration but there is effectively a single RAM_SAVE_FLAG_EOS right at the end. Signed-off-by: Nikolay Borisov --- include/exec/ramblock.h | 7 +++ migratio

[RFC PATCH 00/11] Add support for fixed ram offsets during migration

2022-10-04 Thread Nikolay Borisov
- Possibly implement the "external fd" support for "fixed-ram" capability. All feedback is welcome. Nikolay Borisov (11): migration: support file: uri for source migration migration: Add support for 'file:' uri for incoming migration migration: Make migration json writer part of

[PATCH 04/11] io: add pwritev support to QIOChannelFile

2022-10-04 Thread Nikolay Borisov
seeks. Signed-off-by: Nikolay Borisov --- include/io/channel-file.h | 5 + io/channel-file.c | 24 2 files changed, 29 insertions(+) diff --git a/include/io/channel-file.h b/include/io/channel-file.h index 50e8eb113868..0a5d54f5e58e 100644 --- a/include/io

[PATCH 03/11] migration: Make migration json writer part of MigrationState struct

2022-10-04 Thread Nikolay Borisov via
format changes. Signed-off-by: Nikolay Borisov --- migration/migration.c | 5 + migration/migration.h | 3 +++ migration/savevm.c| 38 ++ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index

[PATCH 11/11] analyze-migration.py: add initial support for fixed ram streams

2022-10-04 Thread Nikolay Borisov via
This commit introduces the minimum code necessary to support parsing migration strems with 'fixed-ram' capability set. The only thing really missing is the implementation of write_or_dump_fixed_ram() which deals with '-x'/'-m' options. Signed-off-by: Nikolay Borisov --- scripts/analyze

[PATCH 01/11] migration: support file: uri for source migration

2022-10-04 Thread Nikolay Borisov via
Implement support for a "file:" uri so that a migration can be initiated directly to a file from QEMU. Signed-off-by: Nikolay Borisov --- migration/file.c | 23 +++ migration/file.h | 9 + migration/meson.build | 1 + migration/migration.c |

[PATCH 10/11] migration: Add support for 'fixed-ram' migration restore

2022-10-04 Thread Nikolay Borisov
CTION_(PART|END) flags). Signed-off-by: Nikolay Borisov --- migration/migration.h | 2 + migration/ram.c | 86 ++- 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 9aab1b16f407..7a832d

Re: [PATCH] migration/ram: Fix memory leak when using x-ignore-shared

2022-09-23 Thread Nikolay Borisov
On 22.09.22 г. 20:42 ч., Dr. David Alan Gilbert wrote: * Nikolay Borisov (nbori...@suse.com) wrote: During ram initialization for migration dirty/clear bitmaps are allocated for all migratable blocks, irrespective of their shared status. However, during ram migration cleanup those bitmaps

[PATCH] migration/ram: Fix memory leak when using x-ignore-shared

2022-09-16 Thread Nikolay Borisov
to a situation where the bitmaps aren't freed for such blocks. Fix this by switching the cleanup code to also free bitmaps for all migratable blocks. Signed-off-by: Nikolay Borisov --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/ram.c b/migration

Proposal for a fixed ram migration stream format for file-based migrations

2022-09-14 Thread Nikolay Borisov
Hello, Based on several discussions I've had in the past 2 days and time spent looking at the migration stream code I came up with the following proposal for changes to the stream format. Let me recap what we have right now: ...() Where is put only when the current page we are writing to

Re: [PATCH] migration: support file: uri for source migration

2022-09-12 Thread Nikolay Borisov
On 12.09.22 г. 18:41 ч., Daniel P. Berrangé wrote: On Thu, Sep 08, 2022 at 01:26:32PM +0300, Nikolay Borisov wrote: This is a prototype of supporting a 'file:' based uri protocol for writing out the migration stream of qemu. Currently the code always opens the file in DIO mode and adheres

[PATCH] migration: support file: uri for source migration

2022-09-08 Thread Nikolay Borisov
ble to upstream merging. Any ideas/comments would be much appreciated. Signed-off-by: Nikolay Borisov --- include/io/channel-file.h | 1 + include/io/channel.h | 1 + io/channel-file.c | 17 +++ migration/meson.build | 1 + migration/migration.c | 4 ++ migration/migratio

Re: [PATCH] migration/multifd: Remove redundant copy of page offsets during send

2022-09-07 Thread Nikolay Borisov
On 10.08.22 г. 13:39 ч., Nikolay Borisov wrote: All pages which are going to be migrated are first added to MultiFDSendParams::MultiFDPages_t::offset array by the main migration thread and are subsequently copied to MultiFDSendParams::normal by the multifd thread. This is really unnecessary

Re: towards a workable O_DIRECT outmigration to a file

2022-08-11 Thread Nikolay Borisov
[adding Juan and David to cc as I had missed them. ] On 11.08.22 г. 16:47 ч., Nikolay Borisov wrote: Hello, I'm currently looking into implementing a 'file:' uri for migration save in qemu. Ideally the solution will be O_DIRECT compatible. I'm aware of the branch https://gitlab.com/berrange

towards a workable O_DIRECT outmigration to a file

2022-08-11 Thread Nikolay Borisov
Hello, I'm currently looking into implementing a 'file:' uri for migration save in qemu. Ideally the solution will be O_DIRECT compatible. I'm aware of the branch https://gitlab.com/berrange/qemu/-/tree/mig-file. In the process of brainstorming how a solution would like the a couple of

[PATCH] migration/multifd: Remove redundant copy of page offsets during send

2022-08-10 Thread Nikolay Borisov
normal/normal_num are no longer used in the multifd send path. Signed-off-by: Nikolay Borisov --- migration/multifd-zlib.c | 6 +++--- migration/multifd-zstd.c | 6 +++--- migration/multifd.c | 25 ++--- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git