Multifd Cleanup
cover Multifd Cleanup
Just found several small places for unused variables.
Wei Yang (4):
migration: multifd_save_setup always return 0 migration/ram.c: use same type in MultiFDPages_t to define offsest migration/ram.c: MultiFDSendParams.sem_sync is not really used migration/ram.c: multifd_send_state->count is not really used
migration/migration.c | 7 +------ migration/ram.c | 11 +---------- 2 files changed, 2 insertions(+), 16 deletions(-)
Signature · 1 line
2.19.1
PATCH 1/4 migration: multifd_save_setup always return 0
--- migration/migration.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
migration/migration.c +1 -6
@@ -3336,12 +3336,7 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)return ; } -if (multifd_save_setup () !=0 ) { -migrate_set_state (&s->state,MIGRATION_STATUS_SETUP , -MIGRATION_STATUS_FAILED ); -migrate_fd_cleanup (s); -return ; - } +multifd_save_setup ();qemu_thread_create (&s->thread,"live_migration" , migration_thread, s,QEMU_THREAD_JOINABLE ); s->migration_thread_running = true;
Signature · 1 line
2.19.1
Juan Quintela
NAKRe: [Qemu-devel] [PATCH 1/4] migration: multifd_save_setup always return 0
Quoted 13 lines · Wei Yang
Signed-off-by Wei Yang <[email protected]>--- migration/migration.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)migration/migration.c +0
-0@@ -3336,12 +3336,7 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)return ; }
migration/migration.c void migrate_fd_connect(MigrationState *s, Error *error_in) · line 3342
Quoted 10 lines
migration/migration.c +1
-6-if (multifd_save_setup () !=0 ) { -migrate_set_state (&s->state,MIGRATION_STATUS_SETUP , -MIGRATION_STATUS_FAILED ); -migrate_fd_cleanup (s); -return ; - } +multifd_save_setup ();qemu_thread_create (&s->thread,"live_migration" , migration_thread, s,QEMU_THREAD_JOINABLE ); s->migration_thread_running = true;
Nack.
On the compression patches that are on list, multifd_save_setup() returns -1 if there is a problem when we allocate a zbuff.
Re: [Qemu-devel] [PATCH 1/4] migration: multifd_save_setup always return 0
Quoted 27 lines · Juan Quintela
Quoted 13 lines · Wei Yang
Signed-off-by Wei Yang <[email protected]>--- migration/migration.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)migration/migration.c +0
-0@@ -3336,12 +3336,7 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)return ; }migration/migration.c void migrate_fd_connect(MigrationState *s, Error *error_in) · line 3342
Quoted 10 lines
migration/migration.c +1
-6-if (multifd_save_setup () !=0 ) { -migrate_set_state (&s->state,MIGRATION_STATUS_SETUP , -MIGRATION_STATUS_FAILED ); -migrate_fd_cleanup (s); -return ; - } +multifd_save_setup ();qemu_thread_create (&s->thread,"live_migration" , migration_thread, s,QEMU_THREAD_JOINABLE ); s->migration_thread_running = true;Nack.
Quoted 2 lines
On the compression patches that are on list,
multifd_save_setup()returns -1 if there is a problem when we allocate a zbuff.
You mean there are some patches in mail list?
Signature · 2 lines
Wei Yang Help you, Help me
Re: [Qemu-devel] [PATCH 1/4] migration: multifd_save_setup always return 0
Quoted 28 lines · Wei Yang
Quoted 27 lines · Juan Quintela
Quoted 13 lines · Wei Yang
Signed-off-by Wei Yang <[email protected]>--- migration/migration.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)migration/migration.c +0
-0@@ -3336,12 +3336,7 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)return ; }migration/migration.c void migrate_fd_connect(MigrationState *s, Error *error_in) · line 3342
Quoted 10 lines
migration/migration.c +1
-6-if (multifd_save_setup () !=0 ) { -migrate_set_state (&s->state,MIGRATION_STATUS_SETUP , -MIGRATION_STATUS_FAILED ); -migrate_fd_cleanup (s); -return ; - } +multifd_save_setup ();qemu_thread_create (&s->thread,"live_migration" , migration_thread, s,QEMU_THREAD_JOINABLE ); s->migration_thread_running = true;Nack.
Quoted 4 lines
Quoted 2 lines
On the compression patches that are on list,
multifd_save_setup()returns -1 if there is a problem when we allocate a zbuff.You mean there are some patches in mail list?
Yeap.
Re: [Qemu-devel] [PATCH 1/4] migration: multifd_save_setup always return 0
In reply to Wei YangQuoted 28 lines · Wei Yang
Quoted 27 lines · Juan Quintela
Quoted 13 lines · Wei Yang
Signed-off-by Wei Yang <[email protected]>--- migration/migration.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)migration/migration.c +0
-0@@ -3336,12 +3336,7 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)return ; }migration/migration.c void migrate_fd_connect(MigrationState *s, Error *error_in) · line 3342
Quoted 10 lines
migration/migration.c +1
-6-if (multifd_save_setup () !=0 ) { -migrate_set_state (&s->state,MIGRATION_STATUS_SETUP , -MIGRATION_STATUS_FAILED ); -migrate_fd_cleanup (s); -return ; - } +multifd_save_setup ();qemu_thread_create (&s->thread,"live_migration" , migration_thread, s,QEMU_THREAD_JOINABLE ); s->migration_thread_running = true;Nack.
Quoted 4 lines
Quoted 2 lines
On the compression patches that are on list,
multifd_save_setup()returns -1 if there is a problem when we allocate a zbuff.You mean there are some patches in mail list?
Yeap.
PATCH 2/4 migration/ram.c: use same type in MultiFDPages_t to define offsest
In reply to Wei YangMultiFDPacket_t.offset is allocated to store MultiFDPages_t.offset.
It would be better to use the same type.
--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration/ram.c +1 -1
@@ -607,7 +607,7 @@ typedef struct {uint64_t packet_num;uint64_t unused[4 ];/* Reserved for future use */ char ramblock[256 ]; -uint64_t offset[]; +ram_addr_t offset[]; } __attribute__((packed)) MultiFDPacket_t; typedef struct {
Signature · 1 line
2.19.1
Re: [Qemu-devel] [PATCH 2/4] migration/ram.c: use same type in MultiFDPages_t to define offsest
Quoted 14 lines · Wei Yang
MultiFDPacket_t.offset is allocated to store MultiFDPages_t.offset.
It would be better to use the same type.
Signed-off-by Wei Yang <[email protected]>--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/ram.c +0
-0
migration/ram.c typedef struct { · line 613
Quoted 8 lines
migration/ram.c +1
-1@@ -607,7 +607,7 @@ typedef struct {uint64_t packet_num;uint64_t unused[4 ];/* Reserved for future use */ char ramblock[256 ]; -uint64_t offset[]; +ram_addr_t offset[]; } __attribute__((packed)) MultiFDPacket_t; typedef struct {
This needs a comment, but it is on purpose. We want that the value on the wire to be the same for any architecture. (Migration stream is supposed to be architecture independent). ram_addr_t is architecture dependent.
Later, Juan.
Re: [Qemu-devel] [PATCH 2/4] migration/ram.c: use same type in MultiFDPages_t to define offsest
Quoted 22 lines · Juan Quintela
Quoted 21 lines · Wei Yang
MultiFDPacket_t.offset is allocated to store MultiFDPages_t.offset.
It would be better to use the same type.
Signed-off-by Wei Yang <[email protected]>--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/ram.c +1
-1@@ -607,7 +607,7 @@ typedef struct {uint64_t packet_num;uint64_t unused[4 ];/* Reserved for future use */ char ramblock[256 ]; -uint64_t offset[]; +ram_addr_t offset[]; } __attribute__((packed)) MultiFDPacket_t;
Quoted 7 lines
migration/ram.c typedef struct { · line 613
Quoted 1 line
migration/ram.c +0
-0typedef struct {This needs a comment, but it is on purpose. We want that the value on the wire to be the same for any architecture. (Migration stream is supposed to be architecture independent).
ram_addr_tis architecture dependent.
Sounds reasonable.
Quoted 1 line
Later, Juan.
Signature · 2 lines
Wei Yang Help you, Help me
PATCH 3/4 migration/ram.c: MultiFDSendParams.sem_sync is not really used
In reply to Wei YangBesides init and destroy, MultiFDSendParams.sem_sync is not really used.
--- migration/ram.c | 4 ---- 1 file changed, 4 deletions(-)
migration/ram.c +0 -4
@@ -661,8 +661,6 @@ typedef struct {uint64_t num_packets;/* pages sent through this channel */ uint64_t num_pages; -/* syncs main thread and channels */ -QemuSemaphore sem_sync; } MultiFDSendParams; typedef struct {
@@ -1027,7 +1025,6 @@ void multifd_save_cleanup(void) p->c =NULL ;qemu_mutex_destroy (&p->mutex);qemu_sem_destroy (&p->sem); -qemu_sem_destroy (&p->sem_sync);g_free (p->name); p->name =NULL ;multifd_pages_clear (p->pages);
@@ -1201,7 +1198,6 @@ int multifd_save_setup(void)qemu_mutex_init (&p->mutex);qemu_sem_init (&p->sem,0 ); -qemu_sem_init (&p->sem_sync,0 ); p->quit = false; p->pending_job =0 ; p->id = i;
Signature · 1 line
2.19.1
Re: [Qemu-devel] [PATCH 3/4] migration/ram.c: MultiFDSendParams.sem_sync is not really used
Quoted 3 lines · Wei Yang
Besides init and destroy, MultiFDSendParams.sem_sync is not really used.
Signed-off-by Wei Yang <[email protected]>
I mad SendParamas and RecvParams identical, but they are different. You are right.
Re: [Qemu-devel] [PATCH 3/4] migration/ram.c: MultiFDSendParams.sem_sync is not really used
Quoted 9 lines · Juan Quintela
Quoted 3 lines · Wei Yang
Besides init and destroy, MultiFDSendParams.sem_sync is not really used.
Signed-off-by Wei Yang <[email protected]>Reviewed-by Juan Quintela <[email protected]>I mad SendParamas and RecvParams identical, but they are different. You are right.
Thanks.
BTW, I found some interesting thing about multifd_send_state->channels_ready. By checking the value of this semaphore, it grows far beyond what we really have.
For example, we have default 2 channels which means multifd_send_state->channels_ready's value is no more than 2. But the actual value could go to more than 30.
The behavior sounds not right.
Signature · 2 lines
Wei Yang Help you, Help me
PATCH 4/4 migration/ram.c: multifd_send_state->count is not really used
In reply to Wei Yang--- migration/ram.c | 5 ----- 1 file changed, 5 deletions(-)
migration/ram.c +0 -5
@@ -892,8 +892,6 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp)struct {MultiFDSendParams *params; -/* number of created threads */ -int count;/* array of pages to sent */ MultiFDPages_t *pages;/* syncs main thread and channels */
@@ -1171,8 +1169,6 @@ static void multifd_new_send_channel_async(QIOTask *task, gpointer opaque) p->running = true;qemu_thread_create (&p->thread, p->name, multifd_send_thread, p,QEMU_THREAD_JOINABLE ); - -atomic_inc (&multifd_send_state->count); } }
@@ -1188,7 +1184,6 @@ int multifd_save_setup(void) thread_count =migrate_multifd_channels (); multifd_send_state =g_malloc0 (sizeof (*multifd_send_state)); multifd_send_state->params =g_new0 (MultiFDSendParams, thread_count); -atomic_set (&multifd_send_state->count,0 ); multifd_send_state->pages =multifd_pages_init (page_count);qemu_sem_init (&multifd_send_state->sem_sync,0 );qemu_sem_init (&multifd_send_state->channels_ready,0 );
Signature · 1 line
2.19.1
Re: [Qemu-devel] [PATCH 4/4] migration/ram.c: multifd_send_state->count is not really used
Quoted 1 line · Wei Yang
Signed-off-by Wei Yang <[email protected]>
Once upon a time, we checked how many threads were created to recover for errors, but this was wrong because one of the "missing" threads could be one different from the last one.
Thanks, Juan.
Hi, David
Do you prefer I resend 3/4 or it is ok for you to pick up here directly?
Quoted 14 lines · Wei Yang
Just found several small places for unused variables.
Wei Yang (4):
migration:multifd_save_setupalways return 0migration/ram.c: use same type inMultiFDPages_tto define offsestmigration/ram.c: MultiFDSendParams.sem_sync is not really usedmigration/ram.c:multifd_send_state->countis not really used
migration/migration.c| 7 +------migration/ram.c| 11 +----------2 files changed, 2 insertions(+), 16 deletions(-)Signature · 1 line
2.19.1
Signature · 2 lines
Wei Yang Help you, Help me