Add trace points for the consumer batch drain, the WRITE run, and the
batched REGISTER_REQUEST, and log the peak register batch size at
migration end.

Signed-off-by: Dmitrii Omelchenko <[email protected]>
---
 migration/rdma.c       | 6 +++++-
 migration/trace-events | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/migration/rdma.c b/migration/rdma.c
index aa1a81619f..863165de26 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -1940,6 +1940,7 @@ static int qemu_rdma_write_register(RDMAContext *rdma, 
RDMARegister *regs,
     head.repeat = count;
 
     rdma_reg_batch_record(rdma->send_ring, count);
+    trace_rdma_write_register_batch(count);
 
     if (qemu_rdma_exchange_send(rdma, &head, (uint8_t *)net,
                                 &resp, &reg_result_idx, NULL, errp) < 0) {
@@ -2970,6 +2971,7 @@ static int qemu_rdma_write_run(RDMAContext *rdma, 
RDMASendRing *r,
         n++;
     }
 
+    trace_rdma_write_run(n);
     if (regn == 0) {
         return (int)n;
     }
@@ -3072,6 +3074,7 @@ static void *rdma_consumer_thread(void *opaque)
          */
         batch = avail < RDMA_CONSUMER_BATCH_MAX ? avail
                                                 : RDMA_CONSUMER_BATCH_MAX;
+        trace_rdma_consumer_batch(batch, avail);
 
         while (processed < batch) {
             unsigned idx = r->tail + processed;
@@ -3542,7 +3545,8 @@ static void rdma_nbsent_stats_dump(RDMAContext *rdma)
 static void rdma_prodcons_stats_dump(RDMASendRing *r)
 {
     trace_rdma_prodcons_stats(r->idle_max_ns, r->pushwait_max_ns,
-                              r->pushwait_total_ns, r->occupancy_max);
+                              r->pushwait_total_ns, r->occupancy_max,
+                              r->reg_batch_max);
 }
 
 int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset,
diff --git a/migration/trace-events b/migration/trace-events
index 833351a03f..e05ca23f32 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -243,10 +243,13 @@ rdma_register_odp_mr(const char *name) "Try to register 
On-Demand Paging memory
 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"
 rdma_resolve_host_trying(const char *host, const char *ip) "Trying %s => %s"
 rdma_write_flush(int sent) "sent total: %d"
+rdma_write_run(uint32_t n) "consumer write run: %" PRIu32 " chunks"
+rdma_write_register_batch(uint32_t count) "batch register: %" PRIu32 " chunks"
 rdma_write_one_post(uint64_t chunk, long addr, long remote, uint32_t len) 
"Posting chunk: %" PRIu64 ", addr: 0x%lx remote: 0x%lx, bytes %" PRIu32
 rdma_post_send_queue_full(uint64_t wr_id, int sent) "send queue full, wr_id=%" 
PRIu64 ", outstanding writes=%d"
 rdma_nbsent_stats(uint64_t max, uint64_t posts, uint64_t full_hits, uint64_t 
zero_hits) "nb_sent max %" PRIu64 " posts %" PRIu64 " full-queue hits %" PRIu64 
" drains to zero %" PRIu64
 rdma_consumer_dispatch(int type, uint32_t bidx, uint32_t cidx, uint32_t seq) 
"cmd type=%d block=%" PRIu32 " chunk=%" PRIu32 " seq=%" PRIu32
+rdma_consumer_batch(uint32_t batch, uint32_t occupancy) "consumer batch: 
draining %" PRIu32 " of %" PRIu32 " queued"
 rdma_ring_wake_producer(void) "waking blocked producer"
 rdma_ring_wake_consumer(void) "waking idle consumer"
 rdma_ring_push_begin(const char *type, uint32_t chunk_index) "push begin 
type=%s chunk_index=%" PRIu32
@@ -258,7 +261,7 @@ rdma_consumer_thread_stop(bool aborted) "consumer thread 
stopped, aborted=%d"
 rdma_consumer_idle_begin(void) "consumer idle: waiting for commands"
 rdma_consumer_idle_end(int64_t idle_ns) "consumer idle: woke after %" PRId64 " 
ns"
 rdma_ram_round_notify(uint32_t occupancy) "ram round notify: ring occupancy=%" 
PRIu32
-rdma_prodcons_stats(uint64_t idle_max, uint64_t pushwait_max, uint64_t 
pushwait_total, uint64_t occupancy_max) "idle max %" PRIu64 " ns, push 
full-wait max %" PRIu64 " ns total %" PRIu64 " ns, ring occupancy max %" PRIu64
+rdma_prodcons_stats(uint64_t idle_max, uint64_t pushwait_max, uint64_t 
pushwait_total, uint64_t occupancy_max, uint64_t reg_batch_max) "idle max %" 
PRIu64 " ns, push full-wait max %" PRIu64 " ns total %" PRIu64 " ns, ring 
occupancy max %" PRIu64 ", register batch max %" PRIu64
 rdma_write_one_recvregres(int mykey, int theirkey, uint64_t chunk) "Received 
registration result: my key: 0x%x their key 0x%x, chunk %" PRIu64
 rdma_write_one_sendreg(uint64_t chunk, int len, int index, int64_t offset) 
"Sending registration request chunk %" PRIu64 " for %d bytes, index: %d, 
offset: %" PRId64
 rdma_write_one_top(uint64_t chunks, uint64_t size) "Writing %" PRIu64 " 
chunks, (%" PRIu64 " MB)"
-- 
2.39.5


Reply via email to