migration: Put thread names together with macros
PATCH 1/1 migration: Put thread names together with macros
Keep migration thread names together, so it's easier to see a list of all possible migration threads.
Still two functional changes below besides the macro defintions:
- There's one dirty rate thread that we overlooked before, now we add that too and name it as "mig/dirtyrate" following the old rules.
- The old name "mig/src/rp-thr" has "-thr" but it may not be useful if it's a thread name anyway, while "rp" can be slightly hard to read. Taking this chance to rename it to "mig/src/return", hopefully a better name.
--- migration/migration.h | 14 ++++++++++++++ migration/colo.c | 3 ++- migration/dirtyrate.c | 6 ++++-- migration/migration.c | 9 +++++---- migration/multifd.c | 6 +++--- migration/postcopy-ram.c | 6 ++++-- migration/savevm.c | 3 ++- 7 files changed, 34 insertions(+), 13 deletions(-)
migration/migration.h +14 -0
@@ -28,6 +28,20 @@#include "sysemu/runstate.h" #include "migration/misc.h" +#define MIGRATION_THREAD_SNAPSHOT "mig/snapshot" +#define MIGRATION_THREAD_DIRTY_RATE "mig/dirtyrate" + +#define MIGRATION_THREAD_SRC_MAIN "mig/src/main" +#define MIGRATION_THREAD_SRC_MULTIFD "mig/src/send_%d" +#define MIGRATION_THREAD_SRC_RETURN "mig/src/return" +#define MIGRATION_THREAD_SRC_TLS "mig/src/tls" + +#define MIGRATION_THREAD_DST_COLO "mig/dst/colo" +#define MIGRATION_THREAD_DST_MULTIFD "mig/src/recv_%d" +#define MIGRATION_THREAD_DST_FAULT "mig/dst/fault" +#define MIGRATION_THREAD_DST_LISTEN "mig/dst/listen" +#define MIGRATION_THREAD_DST_PREEMPT "mig/dst/preempt" +struct PostcopyBlocktimeContext ;#define MIGRATION_RESUME_ACK_VALUE (1)
migration/colo.c +2 -1
@@ -935,7 +935,8 @@ void coroutine_fn colo_incoming_co(void)assert (bql_locked ());assert (migration_incoming_colo_enabled ()); -qemu_thread_create (&th,"mig/dst/colo" , colo_process_incoming_thread, +qemu_thread_create (&th,MIGRATION_THREAD_DST_COLO , + colo_process_incoming_thread, mis,QEMU_THREAD_JOINABLE ); mis->colo_incoming_co =qemu_coroutine_self ();
migration/dirtyrate.c +4 -2
@@ -29,6 +29,7 @@#include "sysemu/runstate.h" #include "exec/memory.h" #include "qemu/xxhash.h" +#include "migration.h" /* * total_dirty_pages is procted by BQL and is used
@@ -839,8 +840,9 @@ void qmp_calc_dirty_rate(int64_t calc_time,init_dirtyrate_stat (config); -qemu_thread_create (&thread,"get_dirtyrate" , get_dirtyrate_thread, - (void *)&config,QEMU_THREAD_DETACHED ); +qemu_thread_create (&thread,MIGRATION_THREAD_DIRTY_RATE , + get_dirtyrate_thread, (void *)&config, +QEMU_THREAD_DETACHED ); }
migration/migration.c +5 -4
@@ -2484,7 +2484,7 @@ static int open_return_path_on_source(MigrationState *ms)trace_open_return_path_on_source (); -qemu_thread_create (&ms->rp_state.rp_thread,"mig/src/rp-thr" , +qemu_thread_create (&ms->rp_state.rp_thread,MIGRATION_THREAD_SRC_RETURN , source_return_path_thread, ms,QEMU_THREAD_JOINABLE ); ms->rp_state.rp_thread_created = true;
@@ -3473,7 +3473,8 @@ static void *migration_thread(void *opaque)Error *local_err =NULL ;int ret; - thread =migration_threads_add ("live_migration" ,qemu_get_thread_id ()); + thread =migration_threads_add (MIGRATION_THREAD_SRC_MAIN , +qemu_get_thread_id ());rcu_register_thread ();
@@ -3823,10 +3824,10 @@ void migrate_fd_connect(MigrationState *s, Error *error_in) }if (migrate_background_snapshot ()) { -qemu_thread_create (&s->thread,"mig/snapshot" , +qemu_thread_create (&s->thread,MIGRATION_THREAD_SNAPSHOT , bg_migration_thread, s,QEMU_THREAD_JOINABLE ); }else { -qemu_thread_create (&s->thread,"mig/src/main" , +qemu_thread_create (&s->thread,MIGRATION_THREAD_SRC_MAIN , migration_thread, s,QEMU_THREAD_JOINABLE ); } s->migration_thread_running = true;
migration/multifd.c +3 -3
@@ -723,7 +723,7 @@ static bool multifd_tls_channel_connect(MultiFDSendParams *p, args->p = p; p->tls_thread_created = true; -qemu_thread_create (&p->tls_thread,"mig/src/tls" , +qemu_thread_create (&p->tls_thread,MIGRATION_THREAD_SRC_TLS , multifd_tls_handshake_thread, args,QEMU_THREAD_JOINABLE );return true;
@@ -841,7 +841,7 @@ bool multifd_send_setup(void) +sizeof (uint64_t ) * page_count; p->packet =g_malloc0 (p->packet_len); } - p->name =g_strdup_printf ("mig/src/send_%d" , i); + p->name =g_strdup_printf (MIGRATION_THREAD_SRC_MULTIFD , i); p->write_flags =0 ;if (!multifd_new_send_channel_create (p, &local_err)) {
@@ -1259,7 +1259,7 @@ int multifd_recv_setup(Error **errp) +sizeof (uint64_t ) * page_count; p->packet =g_malloc0 (p->packet_len); } - p->name =g_strdup_printf ("mig/dst/recv_%d" , i); + p->name =g_strdup_printf (MIGRATION_THREAD_DST_MULTIFD , i); p->normal =g_new0 (ram_addr_t, page_count); p->zero =g_new0 (ram_addr_t, page_count); }
migration/postcopy-ram.c +4 -2
@@ -1230,7 +1230,8 @@ int postcopy_ram_incoming_setup(MigrationIncomingState *mis)return -1 ; } -postcopy_thread_create (mis, &mis->fault_thread,"mig/dst/fault" , +postcopy_thread_create (mis, &mis->fault_thread, +MIGRATION_THREAD_DST_FAULT , postcopy_ram_fault_thread,QEMU_THREAD_JOINABLE ); mis->have_fault_thread = true;
@@ -1250,7 +1251,8 @@ int postcopy_ram_incoming_setup(MigrationIncomingState *mis)* This thread needs to be created after the temp pages because * it'll fetch RAM_CHANNEL_POSTCOPY PostcopyTmpPage immediately. */ -postcopy_thread_create (mis, &mis->postcopy_prio_thread,"mig/dst/preempt" , +postcopy_thread_create (mis, &mis->postcopy_prio_thread, +MIGRATION_THREAD_DST_PREEMPT , postcopy_preempt_thread,QEMU_THREAD_JOINABLE ); mis->preempt_thread_status =PREEMPT_THREAD_CREATED ; }
migration/savevm.c +2 -1
@@ -2131,7 +2131,8 @@ static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis) } mis->have_listen_thread = true; -postcopy_thread_create (mis, &mis->listen_thread,"mig/dst/listen" , +postcopy_thread_create (mis, &mis->listen_thread, +MIGRATION_THREAD_DST_LISTEN , postcopy_ram_listen_thread,QEMU_THREAD_DETACHED );trace_loadvm_postcopy_handle_listen ("return" );
Signature · 1 line
2.45.0
Quoted 8 lines · Peter Xu
Keep migration thread names together, so it's easier to see a list of all possible migration threads.
Still two functional changes below besides the macro defintions:
- There's one dirty rate thread that we overlooked before, now we add that too and name it as "mig/dirtyrate" following the old rules.
Quoted 6 lines
- The old name "mig/src/rp-thr" has "-thr" but it may not be useful if it's a thread name anyway, while "rp" can be slightly hard to read. Taking this chance to rename it to "mig/src/return", hopefully a better name.
Signed-off-by Peter Xu <[email protected]>
Yong Huang
Acked-byQuoted 10 lines · Fabiano Rosas
Quoted 8 lines · Peter Xu
Keep migration thread names together, so it's easier to see a list of all possible migration threads.
Still two functional changes below besides the macro defintions:
- There's one dirty rate thread that we overlooked before, now we add that too and name it as "mig/dirtyrate" following the old rules.
Quoted 9 lines
Quoted 6 lines
- The old name "mig/src/rp-thr" has "-thr" but it may not be useful if it's a thread name anyway, while "rp" can be slightly hard to read. Taking this chance to rename it to "mig/src/return", hopefully a better name.
Signed-off-by Peter Xu <[email protected]>Reviewed-by Fabiano Rosas <[email protected]>
Signature · 1 line
Best regards
Quoted 19 lines
-----Original Message-----
From: [email protected] <qemu- [email protected]> On Behalf Of Peter Xu
Sent: Friday, October 11, 2024 11:37 PM
To: [email protected]
Cc: Fabiano Rosas <[email protected]>; [email protected]; Yong Huang <[email protected]>; Zhang, Hailiang <[email protected]>
Subject: [PATCH] migration: Put thread names together with macrosKeep migration thread names together, so it's easier to see a list of all possible migration threads.
Still two functional changes below besides the macro defintions:
- There's one dirty rate thread that we overlooked before, now we add that too and name it as "mig/dirtyrate" following the old rules.
Quoted 6 lines
- The old name "mig/src/rp-thr" has "-thr" but it may not be useful if it's a thread name anyway, while "rp" can be slightly hard to read. Taking this chance to rename it to "mig/src/return", hopefully a better name.
Signed-off-by Peter Xu <[email protected]>
Thanks
Chen
Quoted 187 lines
--- migration/migration.h | 14 ++++++++++++++ migration/colo.c | 3 ++- migration/dirtyrate.c | 6 ++++-- migration/migration.c | 9 +++++---- migration/multifd.c | 6 +++--- migration/postcopy-ram.c | 6 ++++-- migration/savevm.c | 3 ++- 7 files changed, 34 insertions(+), 13 deletions(-)migration/migration.h index renamed from migration/migration.h +0
-0
38aa1402d5..b9ce5aa4ff100644migration/migration.h +14
-0@@ -28,6 +28,20 @@#include "sysemu/runstate.h" #include "migration/misc.h" +#define MIGRATION_THREAD_SNAPSHOT "mig/snapshot" +#define MIGRATION_THREAD_DIRTY_RATE "mig/dirtyrate" + +#define MIGRATION_THREAD_SRC_MAIN "mig/src/main" +#define MIGRATION_THREAD_SRC_MULTIFD "mig/src/send_%d" +#define MIGRATION_THREAD_SRC_RETURN "mig/src/return" +#define MIGRATION_THREAD_SRC_TLS "mig/src/tls" + +#define MIGRATION_THREAD_DST_COLO "mig/dst/colo" +#define MIGRATION_THREAD_DST_MULTIFD "mig/src/recv_%d" +#define MIGRATION_THREAD_DST_FAULT "mig/dst/fault" +#define MIGRATION_THREAD_DST_LISTEN "mig/dst/listen" +#define MIGRATION_THREAD_DST_PREEMPT "mig/dst/preempt" +struct PostcopyBlocktimeContext ;#define MIGRATION_RESUME_ACK_VALUE (1) diff --git a/migration/colo.c
b/migration/colo.cindex 6449490221..9590f281d0 100644migration/colo.c +2
-1@@ -935,7 +935,8 @@ void coroutine_fn colo_incoming_co(void)assert (bql_locked ());assert (migration_incoming_colo_enabled ()); -qemu_thread_create (&th,"mig/dst/colo" , colo_process_incoming_thread, +qemu_thread_create (&th,MIGRATION_THREAD_DST_COLO , + colo_process_incoming_thread, mis,QEMU_THREAD_JOINABLE ); mis->colo_incoming_co = qemu_coroutine_self(); diff --git
a/migration/dirtyrate.cb/migration/dirtyrate.cindex233acb0855..a74a6aeb56100644migration/dirtyrate.c +1
-0@@ -29,6 +29,7 @@#include "sysemu/runstate.h" #include "exec/memory.h" #include "qemu/xxhash.h" +#include "migration.h" /* * total_dirty_pages is procted by BQL and is used @@ -839,8 +840,9 @@ void qmp_calc_dirty_rate(int64_t
calc_time,init_dirtyrate_stat(config);migration/dirtyrate.c +3
-2-qemu_thread_create (&thread,"get_dirtyrate" , get_dirtyrate_thread, - (void *)&config,QEMU_THREAD_DETACHED ); +qemu_thread_create (&thread,MIGRATION_THREAD_DIRTY_RATE , + get_dirtyrate_thread, (void *)&config, +QEMU_THREAD_DETACHED ); }migration/migration.c index renamed from migration/migration.c +0
-0
f5f428e764..7609e0feed100644migration/migration.c +6
-4@@ -2484,7 +2484,7 @@ static int open_return_path_on_source(MigrationState *ms)trace_open_return_path_on_source (); -qemu_thread_create (&ms->rp_state.rp_thread,"mig/src/rp-thr" , +qemu_thread_create (&ms->rp_state.rp_thread, +MIGRATION_THREAD_SRC_RETURN , source_return_path_thread, ms,QEMU_THREAD_JOINABLE ); ms->rp_state.rp_thread_created = true;@@ -3473,7 +3473,8 @@ static void *migration_thread(void *opaque)Error *local_err =NULL ;int ret; - thread =migration_threads_add ("live_migration" ,qemu_get_thread_id ()); + thread =migration_threads_add (MIGRATION_THREAD_SRC_MAIN , +qemu_get_thread_id ());rcu_register_thread ();@@ -3823,10 +3824,10 @@ void migrate_fd_connect(MigrationState *s, Error *error_in) }if (migrate_background_snapshot ()) { -qemu_thread_create (&s->thread,"mig/snapshot" , +qemu_thread_create (&s->thread,MIGRATION_THREAD_SNAPSHOT , bg_migration_thread, s,QEMU_THREAD_JOINABLE ); }else { -qemu_thread_create (&s->thread,"mig/src/main" , +qemu_thread_create (&s->thread,MIGRATION_THREAD_SRC_MAIN , migration_thread, s,QEMU_THREAD_JOINABLE ); }s->migration_thread_running = true; diff --git a/migration/multifd.c
b/migration/multifd.cindex9b200f4ad9..697fe86fdf100644migration/multifd.c +1
-1@@ -723,7 +723,7 @@ static boolmultifd_tls_channel_connect (MultiFDSendParams *p, args->p = p; p->tls_thread_created = true; -qemu_thread_create (&p->tls_thread,"mig/src/tls" , +qemu_thread_create (&p->tls_thread,MIGRATION_THREAD_SRC_TLS , multifd_tls_handshake_thread, args,QEMU_THREAD_JOINABLE );return true;migration/multifd.c +3
-2@@ -841,7 +841,7 @@ bool multifd_send_setup(void) +sizeof (uint64_t ) * page_count; p->packet =g_malloc0 (p->packet_len); } - p->name =g_strdup_printf ("mig/src/send_%d" , i); + p->name =g_strdup_printf (MIGRATION_THREAD_SRC_MULTIFD , i); p->write_flags =0 ; if (!multifd_new_send_channel_create(p, &local_err)) { @@ -1259,7 +1259,7 @@ int multifd_recv_setup(Error **errp) +sizeof (uint64_t ) * page_count; p->packet =g_malloc0 (p->packet_len); } - p->name =g_strdup_printf ("mig/dst/recv_%d" , i); + p->name =g_strdup_printf (MIGRATION_THREAD_DST_MULTIFD , i); p->normal =g_new0 (ram_addr_t, page_count); p->zero =g_new0 (ram_addr_t, page_count); }migration/postcopy-ram.c index renamed from migration/postcopy-ram.c +0
-0
83f6160a36..a535fd2e30100644migration/postcopy-ram.c +4
-2@@ -1230,7 +1230,8 @@ int postcopy_ram_incoming_setup(MigrationIncomingState *mis)return -1 ; } -postcopy_thread_create (mis, &mis->fault_thread,"mig/dst/fault" , +postcopy_thread_create (mis, &mis->fault_thread, +MIGRATION_THREAD_DST_FAULT , postcopy_ram_fault_thread,QEMU_THREAD_JOINABLE ); mis->have_fault_thread = true;@@ -1250,7 +1251,8 @@ intpostcopy_ram_incoming_setup(MigrationIncomingState *mis) * This thread needs to be created after the temp pages because * it'll fetch RAM_CHANNEL_POSTCOPY PostcopyTmpPage immediately. */ -postcopy_thread_create (mis, &mis->postcopy_prio_thread,"mig/dst/preempt" , +postcopy_thread_create (mis, &mis->postcopy_prio_thread, +MIGRATION_THREAD_DST_PREEMPT , postcopy_preempt_thread,QEMU_THREAD_JOINABLE );mis->preempt_thread_status = PREEMPT_THREAD_CREATED; }migration/savevm.c index renamed from migration/savevm.c +0
-0
7e1e27182a..e796436979100644migration/savevm.c +2
-2@@ -2131,7 +2131,8 @@ static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis) } mis->have_listen_thread = true; -postcopy_thread_create (mis, &mis->listen_thread,"mig/dst/listen" , +postcopy_thread_create (mis, &mis->listen_thread, +MIGRATION_THREAD_DST_LISTEN , postcopy_ram_listen_thread,QEMU_THREAD_DETACHED );trace_loadvm_postcopy_handle_listen ("return" ); --2.45.0
Quoted 8 lines · Peter Xu
Keep migration thread names together, so it's easier to see a list of all possible migration threads.
Still two functional changes below besides the macro defintions:
- There's one dirty rate thread that we overlooked before, now we add that too and name it as "mig/dirtyrate" following the old rules.
Quoted 6 lines
- The old name "mig/src/rp-thr" has "-thr" but it may not be useful if it's a thread name anyway, while "rp" can be slightly hard to read. Taking this chance to rename it to "mig/src/return", hopefully a better name.
Signed-off-by Peter Xu <[email protected]>
queued.
Signature · 1 line
Peter Xu