Commit 791cdc2a27 for qemu.org
commit 791cdc2a27313e80ebde1d708614d8f240bbb1b0
Author: Yanfei Xu <yanfei.xu@bytedance.com>
Date: Sun Sep 13 14:24:54 2026 +0800
migration/rdma: Allow multiple in-flight writes per chunk
qemu_rdma_write_one() waits for an earlier write that shares the same
registration chunk, even when the dirty ranges do not overlap. This
serializes sparse writes and leaves send queue capacity unused.
RAM round notifiers now provide the completion barrier before a newer
page version can be sent, and the obsolete unregister path no longer
requires per-chunk serialization. Remove the wait. The global nb_sent
count continues to manage CQ and send queue resources.
Signed-off-by: Yanfei Xu <yanfei.xu@bytedance.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Tested-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
diff --git a/migration/rdma.c b/migration/rdma.c
index 7d220acef8..da5dff2f9b 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -1769,7 +1769,7 @@ static int qemu_rdma_write_one(RDMAContext *rdma,
{
struct ibv_sge sge;
struct ibv_send_wr send_wr = { 0 };
- int reg_result_idx, ret, count = 0;
+ int reg_result_idx, ret;
uint64_t chunk, chunks;
uint64_t chunk_size = migrate_rdma_chunk_size();
uint8_t *chunk_start, *chunk_end;
@@ -1800,23 +1800,6 @@ static int qemu_rdma_write_one(RDMAContext *rdma,
chunk_end = ram_chunk_end(block, chunk + chunks);
-
- while (test_bit(chunk, block->transit_bitmap)) {
- (void)count;
- trace_rdma_write_one_block(count++, current_index, chunk,
- sge.addr, length, rdma->nb_sent, block->nb_chunks);
-
- ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL);
-
- if (ret < 0) {
- error_setg(errp, "Failed to Wait for previous write to complete "
- "block %d chunk %" PRIu64
- " current %" PRIu64 " len %" PRIu64 " %d",
- current_index, chunk, sge.addr, length, rdma->nb_sent);
- return -1;
- }
- }
-
if (!rdma->pin_all) {
if (!block->remote_keys[chunk]) {
/*
diff --git a/migration/trace-events b/migration/trace-events
index 2ee2c8f212..00ac737aa9 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -243,7 +243,6 @@ 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_one_block(int count, int block, uint64_t chunk, uint64_t current, uint64_t len, int nb_sent, int nb_chunks) "(%d) Not clobbering: block: %d chunk %" PRIu64 " current %" PRIu64 " len %" PRIu64 " %d %d"
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_write_one_recvregres(int mykey, int theirkey, uint64_t chunk) "Received registration result: my key: 0x%x their key 0x%x, chunk %" PRIu64