aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorJiang Jiacheng <jiangjiacheng@huawei.com>2023-02-03 15:35:19 +0800
committerJuan Quintela <quintela@redhat.com>2023-02-06 19:22:57 +0100
commit1b1f4ab69c41279a45ccd0d3178e83471e6e4ec1 (patch)
treeb517d16a2b4d554b13749cab5324ffb242070202 /migration
parent671326201dac8fe91222ba0045709f04a8ec3af4 (diff)
migration: save/delete migration thread info
To support query migration thread infomation, save and delete thread(live_migration and multifdsend) information at thread creation and finish. Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c5
-rw-r--r--migration/multifd.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 66c74f8e17..7a14aa98d8 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -58,6 +58,7 @@
#include "net/announce.h"
#include "qemu/queue.h"
#include "multifd.h"
+#include "threadinfo.h"
#include "qemu/yank.h"
#include "sysemu/cpus.h"
#include "yank_functions.h"
@@ -4028,10 +4029,13 @@ static void qemu_savevm_wait_unplug(MigrationState *s, int old_state,
static void *migration_thread(void *opaque)
{
MigrationState *s = opaque;
+ MigrationThread *thread = NULL;
int64_t setup_start = qemu_clock_get_ms(QEMU_CLOCK_HOST);
MigThrError thr_error;
bool urgent = false;
+ thread = MigrationThreadAdd("live_migration", qemu_get_thread_id());
+
rcu_register_thread();
object_ref(OBJECT(s));
@@ -4108,6 +4112,7 @@ static void *migration_thread(void *opaque)
migration_iteration_finish(s);
object_unref(OBJECT(s));
rcu_unregister_thread();
+ MigrationThreadDel(thread);
return NULL;
}
diff --git a/migration/multifd.c b/migration/multifd.c
index 437bf6f808..b7ad7002e0 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -24,6 +24,7 @@
#include "qemu-file.h"
#include "trace.h"
#include "multifd.h"
+#include "threadinfo.h"
#include "qemu/yank.h"
#include "io/channel-socket.h"
@@ -649,10 +650,13 @@ int multifd_send_sync_main(QEMUFile *f)
static void *multifd_send_thread(void *opaque)
{
MultiFDSendParams *p = opaque;
+ MigrationThread *thread = NULL;
Error *local_err = NULL;
int ret = 0;
bool use_zero_copy_send = migrate_use_zero_copy_send();
+ thread = MigrationThreadAdd(p->name, qemu_get_thread_id());
+
trace_multifd_send_thread_start(p->id);
rcu_register_thread();
@@ -762,6 +766,7 @@ out:
qemu_mutex_unlock(&p->mutex);
rcu_unregister_thread();
+ MigrationThreadDel(thread);
trace_multifd_send_thread_end(p->id, p->num_packets, p->total_normal_pages);
return NULL;