Commit 31062bab62 for qemu.org
commit 31062bab622b48fab2cd9b2ff13d0ef1b11f3c37
Author: Yanfei Xu <yanfei.xu@bytedance.com>
Date: Sun Sep 13 14:24:55 2026 +0800
migration/rdma: Remove unused transit bitmap
After the per-chunk write wait is removed, transit_bitmap is no longer
read. The remaining set and clear operations only maintain unused
state.
Remove the bitmap and simplify the block lifecycle tracepoints.
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 da5dff2f9b..444123cbca 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -30,7 +30,6 @@
#include "qemu/module.h"
#include "qemu/rcu.h"
#include "qemu/sockets.h"
-#include "qemu/bitmap.h"
#include "qemu/coroutine.h"
#include "system/memory.h"
#include <sys/socket.h>
@@ -197,7 +196,6 @@ typedef struct RDMALocalBlock {
int index; /* which block are we */
unsigned int src_index; /* (Only used on dest) */
int nb_chunks;
- unsigned long *transit_bitmap;
} RDMALocalBlock;
/*
@@ -571,8 +569,6 @@ static void rdma_add_block(RDMAContext *rdma, const char *block_name,
block->index = local->nb_blocks;
block->src_index = ~0U; /* Filled in by the receipt of the block list */
block->nb_chunks = ram_chunk_index(host_addr, host_addr + length) + 1UL;
- block->transit_bitmap = bitmap_new(block->nb_chunks);
- bitmap_clear(block->transit_bitmap, 0, block->nb_chunks);
block->remote_keys = g_new0(uint32_t, block->nb_chunks);
if (rdma->blockmap) {
@@ -583,8 +579,6 @@ static void rdma_add_block(RDMAContext *rdma, const char *block_name,
(uintptr_t) block->local_host_addr,
block->offset, block->length,
(uintptr_t) (block->local_host_addr + block->length),
- BITS_TO_LONGS(block->nb_chunks) *
- sizeof(unsigned long) * 8,
block->nb_chunks);
local->nb_blocks++;
@@ -654,9 +648,6 @@ static void rdma_delete_block(RDMAContext *rdma, RDMALocalBlock *block)
block->mr = NULL;
}
- g_free(block->transit_bitmap);
- block->transit_bitmap = NULL;
-
g_free(block->remote_keys);
block->remote_keys = NULL;
@@ -693,9 +684,8 @@ static void rdma_delete_block(RDMAContext *rdma, RDMALocalBlock *block)
trace_rdma_delete_block(block, (uintptr_t)block->local_host_addr,
block->offset, block->length,
- (uintptr_t)(block->local_host_addr + block->length),
- BITS_TO_LONGS(block->nb_chunks) *
- sizeof(unsigned long) * 8, block->nb_chunks);
+ (uintptr_t)(block->local_host_addr + block->length),
+ block->nb_chunks);
g_free(old);
@@ -1221,8 +1211,6 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct ibv_cq *cq,
index, chunk, block->local_host_addr,
(void *)(uintptr_t)block->remote_host_addr);
- clear_bit(chunk, block->transit_bitmap);
-
if (rdma->nb_sent > 0) {
rdma->nb_sent--;
}
@@ -1905,8 +1893,7 @@ static int qemu_rdma_write_one(RDMAContext *rdma,
/*
* Encode the ram block index and chunk within this wrid.
* We will use this information at the time of completion
- * to figure out which bitmap to check against and then which
- * chunk in the bitmap to look for.
+ * to identify the completed write in trace output.
*/
send_wr.wr_id = qemu_rdma_make_wrid(RDMA_WRID_RDMA_WRITE,
current_index, chunk);
@@ -1925,7 +1912,6 @@ static int qemu_rdma_write_one(RDMAContext *rdma,
return -1;
}
- set_bit(chunk, block->transit_bitmap);
qatomic_add(&mig_stats.normal_pages, sge.length / qemu_target_page_size());
/*
* We are adding to transferred the amount of data written, but no
diff --git a/migration/trace-events b/migration/trace-events
index 00ac737aa9..db911fe6f2 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -249,9 +249,9 @@ rdma_write_one_recvregres(int mykey, int theirkey, uint64_t chunk) "Received reg
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)"
rdma_write_one_zero(uint64_t chunk, int len, int index, int64_t offset) "Entire chunk is zero, sending compress: %" PRIu64 " for %d bytes, index: %d, offset: %" PRId64
-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_add_block(const char *block_name, int block, uint64_t addr, uint64_t offset, uint64_t len, uint64_t end, int chunks) "Added Block: '%s':%d, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" 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_delete_block(void *block, uint64_t addr, uint64_t offset, uint64_t len, uint64_t end, int chunks) "Deleted Block: %p, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" 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) ""