migration: Remove QEMUFileHooks
v3 cover migration: Remove QEMUFileHooks
Hi
Changes in v3:
- fix rdma_migration to reset clearly (thanks danp)
- redo the cherks for migration/rdma
- rebased on top of the counters series:
[PATCH 00/21] Migration: More migration atomic counters
Based-on: Message-Id: <[email protected]>
Please, review.
Changes in v2:
- rebased on top of migration-20230428 pull (second try)
- several of the patches on the PULL request
- make clean that we don't use rdma code when we don't use rdma
- create migrate_rdma() to check if we are in rdma migration.
There is no hope for this code. I am trying to cleanup the rest of rdma calls, but the code is convoluted as hell. And it lies with the ram counters as crazy.
Please review.
In this series (v1):
- QEMUFileHooks only had a single user, RDMA migration. Just remove the hooks and create stubs for when RDMA is not compiled in.
- This implies that we have to move all the operations from migration/qemu-file.c to migration/rdma.c.
- I now we can still simplify rdma_control_save_page(), but I don't have an easy setup for testing.
- Yes, the goal of the whole operations is to be able to move ram_file_limit from qemu-file to migration.c.
Please review.
Thanks, Juan.
Juan Quintela (10):
migration: Create migrate_rdma()
migration/rdma: Unfold ram_control_before_iterate() migration/rdma: Unfold ram_control_after_iterate() migration/rdma: Remove all uses of RAM_CONTROL_HOOK migration/rdma: Unfold hook_ram_load()
migration/rdma: Create rdma_control_save_page()
qemu-file: Remove QEMUFileHooks
migration/rdma: Move rdma constants from qemu-file.h to rdma.h migration/rdma: Remove qemu_ prefix from exported functions migration/rdma: Check sooner if we are in postcopy for save_page()
migration/migration.c | 1 + migration/migration.h | 3 + migration/options.c | 7 +++ migration/options.h | 1 + migration/qemu-file.c | 61 +-------------------- migration/qemu-file.h | 49 ----------------- migration/ram.c | 50 +++++++++++++---- migration/rdma.c | 121 +++++++++++++++++++---------------------- migration/rdma.h | 34 ++++++++++++ migration/trace-events | 28 +++++----- 10 files changed, 155 insertions(+), 200 deletions(-)
Signature · 1 line
2.40.0
PATCH v3 1/10 migration: Create migrate_rdma()
Helper to say if we are doing a migration over rdma.
---
Cleanup rdma_migration in migration_prepare (danp)
--- migration/migration.c | 1 + migration/migration.h | 3 +++ migration/options.c | 7 +++++++ migration/options.h | 1 + migration/rdma.c | 4 +++- 5 files changed, 15 insertions(+), 1 deletion(-)
migration/migration.c +1 -0
@@ -1410,6 +1410,7 @@ void migrate_init(MigrationState *s) s->vm_was_running = false; s->iteration_initial_bytes =0 ; s->threshold_size =0 ; + s->rdma_migration = false; }int migrate_add_blocker_internal (Error *reason,Error **errp)
migration/migration.h +3 -0
@@ -431,6 +431,9 @@ struct MigrationState {/* QEMU_VM_VMDESCRIPTION content filled for all non-iterable devices. */ JSONWriter *vmdesc; + +/* Is this a rdma migration */ +bool rdma_migration; };void migrate_set_state (int *state,int old_state,int new_state);
migration/options.c +7 -0
@@ -350,6 +350,13 @@ bool migrate_postcopy(void)return migrate_postcopy_ram () ||migrate_dirty_bitmaps (); } +bool migrate_rdma (void ) +{ +MigrationState *s =migrate_get_current (); + +return s->rdma_migration; +} +bool migrate_tls (void ) {MigrationState *s =migrate_get_current ();
migration/options.h +1 -0
@@ -61,6 +61,7 @@ bool migrate_zero_copy_send(void);bool migrate_multifd_flush_after_each_section (void );bool migrate_postcopy (void ); +bool migrate_rdma (void );bool migrate_tls (void );/* capabilities helpers */
migration/rdma.c +3 -1
@@ -4123,6 +4123,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)int ret;RDMAContext *rdma;Error *local_err =NULL ; +MigrationState *s =migrate_get_current ();trace_rdma_start_incoming_migration ();
@@ -4153,7 +4154,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp) }trace_rdma_start_incoming_migration_after_rdma_listen (); - + s->rdma_migration = true;qemu_set_fd_handler (rdma->channel->fd, rdma_accept_incoming_migration,NULL , (void *)(intptr_t )rdma);return ;
@@ -4229,6 +4230,7 @@ void rdma_start_outgoing_migration(void *opaque,trace_rdma_start_outgoing_migration_after_rdma_connect (); + s->rdma_migration = true; s->to_dst_file =qemu_fopen_rdma (rdma,"wb" );migrate_fd_connect (s,NULL );return ;
Signature · 1 line
2.40.0
PATCH v3 2/10 migration/rdma: Unfold ram_control_before_iterate()
In reply to Juan QuintelaOnce there:
- Remove unused data parameter
- unfold it in its callers.
- change all callers to call qemu_rdma_registration_start()
--- migration/qemu-file.c | 13 +------------ migration/qemu-file.h | 2 -- migration/ram.c | 16 +++++++++++++--- migration/rdma.c | 6 ++---- migration/rdma.h | 6 ++++++ 5 files changed, 22 insertions(+), 21 deletions(-)
migration/qemu-file.c +1 -12
@@ -32,6 +32,7 @@#include "trace.h" #include "options.h" #include "qapi/error.h" +#include "rdma.h" #define IO_BUF_SIZE 32768#define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 64)
@@ -302,18 +303,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =0 ; } -void ram_control_before_iterate (QEMUFile *f,uint64_t flags) -{ -int ret =0 ; - -if (f->hooks && f->hooks->before_ram_iterate) { - ret = f->hooks->before_ram_iterate (f, flags,NULL ); -if (ret <0 ) { -qemu_file_set_error (f, ret); - } - } -} -void ram_control_after_iterate (QEMUFile *f,uint64_t flags) {int ret =0 ;
migration/qemu-file.h +0 -2
@@ -55,7 +55,6 @@ typedef int (QEMURamSaveFunc)(QEMUFile *f, size_t size); typedef struct QEMUFileHooks { - QEMURamHookFunc *before_ram_iterate; QEMURamHookFunc *after_ram_iterate; QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page;
@@ -131,7 +130,6 @@ void qemu_fflush(QEMUFile *f);void qemu_file_set_blocking (QEMUFile *f,bool block);int qemu_file_get_to_fd (QEMUFile *f,int fd,size_t size); -void ram_control_before_iterate (QEMUFile *f,uint64_t flags);void ram_control_after_iterate (QEMUFile *f,uint64_t flags);void ram_control_load_hook (QEMUFile *f,uint64_t flags,void *data);
migration/ram.c +13 -3
@@ -58,6 +58,7 @@#include "qemu/iov.h" #include "multifd.h" #include "sysemu/runstate.h" +#include "rdma.h" #include "options.h" #include "hw/boards.h" /* for machine_dump_guest_core() */
@@ -3047,7 +3048,10 @@ static int ram_save_setup(QEMUFile *f, void *opaque) } } -ram_control_before_iterate (f,RAM_CONTROL_SETUP ); + ret =qemu_rdma_registration_start (f,RAM_CONTROL_SETUP ); +if (ret <0 ) { +qemu_file_set_error (f, ret); + }ram_control_after_iterate (f,RAM_CONTROL_SETUP ); migration_ops =g_malloc0 (sizeof (MigrationOps));
@@ -3110,7 +3114,10 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)/* Read version before ram_list.blocks */ smp_rmb (); -ram_control_before_iterate (f,RAM_CONTROL_ROUND ); + ret =qemu_rdma_registration_start (f,RAM_CONTROL_ROUND ); +if (ret <0 ) { +qemu_file_set_error (f, ret); + } t0 =qemu_clock_get_ns (QEMU_CLOCK_REALTIME ); i =0 ;
@@ -3216,7 +3223,10 @@ static int ram_save_complete(QEMUFile *f, void *opaque)migration_bitmap_sync_precopy (rs); } -ram_control_before_iterate (f,RAM_CONTROL_FINISH ); + ret =qemu_rdma_registration_start (f,RAM_CONTROL_FINISH ); +if (ret <0 ) { +qemu_file_set_error (f, ret); + }/* try transferring iterative blocks of memory */
migration/rdma.c +2 -4
@@ -3864,13 +3864,12 @@ static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data) } } -static int qemu_rdma_registration_start (QEMUFile *f, -uint64_t flags,void *data) +int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags) {QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (qemu_file_get_ioc (f));RDMAContext *rdma; -if (migration_in_postcopy ()) { +if (!migrate_rdma () ||migration_in_postcopy ()) {return 0 ; }
@@ -4008,7 +4007,6 @@ static const QEMUFileHooks rdma_read_hooks = { };static const QEMUFileHooks rdma_write_hooks = { - .before_ram_iterate = qemu_rdma_registration_start, .after_ram_iterate = qemu_rdma_registration_stop, .save_page = qemu_rdma_save_page, };
migration/rdma.h +6 -0
@@ -22,4 +22,10 @@ void rdma_start_outgoing_migration(void *opaque, const char *host_port,void rdma_start_incoming_migration (const char *host_port,Error **errp); + +#ifdef CONFIG_RDMA +int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags); +#else +int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags) {return 0 ; } +#endif #endif
Signature · 1 line
2.40.0
PATCH v3 3/10 migration/rdma: Unfold ram_control_after_iterate()
In reply to Juan QuintelaOnce there:
- Remove unused data parameter
- unfold it in its callers
- change all callers to call qemu_rdma_registration_stop()
--- migration/qemu-file.c | 12 ------------ migration/qemu-file.h | 2 -- migration/ram.c | 17 ++++++++++++++--- migration/rdma.c | 6 ++---- migration/rdma.h | 2 ++ 5 files changed, 18 insertions(+), 21 deletions(-)
migration/qemu-file.c +0 -12
@@ -303,18 +303,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =0 ; } -void ram_control_after_iterate (QEMUFile *f,uint64_t flags) -{ -int ret =0 ; - -if (f->hooks && f->hooks->after_ram_iterate) { - ret = f->hooks->after_ram_iterate (f, flags,NULL ); -if (ret <0 ) { -qemu_file_set_error (f, ret); - } - } -} -void ram_control_load_hook (QEMUFile *f,uint64_t flags,void *data) {if (f->hooks && f->hooks->hook_ram_load) {
migration/qemu-file.h +0 -2
@@ -55,7 +55,6 @@ typedef int (QEMURamSaveFunc)(QEMUFile *f, size_t size);typedef struct QEMUFileHooks { -QEMURamHookFunc *after_ram_iterate;QEMURamHookFunc *hook_ram_load;QEMURamSaveFunc *save_page; }QEMUFileHooks ;
@@ -130,7 +129,6 @@ void qemu_fflush(QEMUFile *f);void qemu_file_set_blocking (QEMUFile *f,bool block);int qemu_file_get_to_fd (QEMUFile *f,int fd,size_t size); -void ram_control_after_iterate (QEMUFile *f,uint64_t flags);void ram_control_load_hook (QEMUFile *f,uint64_t flags,void *data);/* Whenever this is found in the data stream, the flags
migration/ram.c +14 -3
@@ -3052,7 +3052,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque)if (ret <0 ) {qemu_file_set_error (f, ret); } -ram_control_after_iterate (f,RAM_CONTROL_SETUP ); + + ret =qemu_rdma_registration_stop (f,RAM_CONTROL_SETUP ); +if (ret <0 ) { +qemu_file_set_error (f, ret); + } migration_ops =g_malloc0 (sizeof (MigrationOps)); migration_ops->ram_save_target_page = ram_save_target_page_legacy;
@@ -3174,7 +3178,10 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)* Must occur before EOS (or any QEMUFile operation) * because of RDMA protocol. */ -ram_control_after_iterate (f,RAM_CONTROL_ROUND ); + ret =qemu_rdma_registration_stop (f,RAM_CONTROL_ROUND ); +if (ret <0 ) { +qemu_file_set_error (f, ret); + } out: if (ret >= 0
@@ -3248,7 +3255,11 @@ static int ram_save_complete(QEMUFile *f, void *opaque)qemu_mutex_unlock (&rs->bitmap_mutex);ram_flush_compressed_data (rs); -ram_control_after_iterate (f,RAM_CONTROL_FINISH ); + +int ret =qemu_rdma_registration_stop (f,RAM_CONTROL_FINISH ); +if (ret <0 ) { +qemu_file_set_error (f, ret); + } }if (ret <0 ) {
migration/rdma.c +2 -4
@@ -3892,15 +3892,14 @@ int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags)* Inform dest that dynamic registrations are done for now. * First, flush writes, if any. */ -static int qemu_rdma_registration_stop (QEMUFile *f, -uint64_t flags,void *data) +int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags) {QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (qemu_file_get_ioc (f));RDMAContext *rdma;RDMAControlHeader head = { .len =0 , .repeat =1 };int ret =0 ; -if (migration_in_postcopy ()) { +if (!migrate_rdma () ||migration_in_postcopy ()) {return 0 ; }
@@ -4007,7 +4006,6 @@ static const QEMUFileHooks rdma_read_hooks = { };static const QEMUFileHooks rdma_write_hooks = { - .after_ram_iterate = qemu_rdma_registration_stop, .save_page = qemu_rdma_save_page, };
migration/rdma.h +2 -0
@@ -25,7 +25,9 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp);#ifdef CONFIG_RDMA int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags); +int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags);#else int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags) {return 0 ; } +int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags) {return 0 ; }#endif #endif
Signature · 1 line
2.40.0
PATCH v3 4/10 migration/rdma: Remove all uses of RAM_CONTROL_HOOK
In reply to Juan QuintelaInstead of going trhough ram_control_load_hook(), call qemu_rdma_registration_handle() directly.
--- migration/qemu-file.h | 1 - migration/ram.c | 5 ++++- migration/rdma.c | 9 +++++---- migration/rdma.h | 2 ++ 4 files changed, 11 insertions(+), 6 deletions(-)
migration/qemu-file.h +0 -1
@@ -41,7 +41,6 @@ typedef int (QEMURamHookFunc)(QEMUFile *f, uint64_t flags, void *data);*/ #define RAM_CONTROL_SETUP 0#define RAM_CONTROL_ROUND 1 -#define RAM_CONTROL_HOOK 2#define RAM_CONTROL_FINISH 3#define RAM_CONTROL_BLOCK_REG 4
migration/ram.c +4 -1
@@ -4053,7 +4053,10 @@ static int ram_load_precopy(QEMUFile *f) }break ;case RAM_SAVE_FLAG_HOOK : -ram_control_load_hook (f,RAM_CONTROL_HOOK ,NULL ); + ret =qemu_rdma_registration_handle (f); +if (ret <0 ) { +qemu_file_set_error (f, ret); + }break ;default :error_report ("Unknown combination of migration flags: 0x%x" , flags);
migration/rdma.c +5 -4
@@ -3531,7 +3531,7 @@ static int dest_ram_sort_func(const void *a, const void *b)* * Keep doing this until the source tells us to stop. */ -static int qemu_rdma_registration_handle (QEMUFile *f) +int qemu_rdma_registration_handle (QEMUFile *f) {RDMAControlHeader reg_resp = { .len =sizeof (RDMARegisterResult), .type =RDMA_CONTROL_REGISTER_RESULT ,
@@ -3558,6 +3558,10 @@ static int qemu_rdma_registration_handle(QEMUFile *f)int count =0 ;int i =0 ; +if (!migrate_rdma ()) { +return 0 ; + } +RCU_READ_LOCK_GUARD (); rdma =qatomic_rcu_read (&rioc->rdmain);
@@ -3855,9 +3859,6 @@ static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data)case RAM_CONTROL_BLOCK_REG :return rdma_block_notification_handle (f, data); -case RAM_CONTROL_HOOK : -return qemu_rdma_registration_handle (f); -default :/* Shouldn't be called with any other values */ abort ();
migration/rdma.h +2 -0
@@ -24,9 +24,11 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp);#ifdef CONFIG_RDMA +int qemu_rdma_registration_handle (QEMUFile *f);int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags);int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags);#else +int qemu_rdma_registration_handle (QEMUFile *f) {return 0 ; }int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags) {return 0 ; }int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags) {return 0 ; }#endif
Signature · 1 line
2.40.0
PATCH v3 5/10 migration/rdma: Unfold hook_ram_load()
In reply to Juan QuintelaThere is only one flag called with: RAM_CONTROL_BLOCK_REG.
--- migration/qemu-file.c | 10 ---------- migration/qemu-file.h | 11 ----------- migration/ram.c | 6 ++++-- migration/rdma.c | 29 +++++++++-------------------- migration/rdma.h | 2 ++ 5 files changed, 15 insertions(+), 43 deletions(-)
migration/qemu-file.c +0 -10
@@ -303,16 +303,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =0 ; } -void ram_control_load_hook (QEMUFile *f,uint64_t flags,void *data) -{ -if (f->hooks && f->hooks->hook_ram_load) { -int ret = f->hooks->hook_ram_load (f, flags, data); -if (ret <0 ) { -qemu_file_set_error (f, ret); - } - } -} -int ram_control_save_page (QEMUFile *f,ram_addr_t block_offset,ram_addr_t offset,size_t size) {
migration/qemu-file.h +0 -11
@@ -29,20 +29,12 @@#include "exec/cpu-common.h" #include "io/channel.h" -/* -* This function provides hooks around different -* stages of RAM migration. -* 'data' is call specific data associated with the 'flags' value -*/ -typedef int (QEMURamHookFunc )(QEMUFile *f,uint64_t flags,void *data); -/* * Constants used by ram_control_* hooks */ #define RAM_CONTROL_SETUP 0#define RAM_CONTROL_ROUND 1#define RAM_CONTROL_FINISH 3 -#define RAM_CONTROL_BLOCK_REG 4/* * This function allows override of where the RAM page
@@ -54,7 +46,6 @@ typedef int (QEMURamSaveFunc)(QEMUFile *f, size_t size);typedef struct QEMUFileHooks { -QEMURamHookFunc *hook_ram_load;QEMURamSaveFunc *save_page; }QEMUFileHooks ;
@@ -128,8 +119,6 @@ void qemu_fflush(QEMUFile *f);void qemu_file_set_blocking (QEMUFile *f,bool block);int qemu_file_get_to_fd (QEMUFile *f,int fd,size_t size); -void ram_control_load_hook (QEMUFile *f,uint64_t flags,void *data); -/* Whenever this is found in the data stream, the flags * will be passed to ram_control_load_hook in the incoming-migration * side. This lets before_ram_iterate/after_ram_iterate add
migration/ram.c +4 -2
@@ -4004,8 +4004,10 @@ static int ram_load_precopy(QEMUFile *f) ret = -EINVAL ; } } -ram_control_load_hook (f,RAM_CONTROL_BLOCK_REG , - block->idstr); + ret =rdma_block_notification_handle (f, block->idstr); +if (ret <0 ) { +qemu_file_set_error (f, ret); + } }else {error_report ("Unknown ramblock \"%s\", cannot " "accept migration" , id);
migration/rdma.c +9 -20
@@ -3812,20 +3812,22 @@ out: }/* Destination: -* Called via a ram_control_load_hook during the initial RAM load section which -* lists the RAMBlocks by name. This lets us know the order of the RAMBlocks -* on the source. -* We've already built our local RAMBlock list, but not yet sent the list to -* the source. +* Called during the initial RAM load section which lists the +* RAMBlocks by name. This lets us know the order of the RAMBlocks on +* the source. We've already built our local RAMBlock list, but not +* yet sent the list to the source. */ -static int -rdma_block_notification_handle (QEMUFile *f,const char *name) +int rdma_block_notification_handle (QEMUFile *f,const char *name) {RDMAContext *rdma;QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (qemu_file_get_ioc (f));int curr;int found =-1 ; +if (!migrate_rdma ()) { +return 0 ; + } +RCU_READ_LOCK_GUARD (); rdma =qatomic_rcu_read (&rioc->rdmain);
@@ -3853,18 +3855,6 @@ rdma_block_notification_handle(QEMUFile *f, const char *name)return 0 ; } -static int rdma_load_hook (QEMUFile *f,uint64_t flags,void *data) -{ -switch (flags) { -case RAM_CONTROL_BLOCK_REG : -return rdma_block_notification_handle (f, data); - -default : -/* Shouldn't be called with any other values */ -abort (); - } -} -int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags) {QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (qemu_file_get_ioc (f));
@@ -4003,7 +3993,6 @@ err: }static const QEMUFileHooks rdma_read_hooks = { - .hook_ram_load = rdma_load_hook, };static const QEMUFileHooks rdma_write_hooks = {
migration/rdma.h +2 -0
@@ -27,9 +27,11 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp);int qemu_rdma_registration_handle (QEMUFile *f);int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags);int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags); +int rdma_block_notification_handle (QEMUFile *f,const char *name);#else int qemu_rdma_registration_handle (QEMUFile *f) {return 0 ; }int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags) {return 0 ; }int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags) {return 0 ; } +int rdma_block_notification_handle (QEMUFile *f,const char *name) {return 0 ; }#endif #endif
Signature · 1 line
2.40.0
PATCH v3 6/10 migration/rdma: Create rdma_control_save_page()
In reply to Juan QuintelaThe only user of ram_control_save_page() and save_page() hook was rdma. Just move the function to rdma.c, rename it to rdma_control_save_page().
--- migration/qemu-file.c | 20 -------------------- migration/qemu-file.h | 12 ------------ migration/ram.c | 4 ++-- migration/rdma.c | 20 +++++++++++++++++++- migration/rdma.h | 6 ++++++ 5 files changed, 27 insertions(+), 35 deletions(-)
migration/qemu-file.c +0 -20
@@ -303,26 +303,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =0 ; } -int ram_control_save_page (QEMUFile *f,ram_addr_t block_offset, -ram_addr_t offset,size_t size) -{ -if (f->hooks && f->hooks->save_page) { -int ret = f->hooks->save_page (f, block_offset, offset, size); -/* -* RAM_SAVE_CONTROL_* are negative values -*/ -if (ret !=RAM_SAVE_CONTROL_DELAYED && - ret !=RAM_SAVE_CONTROL_NOT_SUPP ) { -if (ret <0 ) { -qemu_file_set_error (f, ret); - } - } -return ret; - } - -return RAM_SAVE_CONTROL_NOT_SUPP ; -} -/* * Attempt to fill the buffer from the underlying file * Returns the number of bytes read, or negative value for an error.
migration/qemu-file.h +0 -12
@@ -36,17 +36,7 @@#define RAM_CONTROL_ROUND 1#define RAM_CONTROL_FINISH 3 -/* -* This function allows override of where the RAM page -* is saved (such as RDMA, for example.) -*/ -typedef int (QEMURamSaveFunc )(QEMUFile *f, -ram_addr_t block_offset, -ram_addr_t offset, -size_t size); -typedef struct QEMUFileHooks { -QEMURamSaveFunc *save_page; }QEMUFileHooks ;QEMUFile *qemu_file_new_input (QIOChannel *ioc);
@@ -129,8 +119,6 @@ int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size);#define RAM_SAVE_CONTROL_NOT_SUPP -1000#define RAM_SAVE_CONTROL_DELAYED -2000 -int ram_control_save_page (QEMUFile *f,ram_addr_t block_offset, -ram_addr_t offset,size_t size);QIOChannel *qemu_file_get_ioc (QEMUFile *file);#endif
migration/ram.c +2 -2
@@ -1176,8 +1176,8 @@ static bool control_save_page(PageSearchStatus *pss, RAMBlock *block, {int ret; - ret =ram_control_save_page (pss->pss_channel, block->offset, offset, -TARGET_PAGE_SIZE ); + ret =rdma_control_save_page (pss->pss_channel, block->offset, offset, +TARGET_PAGE_SIZE );if (ret ==RAM_SAVE_CONTROL_NOT_SUPP ) {return false; }
migration/rdma.c +19 -1
@@ -3319,6 +3319,25 @@ err:return ret; } +int rdma_control_save_page (QEMUFile *f,ram_addr_t block_offset, +ram_addr_t offset,size_t size) +{ +if (!migrate_rdma ()) { +return RAM_SAVE_CONTROL_NOT_SUPP ; + } + +int ret =qemu_rdma_save_page (f, block_offset, offset, size); + +if (ret !=RAM_SAVE_CONTROL_DELAYED && + ret !=RAM_SAVE_CONTROL_NOT_SUPP ) { +if (ret <0 ) { +qemu_file_set_error (f, ret); + } + } +return ret; +} + +static void rdma_accept_incoming_migration (void *opaque);static void rdma_cm_poll_handler (void *opaque)
@@ -3996,7 +4015,6 @@ static const QEMUFileHooks rdma_read_hooks = { };static const QEMUFileHooks rdma_write_hooks = { - .save_page = qemu_rdma_save_page, };
migration/rdma.h +6 -0
@@ -17,6 +17,8 @@#ifndef QEMU_MIGRATION_RDMA_H #define QEMU_MIGRATION_RDMA_H +#include "exec/memory.h" +void rdma_start_outgoing_migration (void *opaque,const char *host_port,Error **errp);
@@ -28,10 +30,14 @@ int qemu_rdma_registration_handle(QEMUFile *f);int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags);int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags);int rdma_block_notification_handle (QEMUFile *f,const char *name); +int rdma_control_save_page (QEMUFile *f,ram_addr_t block_offset, +ram_addr_t offset,size_t size);#else int qemu_rdma_registration_handle (QEMUFile *f) {return 0 ; }int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags) {return 0 ; }int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags) {return 0 ; }int rdma_block_notification_handle (QEMUFile *f,const char *name) {return 0 ; } +int rdma_control_save_page (QEMUFile *f,ram_addr_t block_offset, +ram_addr_t offset,size_t size) {return false; }#endif #endif
Signature · 1 line
2.40.0
PATCH v3 7/10 qemu-file: Remove QEMUFileHooks
In reply to Juan QuintelaThe only user was rdma, and its use is gone.
--- migration/qemu-file.c | 6 ------ migration/qemu-file.h | 4 ---- migration/rdma.c | 9 --------- 3 files changed, 19 deletions(-)
migration/qemu-file.c +0 -6
@@ -38,7 +38,6 @@#define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 64)struct QEMUFile { -const QEMUFileHooks *hooks;QIOChannel *ioc;bool is_writable;
@@ -147,11 +146,6 @@ QEMUFile *qemu_file_new_input(QIOChannel *ioc)return qemu_file_new_impl (ioc, false); } -void qemu_file_set_hooks (QEMUFile *f,const QEMUFileHooks *hooks) -{ - f->hooks = hooks; -} -/* * Get last error for stream f with optional Error* *
migration/qemu-file.h +0 -4
@@ -36,12 +36,8 @@#define RAM_CONTROL_ROUND 1#define RAM_CONTROL_FINISH 3 -typedef struct QEMUFileHooks { -}QEMUFileHooks ; -QEMUFile *qemu_file_new_input (QIOChannel *ioc);QEMUFile *qemu_file_new_output (QIOChannel *ioc); -void qemu_file_set_hooks (QEMUFile *f,const QEMUFileHooks *hooks);int qemu_fclose (QEMUFile *f);/*
migration/rdma.c +0 -9
@@ -4011,13 +4011,6 @@ err:return ret; } -static const QEMUFileHooks rdma_read_hooks = { -}; - -static const QEMUFileHooks rdma_write_hooks = { -}; - -static void qio_channel_rdma_finalize (Object *obj) {QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (obj);
@@ -4076,12 +4069,10 @@ static QEMUFile *qemu_fopen_rdma(RDMAContext *rdma, const char *mode) rioc->file =qemu_file_new_output (QIO_CHANNEL (rioc)); rioc->rdmaout = rdma; rioc->rdmain = rdma->return_path; -qemu_file_set_hooks (rioc->file, &rdma_write_hooks); }else { rioc->file =qemu_file_new_input (QIO_CHANNEL (rioc)); rioc->rdmain = rdma; rioc->rdmaout = rdma->return_path; -qemu_file_set_hooks (rioc->file, &rdma_read_hooks); }return rioc->file;
Signature · 1 line
2.40.0
PATCH v3 8/10 migration/rdma: Move rdma constants from qemu-file.h to rdma.h
In reply to Juan Quintela--- migration/qemu-file.h | 17 ----------------- migration/ram.c | 2 +- migration/rdma.h | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 18 deletions(-)
migration/qemu-file.h +0 -17
@@ -29,13 +29,6 @@#include "exec/cpu-common.h" #include "io/channel.h" -/* -* Constants used by ram_control_* hooks -*/ -#define RAM_CONTROL_SETUP 0 -#define RAM_CONTROL_ROUND 1 -#define RAM_CONTROL_FINISH 3 -QEMUFile *qemu_file_new_input (QIOChannel *ioc);QEMUFile *qemu_file_new_output (QIOChannel *ioc);int qemu_fclose (QEMUFile *f);
@@ -105,16 +98,6 @@ void qemu_fflush(QEMUFile *f);void qemu_file_set_blocking (QEMUFile *f,bool block);int qemu_file_get_to_fd (QEMUFile *f,int fd,size_t size); -/* Whenever this is found in the data stream, the flags -* will be passed to ram_control_load_hook in the incoming-migration -* side. This lets before_ram_iterate/after_ram_iterate add -* transport-specific sections to the RAM migration data. -*/ -#define RAM_SAVE_FLAG_HOOK 0x80 - -#define RAM_SAVE_CONTROL_NOT_SUPP -1000 -#define RAM_SAVE_CONTROL_DELAYED -2000 -QIOChannel *qemu_file_get_ioc (QEMUFile *file);#endif
migration/ram.c +1 -1
@@ -86,7 +86,7 @@#define RAM_SAVE_FLAG_EOS 0x10#define RAM_SAVE_FLAG_CONTINUE 0x20#define RAM_SAVE_FLAG_XBZRLE 0x40 -/* 0x80 is reserved in qemu-file.h for RAM_SAVE_FLAG_HOOK */ +/* 0x80 is reserved in rdma.h for RAM_SAVE_FLAG_HOOK */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100#define RAM_SAVE_FLAG_MULTIFD_FLUSH 0x200/* We can't use any flag that is bigger than 0x200 */
migration/rdma.h +16 -0
@@ -24,6 +24,22 @@ void rdma_start_outgoing_migration(void *opaque, const char *host_port,void rdma_start_incoming_migration (const char *host_port,Error **errp); +/* +* Constants used by rdma return codes +*/ +#define RAM_CONTROL_SETUP 0 +#define RAM_CONTROL_ROUND 1 +#define RAM_CONTROL_FINISH 3 + +/* +* Whenever this is found in the data stream, the flags +* will be passed to rdma functions in the incoming-migration +* side. +*/ +#define RAM_SAVE_FLAG_HOOK 0x80 + +#define RAM_SAVE_CONTROL_NOT_SUPP -1000 +#define RAM_SAVE_CONTROL_DELAYED -2000#ifdef CONFIG_RDMA int qemu_rdma_registration_handle (QEMUFile *f);
Signature · 1 line
2.40.0
PATCH v3 9/10 migration/rdma: Remove qemu_ prefix from exported functions
In reply to Juan QuintelaFunctions are long enough even without this.
--- migration/ram.c | 14 +++++++------- migration/rdma.c | 40 +++++++++++++++++++--------------------- migration/rdma.h | 12 ++++++------ migration/trace-events | 28 ++++++++++++++-------------- 4 files changed, 46 insertions(+), 48 deletions(-)
migration/ram.c +7 -7
@@ -3048,12 +3048,12 @@ static int ram_save_setup(QEMUFile *f, void *opaque) } } - ret =qemu_rdma_registration_start (f,RAM_CONTROL_SETUP ); + ret =rdma_registration_start (f,RAM_CONTROL_SETUP );if (ret <0 ) {qemu_file_set_error (f, ret); } - ret =qemu_rdma_registration_stop (f,RAM_CONTROL_SETUP ); + ret =rdma_registration_stop (f,RAM_CONTROL_SETUP );if (ret <0 ) {qemu_file_set_error (f, ret); }
@@ -3118,7 +3118,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)/* Read version before ram_list.blocks */ smp_rmb (); - ret =qemu_rdma_registration_start (f,RAM_CONTROL_ROUND ); + ret =rdma_registration_start (f,RAM_CONTROL_ROUND );if (ret <0 ) {qemu_file_set_error (f, ret); }
@@ -3178,7 +3178,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)* Must occur before EOS (or any QEMUFile operation) * because of RDMA protocol. */ - ret =qemu_rdma_registration_stop (f,RAM_CONTROL_ROUND ); + ret =rdma_registration_stop (f,RAM_CONTROL_ROUND );if (ret <0 ) {qemu_file_set_error (f, ret); }
@@ -3230,7 +3230,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)migration_bitmap_sync_precopy (rs); } - ret =qemu_rdma_registration_start (f,RAM_CONTROL_FINISH ); + ret =rdma_registration_start (f,RAM_CONTROL_FINISH );if (ret <0 ) {qemu_file_set_error (f, ret); }
@@ -3256,7 +3256,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)ram_flush_compressed_data (rs); -int ret =qemu_rdma_registration_stop (f,RAM_CONTROL_FINISH ); +int ret =rdma_registration_stop (f,RAM_CONTROL_FINISH );if (ret <0 ) {qemu_file_set_error (f, ret); }
@@ -4055,7 +4055,7 @@ static int ram_load_precopy(QEMUFile *f) }break ;case RAM_SAVE_FLAG_HOOK : - ret =qemu_rdma_registration_handle (f); + ret =rdma_registration_handle (f);if (ret <0 ) {qemu_file_set_error (f, ret); }
migration/rdma.c +19 -21
@@ -3550,7 +3550,7 @@ static int dest_ram_sort_func(const void *a, const void *b)* * Keep doing this until the source tells us to stop. */ -int qemu_rdma_registration_handle (QEMUFile *f) +int rdma_registration_handle (QEMUFile *f) {RDMAControlHeader reg_resp = { .len =sizeof (RDMARegisterResult), .type =RDMA_CONTROL_REGISTER_RESULT ,
@@ -3592,7 +3592,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) local = &rdma->local_ram_blocks; do { - trace_qemu_rdma_registration_handle_wait(); + trace_rdma_registration_handle_wait(); ret = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_NONE);
@@ -3612,9 +3612,9 @@ int qemu_rdma_registration_handle(QEMUFile *f) comp = (RDMACompress *) rdma->wr_data[idx].control_curr;network_to_compress (comp); -trace_qemu_rdma_registration_handle_compress (comp->length, - comp->block_idx, - comp->offset); +trace_rdma_registration_handle_compress (comp->length, + comp->block_idx, + comp->offset);if (comp->block_idx >= rdma->local_ram_blocks.nb_blocks) { error_report("rdma: 'compress' bad block index %u (vs %d)", (unsigned int)comp->block_idx,
@@ -3631,11 +3631,11 @@ int qemu_rdma_registration_handle(QEMUFile *f)break ;case RDMA_CONTROL_REGISTER_FINISHED : -trace_qemu_rdma_registration_handle_finished (); +trace_rdma_registration_handle_finished (); goto out;case RDMA_CONTROL_RAM_BLOCKS_REQUEST : -trace_qemu_rdma_registration_handle_ram_blocks (); +trace_rdma_registration_handle_ram_blocks ();/* Sort our local RAM Block list so it's the same as the source, * we can do this since we've filled in a src_index in the list
@@ -3675,7 +3675,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) rdma->dest_blocks[i].length = local->block[i].length;dest_block_to_network (&rdma->dest_blocks[i]); - trace_qemu_rdma_registration_handle_ram_blocks_loop( + trace_rdma_registration_handle_ram_blocks_loop( local->block[i].block_name, local->block[i].offset, local->block[i].length,
@@ -3697,7 +3697,7 @@ int qemu_rdma_registration_handle(QEMUFile *f)break ;case RDMA_CONTROL_REGISTER_REQUEST : -trace_qemu_rdma_registration_handle_register (head.repeat); +trace_rdma_registration_handle_register (head.repeat); reg_resp.repeat = head.repeat; registers = (RDMARegister *) rdma->wr_data[idx].control_curr;
@@ -3711,7 +3711,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) reg_result = &results[count]; -trace_qemu_rdma_registration_handle_register_loop (count, +trace_rdma_registration_handle_register_loop (count, reg->current_index, reg->key.current_addr, reg->chunks);if (reg->current_index >= rdma->local_ram_blocks.nb_blocks) {
@@ -3763,8 +3763,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) reg_result->host_addr = (uintptr_t )block->local_host_addr; -trace_qemu_rdma_registration_handle_register_rkey ( - reg_result->rkey); +trace_rdma_registration_handle_register_rkey (reg_result->rkey);result_to_network (reg_result); }
@@ -3778,7 +3777,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) }break ;case RDMA_CONTROL_UNREGISTER_REQUEST : -trace_qemu_rdma_registration_handle_unregister (head.repeat); +trace_rdma_registration_handle_unregister (head.repeat); unreg_resp.repeat = head.repeat; registers = (RDMARegister *) rdma->wr_data[idx].control_curr;
@@ -3786,7 +3785,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) reg = ®isters[count];network_to_register (reg); -trace_qemu_rdma_registration_handle_unregister_loop (count, +trace_rdma_registration_handle_unregister_loop (count, reg->current_index, reg->key.chunk); block = &(rdma->local_ram_blocks.block[reg->current_index]);
@@ -3802,8 +3801,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) rdma->total_registrations--; -trace_qemu_rdma_registration_handle_unregister_success ( - reg->key.chunk); +trace_rdma_registration_handle_unregister_success (reg->key.chunk); } ret =qemu_rdma_post_send_control (rdma,NULL , &unreg_resp);
@@ -3874,7 +3872,7 @@ int rdma_block_notification_handle(QEMUFile *f, const char *name)return 0 ; } -int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags) +int rdma_registration_start (QEMUFile *f,uint64_t flags) {QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (qemu_file_get_ioc (f));RDMAContext *rdma;
@@ -3891,7 +3889,7 @@ int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags)CHECK_ERROR_STATE (); -trace_qemu_rdma_registration_start (flags); +trace_rdma_registration_start (flags);qemu_put_be64 (f,RAM_SAVE_FLAG_HOOK );qemu_fflush (f);
@@ -3902,7 +3900,7 @@ int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags)* Inform dest that dynamic registrations are done for now. * First, flush writes, if any. */ -int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags) +int rdma_registration_stop (QEMUFile *f,uint64_t flags) {QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (qemu_file_get_ioc (f));RDMAContext *rdma;
@@ -3934,7 +3932,7 @@ int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags)int reg_result_idx, i, nb_dest_blocks; head.type =RDMA_CONTROL_RAM_BLOCKS_REQUEST ; -trace_qemu_rdma_registration_stop_ram (); +trace_rdma_registration_stop_ram ();/* * Make sure that we parallelize the pinning on both sides.
@@ -3996,7 +3994,7 @@ int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) } } -trace_qemu_rdma_registration_stop (flags); +trace_rdma_registration_stop (flags); head.type =RDMA_CONTROL_REGISTER_FINISHED ; ret =qemu_rdma_exchange_send (rdma, &head,NULL ,NULL ,NULL ,NULL );
migration/rdma.h +6 -6
@@ -42,16 +42,16 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp);#define RAM_SAVE_CONTROL_DELAYED -2000#ifdef CONFIG_RDMA -int qemu_rdma_registration_handle (QEMUFile *f); -int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags); -int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags); +int rdma_registration_handle (QEMUFile *f); +int rdma_registration_start (QEMUFile *f,uint64_t flags); +int rdma_registration_stop (QEMUFile *f,uint64_t flags);int rdma_block_notification_handle (QEMUFile *f,const char *name);int rdma_control_save_page (QEMUFile *f,ram_addr_t block_offset,ram_addr_t offset,size_t size);#else -int qemu_rdma_registration_handle (QEMUFile *f) {return 0 ; } -int qemu_rdma_registration_start (QEMUFile *f,uint64_t flags) {return 0 ; } -int qemu_rdma_registration_stop (QEMUFile *f,uint64_t flags) {return 0 ; } +int rdma_registration_handle (QEMUFile *f) {return 0 ; } +int rdma_registration_start (QEMUFile *f,uint64_t flags) {return 0 ; } +int rdma_registration_stop (QEMUFile *f,uint64_t flags) {return 0 ; }int rdma_block_notification_handle (QEMUFile *f,const char *name) {return 0 ; }int rdma_control_save_page (QEMUFile *f,ram_addr_t block_offset,ram_addr_t offset,size_t size) {return false; }
migration/trace-events +14 -14
@@ -224,20 +224,6 @@ qemu_rdma_post_send_control(const char *desc) "CONTROL: sending %s.." qemu_rdma_register_and_get_keys(uint64_t len, void *start) "Registering %" PRIu64 " bytes @ %p" qemu_rdma_register_odp_mr(const char *name) "Try to register On-Demand Paging memory region: %s" qemu_rdma_advise_mr(const char *name, uint32_t len, uint64_t addr, const char *res) "Try to advise block %s prefetch at %" PRIu32 "@0x%" PRIx64 ": %s" -qemu_rdma_registration_handle_compress(int64_t length, int index, int64_t offset) "Zapping zero chunk: %" PRId64 " bytes, index %d, offset %" PRId64 -qemu_rdma_registration_handle_finished(void) "" -qemu_rdma_registration_handle_ram_blocks(void) "" -qemu_rdma_registration_handle_ram_blocks_loop(const char *name, uint64_t offset, uint64_t length, void *local_host_addr, unsigned int src_index) "%s: @0x%" PRIx64 "/%" PRIu64 " host:@%p src_index: %u" -qemu_rdma_registration_handle_register(int requests) "%d requests" -qemu_rdma_registration_handle_register_loop(int req, int index, uint64_t addr, uint64_t chunks) "Registration request (%d): index %d, current_addr %" PRIu64 " chunks: %" PRIu64 -qemu_rdma_registration_handle_register_rkey(int rkey) "0x%x" -qemu_rdma_registration_handle_unregister(int requests) "%d requests" -qemu_rdma_registration_handle_unregister_loop(int count, int index, uint64_t chunk) "Unregistration request (%d): index %d, chunk %" PRIu64 -qemu_rdma_registration_handle_unregister_success(uint64_t chunk) "%" PRIu64 -qemu_rdma_registration_handle_wait(void) "" -qemu_rdma_registration_start(uint64_t flags) "%" PRIu64 -qemu_rdma_registration_stop(uint64_t flags) "%" PRIu64 -qemu_rdma_registration_stop_ram(void) "" qemu_rdma_resolve_host_trying(const char *host, const char *ip) "Trying %s => %s" qemu_rdma_signal_unregister_append(uint64_t chunk, int pos) "Appending unregister chunk %" PRIu64 " at position %d" qemu_rdma_signal_unregister_already(uint64_t chunk) "Unregister chunk %" PRIu64 " already in queue"
@@ -256,6 +242,20 @@ qemu_rdma_write_one_zero(uint64_t chunk, int len, int index, int64_t offset) "En rdma_add_block(const char *block_name, int block, uint64_t addr, uint64_t offset, uint64_t len, uint64_t end, uint64_t bits, int chunks) "Added Block: '%s':%d, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" PRIu64 " bits %" PRIu64 " chunks %d" rdma_block_notification_handle(const char *name, int index) "%s at %d" rdma_delete_block(void *block, uint64_t addr, uint64_t offset, uint64_t len, uint64_t end, uint64_t bits, int chunks) "Deleted Block: %p, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" PRIu64 " bits %" PRIu64 " chunks %d" +rdma_registration_handle_compress(int64_t length, int index, int64_t offset) "Zapping zero chunk: %" PRId64 " bytes, index %d, offset %" PRId64 +rdma_registration_handle_finished(void) "" +rdma_registration_handle_ram_blocks(void) "" +rdma_registration_handle_ram_blocks_loop(const char *name, uint64_t offset, uint64_t length, void *local_host_addr, unsigned int src_index) "%s: @0x%" PRIx64 "/%" PRIu64 " host:@%p src_index: %u" +rdma_registration_handle_register(int requests) "%d requests" +rdma_registration_handle_register_loop(int req, int index, uint64_t addr, uint64_t chunks) "Registration request (%d): index %d, current_addr %" PRIu64 " chunks: %" PRIu64 +rdma_registration_handle_register_rkey(int rkey) "0x%x" +rdma_registration_handle_unregister(int requests) "%d requests" +rdma_registration_handle_unregister_loop(int count, int index, uint64_t chunk) "Unregistration request (%d): index %d, chunk %" PRIu64 +rdma_registration_handle_unregister_success(uint64_t chunk) "%" PRIu64 +rdma_registration_handle_wait(void) "" +rdma_registration_start(uint64_t flags) "%" PRIu64 +rdma_registration_stop(uint64_t flags) "%" PRIu64 +rdma_registration_stop_ram(void) "" rdma_start_incoming_migration(void) "" rdma_start_incoming_migration_after_dest_init(void) "" rdma_start_incoming_migration_after_rdma_listen(void) ""
Signature · 1 line
2.40.0
PATCH v3 10/10 migration/rdma: Check sooner if we are in postcopy for save_page()
In reply to Juan Quintela--- migration/rdma.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
migration/rdma.c +1 -5
@@ -3250,10 +3250,6 @@ static int qemu_rdma_save_page(QEMUFile *f, ram_addr_t block_offset,RDMAContext *rdma;int ret; -if (migration_in_postcopy ()) { -return RAM_SAVE_CONTROL_NOT_SUPP ; - } -RCU_READ_LOCK_GUARD (); rdma =qatomic_rcu_read (&rioc->rdmaout);
@@ -3322,7 +3318,7 @@ err:int rdma_control_save_page (QEMUFile *f,ram_addr_t block_offset,ram_addr_t offset,size_t size) { -if (!migrate_rdma ()) { +if (!migrate_rdma () ||migration_in_postcopy ()) {return RAM_SAVE_CONTROL_NOT_SUPP ; }
Signature · 1 line
2.40.0
Quoted 8 lines · Juan Quintela
Hi
Changes in v3:
- fixrdma_migrationto reset clearly (thanks danp)
- redo the cherks for migration/rdma
- rebased on top of the counters series:
[PATCH 00/21] Migration: More migration atomic counters
Based-on: Message-Id: <[email protected]>
Patch 9 should logically be split and spread into previous patches, but not a big issue.
For the series:
Signature · 1 line
Peter Xu