ee1004bb | 29-Jan-2024 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
bulk: Access existing variables initialized to &S->F when available
When a variable is initialized to &struct->field, use it in place. Rationale: while this makes the code more concise, this also he
bulk: Access existing variables initialized to &S->F when available
When a variable is initialized to &struct->field, use it in place. Rationale: while this makes the code more concise, this also helps static analyzers.
Mechanical change using the following Coccinelle spatch script:
@@ type S, F; identifier s, m, v; @@ S *s; ... F *v = &s->m; <+... - &s->m + v ...+>
Inspired-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240129164514.73104-2-philmd@linaro.org> Acked-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com> [thuth: Dropped hunks that need a rebase, and fixed sizeof() in pmu_realize()] Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
46ff64a8 | 12-Mar-2024 |
Zhao Liu <zhao1.liu@intel.com> |
error: Move ERRP_GUARD() to the beginning of the function
Since the commit 05e385d2a9 ("error: Move ERRP_GUARD() to the beginning of the function"), there are new codes that don't put ERRP_GUARD() a
error: Move ERRP_GUARD() to the beginning of the function
Since the commit 05e385d2a9 ("error: Move ERRP_GUARD() to the beginning of the function"), there are new codes that don't put ERRP_GUARD() at the beginning of the functions.
As stated in the commit 05e385d2a9: "include/qapi/error.h advises to put ERRP_GUARD() right at the beginning of the function, because only then can it guard the whole function.", so clean up the few spots disregarding the advice.
Inspired-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240312060337.3240965-1-zhao1.liu@linux.intel.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
35e83a9f | 10-Mar-2024 |
Zhao Liu <zhao1.liu@intel.com> |
migration/option: Fix missing ERRP_GUARD() for error_prepend()
As the comment in qapi/error, passing @errp to error_prepend() requires ERRP_GUARD():
* = Why, when and how to use ERRP_GUARD() = * *
migration/option: Fix missing ERRP_GUARD() for error_prepend()
As the comment in qapi/error, passing @errp to error_prepend() requires ERRP_GUARD():
* = Why, when and how to use ERRP_GUARD() = * * Without ERRP_GUARD(), use of the @errp parameter is restricted: ... * - It should not be passed to error_prepend(), error_vprepend() or * error_append_hint(), because that doesn't work with &error_fatal. * ERRP_GUARD() lifts these restrictions. * * To use ERRP_GUARD(), add it right at the beginning of the function. * @errp can then be used without worrying about the argument being * NULL or &error_fatal.
ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user can't see this additional information, because exit() happens in error_setg earlier than information is added [1].
The migrate_params_check() passes @errp to error_prepend() without ERRP_GUARD(), and it could be called from migration_object_init(), where the passed @errp points to @error_fatal.
Therefore, the error message echoed in error_prepend() will be lost because of the above issue.
To fix this, add missing ERRP_GUARD() at the beginning of this function.
[1]: Issue description in the commit message of commit ae7c80a7bd73 ("error: New macro ERRP_GUARD()").
Cc: Peter Xu <peterx@redhat.com> Cc: Fabiano Rosas <farosas@suse.de> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Acked-by: Peter Xu <peterx@redhat.com> Message-ID: <20240311033822.3142585-28-zhao1.liu@linux.intel.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
70c25c92 | 11-Mar-2024 |
Hao Xiang <hao.xiang@bytedance.com> |
migration/multifd: Enable multifd zero page checking by default.
1. Set default "zero-page-detection" option to "multifd". Now zero page checking can be done in the multifd threads and this becomes
migration/multifd: Enable multifd zero page checking by default.
1. Set default "zero-page-detection" option to "multifd". Now zero page checking can be done in the multifd threads and this becomes the default configuration. 2. Handle migration QEMU9.0 -> QEMU8.2 compatibility. We provide backward compatibility where zero page checking is done from the migration main thread.
Signed-off-by: Hao Xiang <hao.xiang@bytedance.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Peter Xu <peterx@redhat.com> Link: https://lore.kernel.org/r/20240311180015.3359271-7-hao.xiang@linux.dev Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
9ae90f73 | 11-Mar-2024 |
Hao Xiang <hao.xiang@bytedance.com> |
migration/multifd: Implement ram_save_target_page_multifd to handle multifd version of MigrationOps::ram_save_target_page.
1. Add a dedicated handler for MigrationOps::ram_save_target_page in multif
migration/multifd: Implement ram_save_target_page_multifd to handle multifd version of MigrationOps::ram_save_target_page.
1. Add a dedicated handler for MigrationOps::ram_save_target_page in multifd live migration. 2. Refactor ram_save_target_page_legacy so that the legacy and multifd handlers don't have internal functions calling into each other.
Signed-off-by: Hao Xiang <hao.xiang@bytedance.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Message-Id: <20240226195654.934709-4-hao.xiang@bytedance.com> Link: https://lore.kernel.org/r/20240311180015.3359271-6-hao.xiang@linux.dev Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
303e6f54 | 11-Mar-2024 |
Hao Xiang <hao.xiang@bytedance.com> |
migration/multifd: Implement zero page transmission on the multifd thread.
1. Add zero_pages field in MultiFDPacket_t. 2. Implements the zero page detection and handling on the multifd threads for n
migration/multifd: Implement zero page transmission on the multifd thread.
1. Add zero_pages field in MultiFDPacket_t. 2. Implements the zero page detection and handling on the multifd threads for non-compression, zlib and zstd compression backends. 3. Added a new value 'multifd' in ZeroPageDetection enumeration. 4. Adds zero page counters and updates multifd send/receive tracing format to track the newly added counters.
Signed-off-by: Hao Xiang <hao.xiang@bytedance.com> Acked-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240311180015.3359271-5-hao.xiang@linux.dev Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
5fdbb1df | 11-Mar-2024 |
Hao Xiang <hao.xiang@bytedance.com> |
migration/multifd: Add new migration option zero-page-detection.
This new parameter controls where the zero page checking is running. 1. If this parameter is set to 'legacy', zero page checking is d
migration/multifd: Add new migration option zero-page-detection.
This new parameter controls where the zero page checking is running. 1. If this parameter is set to 'legacy', zero page checking is done in the migration main thread. 2. If this parameter is set to 'none', zero page checking is disabled.
Signed-off-by: Hao Xiang <hao.xiang@bytedance.com> Reviewed-by: Peter Xu <peterx@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Link: https://lore.kernel.org/r/20240311180015.3359271-4-hao.xiang@linux.dev Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
c3cdf3fb | 11-Mar-2024 |
Fabiano Rosas <farosas@suse.de> |
migration/multifd: Allow clearing of the file_bmap from multifd
We currently only need to clear the mapped-ram file bitmap from the migration thread during save_zero_page.
We're about to add suppor
migration/multifd: Allow clearing of the file_bmap from multifd
We currently only need to clear the mapped-ram file bitmap from the migration thread during save_zero_page.
We're about to add support for zero page detection on the multifd thread, so allow ramblock_set_file_bmap_atomic() to also clear the bits.
Signed-off-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240311180015.3359271-3-hao.xiang@linux.dev Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
44fe138e | 11-Mar-2024 |
Fabiano Rosas <farosas@suse.de> |
migration/multifd: Allow zero pages in file migration
Currently, it's an error to have no data pages in the multifd file migration because zero page detection is done in the migration thread and zer
migration/multifd: Allow zero pages in file migration
Currently, it's an error to have no data pages in the multifd file migration because zero page detection is done in the migration thread and zero pages don't reach multifd. This is enforced with the pages->num assert.
We're about to add zero page detection on the multifd thread. Fix the file_write_ramblock_iov() to stop considering p->iovs_num=0 an error.
Signed-off-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240311180015.3359271-2-hao.xiang@linux.dev Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
c9539d9b | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: purge MigrationState from public interface
Move remaining MigrationState references from the public file misc.h to the private file migration.h.
Signed-off-by: Steve Sistare <steven.sist
migration: purge MigrationState from public interface
Move remaining MigrationState references from the public file misc.h to the private file migration.h.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-12-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
a3ed4893 | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: delete unused accessors
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-11-git-send-email-steven.sistare@oracle.com Signed-off-b
migration: delete unused accessors
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-11-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
7395127f | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: privatize colo interfaces
Remove private migration interfaces from net/colo-compare.c and push them to migration/colo.c.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: ht
migration: privatize colo interfaces
Remove private migration interfaces from net/colo-compare.c and push them to migration/colo.c.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-10-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
20c64c8a | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: migration_file_set_error
Define and export migration_file_set_error to eliminate a dependency on MigrationState.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lo
migration: migration_file_set_error
Define and export migration_file_set_error to eliminate a dependency on MigrationState.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-9-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
9bb630c6 | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: migration_is_device
Define and export migration_is_device to eliminate a dependency on MigrationState.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.
migration: migration_is_device
Define and export migration_is_device to eliminate a dependency on MigrationState.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-8-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
6e785639 | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: migration_thread_is_self
Define and export migration_thread_is_self to eliminate a dependency on MigrationState.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lo
migration: migration_thread_is_self
Define and export migration_thread_is_self to eliminate a dependency on MigrationState.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-7-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
714f3312 | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: export vcpu_dirty_limit_period
Define and export vcpu_dirty_limit_period to eliminate a dependency on MigrationState.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https
migration: export vcpu_dirty_limit_period
Define and export vcpu_dirty_limit_period to eliminate a dependency on MigrationState.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-6-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
aeaafb1e | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: export migration_is_running
Delete the MigrationState parameter from migration_is_running and move it to the public API in misc.h.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com
migration: export migration_is_running
Delete the MigrationState parameter from migration_is_running and move it to the public API in misc.h.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-5-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
3a6813b6 | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: export migration_is_active
Delete the MigrationState parameter from migration_is_active so it can be exported and used without including migration.h.
Signed-off-by: Steve Sistare <steven
migration: export migration_is_active
Delete the MigrationState parameter from migration_is_active so it can be exported and used without including migration.h.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-4-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
7dcb3c87 | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: export migration_is_setup_or_active
Delete the MigrationState parameter from migration_is_setup_or_active and move it to the public API in misc.h.
Signed-off-by: Steve Sistare <steven.si
migration: export migration_is_setup_or_active
Delete the MigrationState parameter from migration_is_setup_or_active and move it to the public API in misc.h.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Link: https://lore.kernel.org/r/1710179338-294359-3-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
f3bff6c4 | 11-Mar-2024 |
Steve Sistare <steven.sistare@oracle.com> |
migration: export fewer options
A small number of migration options are accessed by migration clients, but to see them clients must include all of options.h, which is mostly for migration core code.
migration: export fewer options
A small number of migration options are accessed by migration clients, but to see them clients must include all of options.h, which is mostly for migration core code. migrate_mode() in particular will be needed by multiple clients.
Refactor the option declarations so clients can see the necessary few via misc.h, which already exports a portion of the client API.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179319-294320-1-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
a1bb5dd1 | 11-Mar-2024 |
Anthony PERARD <anthony.perard@citrix.com> |
migration: Fix format in error message
In file_write_ramblock_iov(), "offset" is "uintptr_t" and not "ram_addr_t". While usually they are both equivalent, this is not the case with CONFIG_XEN_BACKEN
migration: Fix format in error message
In file_write_ramblock_iov(), "offset" is "uintptr_t" and not "ram_addr_t". While usually they are both equivalent, this is not the case with CONFIG_XEN_BACKEND.
Use the right format. This will fix build on 32-bit.
Fixes: f427d90b9898 ("migration/multifd: Support outgoing mapped-ram stream format") Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Link: https://lore.kernel.org/r/20240311123439.16844-1-anthony.perard@citrix.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
69f7b00d | 06-Mar-2024 |
Yu Zhang <yu.zhang@ionos.com> |
migration/rdma: Fix a memory issue for migration
In commit 3fa9642ff7 change was made to convert the RDMA backend to accept MigrateAddress struct. However, the assignment of "host" leads to data cor
migration/rdma: Fix a memory issue for migration
In commit 3fa9642ff7 change was made to convert the RDMA backend to accept MigrateAddress struct. However, the assignment of "host" leads to data corruption on the target host and the failure of migration.
isock->host = rdma->host;
By allocating the memory explicitly for it with g_strdup_printf(), the issue is fixed and the migration doesn't fail any more.
Fixes: 3fa9642ff7 ("migration: convert rdma backend to accept MigrateAddress") Cc: qemu-stable <qemu-stable@nongnu.org> Cc: Li Zhijian <lizhijian@fujitsu.com> Link: https://lore.kernel.org/r/CAHEcVy4L_D6tuhJ8h=xLR4WaPaprJE3nnxZAEyUnoTrxQ6CF5w@mail.gmail.com Signed-off-by: Yu Zhang <yu.zhang@ionos.com> [peterx: use g_strdup() instead of g_strdup_printf(), per Zhijian] Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
61dec060 | 05-Mar-2024 |
Fabiano Rosas <farosas@suse.de> |
migration/multifd: Don't fsync when closing QIOChannelFile
Commit bc38feddeb ("io: fsync before closing a file channel") added a fsync/fdatasync at the closing point of the QIOChannelFile to ensure
migration/multifd: Don't fsync when closing QIOChannelFile
Commit bc38feddeb ("io: fsync before closing a file channel") added a fsync/fdatasync at the closing point of the QIOChannelFile to ensure integrity of the migration stream in case of QEMU crash.
The decision to do the sync at qio_channel_close() was not the best since that function runs in the main thread and the fsync can cause QEMU to hang for several minutes, depending on the migration size and disk speed.
To fix the hang, remove the fsync from qio_channel_file_close().
At this moment, the migration code is the only user of the fsync and we're taking the tradeoff of not having a sync at all, leaving the responsibility to the upper layers.
Fixes: bc38feddeb ("io: fsync before closing a file channel") Reviewed-by: "Daniel P. Berrangé" <berrange@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240305195629.9922-1-farosas@suse.de Link: https://lore.kernel.org/r/20240305174332.2553-1-farosas@suse.de [peterx: add more comment to the qio_channel_close()] Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
e6e08e83 | 04-Mar-2024 |
Cédric Le Goater <clg@redhat.com> |
migration: Do not call PRECOPY_NOTIFY_SETUP notifiers in case of error
When commit bd2270608fa0 ("migration/ram.c: add a notifier chain for precopy") added PRECOPY_NOTIFY_SETUP notifiers at the end
migration: Do not call PRECOPY_NOTIFY_SETUP notifiers in case of error
When commit bd2270608fa0 ("migration/ram.c: add a notifier chain for precopy") added PRECOPY_NOTIFY_SETUP notifiers at the end of qemu_savevm_state_setup(), it didn't take into account a possible error in the loop calling vmstate_save() or .save_setup() handlers.
Check ret value before calling the notifiers.
Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/r/20240304122844.1888308-10-clg@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|
e8c44363 | 04-Mar-2024 |
Cédric Le Goater <clg@redhat.com> |
migration: Report error when shutdown fails
This will help detect issues regarding I/O channels usage.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Xu <peterx@redhat.c
migration: Report error when shutdown fails
This will help detect issues regarding I/O channels usage.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/r/20240304122844.1888308-7-clg@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
show more ...
|