On 12/10/2023 04:35, Juan Quintela wrote: > Functions are long enough even without this. > > Reviewed-by: Peter Xu <pet...@redhat.com> > Signed-off-by: Juan Quintela <quint...@redhat.com>
Reviewed-by: Li Zhijian <lizhij...@fujitsu.com> > --- > migration/rdma.h | 12 ++++++------ > migration/ram.c | 14 +++++++------- > migration/rdma.c | 40 +++++++++++++++++++--------------------- > migration/trace-events | 28 ++++++++++++++-------------- > 4 files changed, 46 insertions(+), 48 deletions(-) > > diff --git a/migration/rdma.h b/migration/rdma.h > index 1ff3718a76..30b15b4466 100644 > --- a/migration/rdma.h > +++ b/migration/rdma.h > @@ -42,19 +42,19 @@ 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 > static inline > -int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } > +int rdma_registration_handle(QEMUFile *f) { return 0; } > static inline > -int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } > +int rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } > static inline > -int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } > +int rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } > static inline > int rdma_block_notification_handle(QEMUFile *f, const char *name) { return > 0; } > static inline > diff --git a/migration/ram.c b/migration/ram.c > index f9bbd17028..2f65535d05 100644 > --- a/migration/ram.c > +++ b/migration/ram.c > @@ -3063,12 +3063,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); > } > @@ -3130,7 +3130,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); > } > @@ -3190,7 +3190,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); > } > @@ -3241,7 +3241,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque) > migration_bitmap_sync_precopy(rs, true); > } > > - 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); > } > @@ -3267,7 +3267,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); > } > @@ -4074,7 +4074,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); > } > diff --git a/migration/rdma.c b/migration/rdma.c > index ca2a15be99..d3bba05262 100644 > --- a/migration/rdma.c > +++ b/migration/rdma.c > @@ -3541,7 +3541,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, > @@ -3587,7 +3587,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, &err); > > @@ -3607,9 +3607,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, > @@ -3625,11 +3625,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(); > return 0; > > 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 > @@ -3668,7 +3668,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, > @@ -3691,7 +3691,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; > @@ -3705,7 +3705,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) > { > @@ -3753,8 +3753,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); > } > @@ -3768,7 +3767,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; > > @@ -3776,7 +3775,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]); > @@ -3792,8 +3791,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, > &err); > @@ -3860,7 +3858,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) > { > if (!migrate_rdma () || migration_in_postcopy()) { > return 0; > @@ -3877,7 +3875,7 @@ int qemu_rdma_registration_start(QEMUFile *f, uint64_t > flags) > return -1; > } > > - trace_qemu_rdma_registration_start(flags); > + trace_rdma_registration_start(flags); > qemu_put_be64(f, RAM_SAVE_FLAG_HOOK); > qemu_fflush(f); > > @@ -3888,7 +3886,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; > Error *err = NULL; > @@ -3924,7 +3922,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. > @@ -3988,7 +3986,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, > &err); > diff --git a/migration/trace-events b/migration/trace-events > index ee9c8f4d63..b56442d7dd 100644 > --- a/migration/trace-events > +++ b/migration/trace-events > @@ -231,20 +231,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" > @@ -263,6 +249,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) ""