Migration RDMA cleanup
cover Migration RDMA cleanup
Hi
This is the part of the series in QEMUFileHook removal that are just RDMA cleanup.
Please, review.
Based on my previous series of qemu-file cleanups.
Subject: [PATCH 0/9] QEMU file cleanups
Based-on: Message-Id: <[email protected]>
Juan Quintela (5):
migration: Make RAM_SAVE_FLAG_HOOK a normal case entry migration/rdma: simplify ram_control_load_hook() migration/rdma: We can calculate the rioc from the QEMUFile migration/rdma: It makes no sense to recive that flag without RDMA migration/rdma: Check for postcopy sooner
migration/qemu-file.c | 12 +----------- migration/ram.c | 12 +++++------- migration/rdma.c | 40 ++++++++++++++++++++-------------------- 3 files changed, 26 insertions(+), 38 deletions(-)
Signature · 1 line
2.40.0
PATCH 1/5 migration: Make RAM_SAVE_FLAG_HOOK a normal case entry
Fixes this commit, clearly a bad merge after a rebase or similar, it should have been its own case since that point.
commit 5b0e9dd46fbda5152566a4a26fd96bc0d0452bf7
Author: Peter Lieven <[email protected]> Date: Tue Jun 24 11:32:36 2014 +0200
migration: catch unknown flag combinations in ram_load
--- migration/ram.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
migration/ram.c +5 -7
@@ -4445,14 +4445,12 @@ static int ram_load_precopy(QEMUFile *f)multifd_recv_sync_main (); }break ; +case RAM_SAVE_FLAG_HOOK : +ram_control_load_hook (f,RAM_CONTROL_HOOK ,NULL ); +break ;default : -if (flags &RAM_SAVE_FLAG_HOOK ) { -ram_control_load_hook (f,RAM_CONTROL_HOOK ,NULL ); - }else { -error_report ("Unknown combination of migration flags: 0x%x" , - flags); - ret = -EINVAL ; - } +error_report ("Unknown combination of migration flags: 0x%x" , flags); + ret = -EINVAL ; }if (!ret) { ret =qemu_file_get_error (f);
Signature · 1 line
2.40.0
Re: [PATCH 1/5] migration: Make RAM_SAVE_FLAG_HOOK a normal case entry
Quoted 7 lines · Juan Quintela
Fixes this commit, clearly a bad merge after a rebase or similar, it should have been its own case since that point.
commit
5b0e9dd46fbda5152566a4a26fd96bc0d0452bf7Author: Peter Lieven <[email protected]> Date: Tue Jun 24 11:32:36 2014 +0200
Quoted 6 lines
migration: catch unknown flag combinations in
ram_loadSigned-off-by Juan Quintela <[email protected]>--- migration/ram.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
Quoted 6 lines
migration/ram.c +0
-0
migration/ram.c static int ram_load_precopy(QEMUFile *f) · line 4450
Quoted 9 lines
migration/ram.c +3
-2@@ -4445,14 +4445,12 @@ static int ram_load_precopy(QEMUFile *f)multifd_recv_sync_main (); }break ; +case RAM_SAVE_FLAG_HOOK : +ram_control_load_hook (f,RAM_CONTROL_HOOK ,NULL ); +break ;default : -if (flags &RAM_SAVE_FLAG_HOOK ) { -ram_control_load_hook (f,RAM_CONTROL_HOOK ,NULL );
The only use of this flag is
rdma.c: qemu_put_be64(f, RAM_SAVE_FLAG_HOOK);
so its is impossible for 'flags' to have other bits set when we see RAM_SAVE_FLAG_HOOK, so although this change is not semantically equivalent in the general case, it is equivalent given our current usage.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH 1/5] migration: Make RAM_SAVE_FLAG_HOOK a normal case entry
In reply to Juan QuintelaQuoted 10 lines · Juan Quintela
Fixes this commit, clearly a bad merge after a rebase or similar, it should have been its own case since that point.
commit
5b0e9dd46fbda5152566a4a26fd96bc0d0452bf7Author: Peter Lieven <[email protected]> Date: Tue Jun 24 11:32:36 2014 +0200migration: catch unknown flag combinations in
ram_loadSigned-off-by Juan Quintela <[email protected]>
Signature · 1 line
Peter Xu
PATCH 2/5 migration/rdma: simplify ram_control_load_hook()
In reply to Juan Quintela--- migration/qemu-file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
migration/qemu-file.c +2 -4
@@ -338,10 +338,8 @@ void ram_control_after_iterate(QEMUFile *f, uint64_t flags)void ram_control_load_hook (QEMUFile *f,uint64_t flags,void *data) { -int ret = -EINVAL ; -if (f->hooks && f->hooks->hook_ram_load) { - ret = f->hooks->hook_ram_load (f, flags, data); +int ret = f->hooks->hook_ram_load (f, flags, data);if (ret <0 ) {qemu_file_set_error (f, ret); }
@@ -351,7 +349,7 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data)* that expects there to be a hook on the destination. */ if (flags ==RAM_CONTROL_HOOK ) { -qemu_file_set_error (f, ret); +qemu_file_set_error (f, -EINVAL ); } } }
Signature · 1 line
2.40.0
Re: [PATCH 2/5] migration/rdma: simplify ram_control_load_hook()
Quoted 4 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- migration/qemu-file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH 2/5] migration/rdma: simplify ram_control_load_hook()
In reply to Juan QuintelaQuoted 1 line · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>
Signature · 1 line
Peter Xu
PATCH 3/5 migration/rdma: We can calculate the rioc from the QEMUFile
In reply to Juan Quintela--- migration/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
migration/rdma.c +3 -3
@@ -3811,9 +3811,10 @@ out:* the source. */ static int -rdma_block_notification_handle (QIOChannelRDMA *rioc,const char *name) +rdma_block_notification_handle (QEMUFile *f,const char *name) {RDMAContext *rdma; +QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (qemu_file_get_ioc (f));int curr;int found =-1 ;
@@ -3846,10 +3847,9 @@ rdma_block_notification_handle(QIOChannelRDMA *rioc, const char *name)static int rdma_load_hook (QEMUFile *f,uint64_t flags,void *data) { -QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (qemu_file_get_ioc (f));switch (flags) {case RAM_CONTROL_BLOCK_REG : -return rdma_block_notification_handle (rioc, data); +return rdma_block_notification_handle (f, data);case RAM_CONTROL_HOOK :return qemu_rdma_registration_handle (f);
Signature · 1 line
2.40.0
Re: [PATCH 3/5] migration/rdma: We can calculate the rioc from the QEMUFile
Quoted 4 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- migration/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH 3/5] migration/rdma: We can calculate the rioc from the QEMUFile
In reply to Juan QuintelaQuoted 1 line · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>
Signature · 1 line
Peter Xu
PATCH 4/5 migration/rdma: It makes no sense to recive that flag without RDMA
In reply to Juan QuintelaThis could only happen if the source send RAM_SAVE_FLAG_HOOK (i.e. rdma) and destination don't have CONFIG_RDMA.
--- migration/qemu-file.c | 8 -------- 1 file changed, 8 deletions(-)
migration/qemu-file.c +0 -8
@@ -343,14 +343,6 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data)if (ret <0 ) {qemu_file_set_error (f, ret); } - }else { -/* -* Hook is a hook specifically requested by the source sending a flag -* that expects there to be a hook on the destination. -*/ -if (flags ==RAM_CONTROL_HOOK ) { -qemu_file_set_error (f, -EINVAL ); - } } }
Signature · 1 line
2.40.0
Re: [PATCH 4/5] migration/rdma: It makes no sense to recive that flag without RDMA
In $SUBJECT s/recive/receive/
Quoted 1 line · Juan Quintela
This could only happen if the source send
s/send/sent/
Quoted 6 lines
RAM_SAVE_FLAG_HOOK(i.e. rdma) and destination don't haveCONFIG_RDMA.Signed-off-by Juan Quintela <[email protected]>--- migration/qemu-file.c | 8 -------- 1 file changed, 8 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH 4/5] migration/rdma: It makes no sense to recive that flag without RDMA
Quoted 6 lines · Daniel P. Berrangé
In $SUBJECT s/recive/receive/
Quoted 1 line · Juan Quintela
This could only happen if the source send
s/send/sent/
Fixed.
Quoted 8 lines
Quoted 6 lines
RAM_SAVE_FLAG_HOOK(i.e. rdma) and destination don't haveCONFIG_RDMA.Signed-off-by Juan Quintela <[email protected]>--- migration/qemu-file.c | 8 -------- 1 file changed, 8 deletions(-)Reviewed-by Daniel P. Berrangé <[email protected]>
Thanks.
Re: [PATCH 4/5] migration/rdma: It makes no sense to recive that flag without RDMA
In reply to Juan QuintelaQuoted 4 lines · Juan Quintela
This could only happen if the source send
RAM_SAVE_FLAG_HOOK(i.e. rdma) and destination don't haveCONFIG_RDMA.Signed-off-by Juan Quintela <[email protected]>
Bah, first patch to start reading the master code and it's already merged. I'll stop here then... :)
Signature · 1 line
Peter Xu
PATCH 5/5 migration/rdma: Check for postcopy sooner
In reply to Juan QuintelaIt makes no sense first try to see if there is an rdma error and then do nothing on postcopy stage. Change it so we check we are in postcopy before doing anything.
--- migration/rdma.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
migration/rdma.c +17 -17
@@ -3234,19 +3234,19 @@ static size_t qemu_rdma_save_page(QEMUFile *f,RDMAContext *rdma;int ret; -RCU_READ_LOCK_GUARD (); - rdma =qatomic_rcu_read (&rioc->rdmaout); - -if (!rdma) { -return -EIO ; - } - -CHECK_ERROR_STATE (); -if (migration_in_postcopy ()) {return RAM_SAVE_CONTROL_NOT_SUPP ; } +RCU_READ_LOCK_GUARD (); + rdma =qatomic_rcu_read (&rioc->rdmaout); + +if (!rdma) { +return -EIO ; + } + +CHECK_ERROR_STATE (); +qemu_fflush (f);/*
@@ -3866,6 +3866,10 @@ static int qemu_rdma_registration_start(QEMUFile *f,QIOChannelRDMA *rioc =QIO_CHANNEL_RDMA (qemu_file_get_ioc (f));RDMAContext *rdma; +if (migration_in_postcopy ()) { +return 0 ; + } +RCU_READ_LOCK_GUARD (); rdma =qatomic_rcu_read (&rioc->rdmaout);if (!rdma) {
@@ -3874,10 +3878,6 @@ static int qemu_rdma_registration_start(QEMUFile *f,CHECK_ERROR_STATE (); -if (migration_in_postcopy ()) { -return 0 ; - } -trace_qemu_rdma_registration_start (flags);qemu_put_be64 (f,RAM_SAVE_FLAG_HOOK );qemu_fflush (f);
@@ -3897,6 +3897,10 @@ static int qemu_rdma_registration_stop(QEMUFile *f,RDMAControlHeader head = { .len =0 , .repeat =1 };int ret =0 ; +if (migration_in_postcopy ()) { +return 0 ; + } +RCU_READ_LOCK_GUARD (); rdma =qatomic_rcu_read (&rioc->rdmaout);if (!rdma) {
@@ -3905,10 +3909,6 @@ static int qemu_rdma_registration_stop(QEMUFile *f,CHECK_ERROR_STATE (); -if (migration_in_postcopy ()) { -return 0 ; - } -qemu_fflush (f); ret =qemu_rdma_drain_cq (f, rdma);
Signature · 1 line
2.40.0
Re: [PATCH 5/5] migration/rdma: Check for postcopy sooner
Quoted 8 lines · Juan Quintela
It makes no sense first try to see if there is an rdma error and then do nothing on postcopy stage. Change it so we check we are in postcopy before doing anything.
Signed-off-by Juan Quintela <[email protected]>--- migration/rdma.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|