From 3f18784d1bb30bb8006ee8081b06d7d33f41426f Mon Sep 17 00:00:00 2001 From: zhia Date: Thu, 29 Feb 2024 15:38:28 +0800 Subject: [PATCH] migration: report compress thread pid to libvirt Supports migrating compressed threads bound to physical cores, qemu need to tell libvirt the compress thread pids. Signed-off-by: jipengfei Signed-off-by: zhia --- migration/ram-compress.c | 5 +++++ qapi/migration.json | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/migration/ram-compress.c b/migration/ram-compress.c index fa4388f6a6..36c7a06e9f 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -87,6 +87,8 @@ static CompressResult do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block, ram_addr_t offset, uint8_t *source_buf); +void qapi_event_send_migration_compress_pid(int); + static void *do_data_compress(void *opaque) { CompressParam *param = opaque; @@ -94,6 +96,9 @@ static void *do_data_compress(void *opaque) ram_addr_t offset; CompressResult result; + /* report compress thread pids to libvirt */ + qapi_event_send_migration_compress_pid(qemu_get_thread_id()); + qemu_mutex_lock(¶m->mutex); while (!param->quit) { if (param->trigger) { diff --git a/qapi/migration.json b/qapi/migration.json index eb2f883513..5859f9e8b6 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1418,6 +1418,18 @@ { 'event': 'MIGRATION_PASS', 'data': { 'pass': 'int' } } +## +# @MIGRATION_COMPRESS_PID: +# +# Emitted when compress thread appear +# +# @pid: pid of compress thread +# +# Since: 6.2 +## +{ 'event': 'MIGRATION_COMPRESS_PID', + 'data': { 'pid': 'int' } } + ## # @COLOMessage: # -- Gitee