rdma fixes and clean ups
PATCH 3/3 rdma: use RDMA_WRID_READY
In reply to Isaku Yamahata--- migration-rdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
migration-rdma.c +2 -2
@@ -2221,7 +2221,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)rdma_ack_cm_event (cm_event); - ret =qemu_rdma_post_recv_control (rdma,0 ); + ret =qemu_rdma_post_recv_control (rdma,RDMA_WRID_READY );if (ret) {ERROR (errp,"posting second control recv!\n" ); goto err_rdma_source_connect;
@@ -2726,7 +2726,7 @@ static int qemu_rdma_accept(RDMAContext *rdma)rdma_ack_cm_event (cm_event); - ret =qemu_rdma_post_recv_control (rdma,0 ); + ret =qemu_rdma_post_recv_control (rdma,RDMA_WRID_READY );if (ret) {fprintf (stderr,"rdma migration: error posting second control recv!\n" ); goto err_rdma_dest_wait;
Signature · 1 line
1.7.10.4
PATCH 1/3 rdma: don't use negative index to array
In reply to Isaku Yamahata--- migration-rdma.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
migration-rdma.c +15 -12
@@ -1931,10 +1931,21 @@ static int qemu_rdma_write_flush(QEMUFile *f, RDMAContext *rdma)static inline int qemu_rdma_buffer_mergable (RDMAContext *rdma,uint64_t offset,uint64_t len) { -RDMALocalBlock *block = - &(rdma->local_ram_blocks.block[rdma->current_index]); -uint8_t *host_addr = block->local_host_addr + (offset - block->offset); -uint8_t *chunk_end =ram_chunk_end (block, rdma->current_chunk); +RDMALocalBlock *block; +uint8_t *host_addr; +uint8_t *chunk_end; + +if (rdma->current_index <0 ) { +return 0 ; + } + +if (rdma->current_chunk <0 ) { +return 0 ; + } + + block = &(rdma->local_ram_blocks.block[rdma->current_index]); + host_addr = block->local_host_addr + (offset - block->offset); + chunk_end =ram_chunk_end (block, rdma->current_chunk);if (rdma->current_length ==0 ) {return 0 ;
@@ -1947,10 +1958,6 @@ static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,return 0 ; } -if (rdma->current_index <0 ) { -return 0 ; - } -if (offset < block->offset) {return 0 ; }
@@ -1959,10 +1966,6 @@ static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,return 0 ; } -if (rdma->current_chunk <0 ) { -return 0 ; - } -if ((host_addr + len) > chunk_end) {return 0 ; }
Signature · 1 line
1.7.10.4
PATCH 2/3 rdma: qemu_rdma_post_send_control uses wrongly RDMA_WRID_MAX
In reply to Isaku YamahataRDMA_WRID_CONTROL should be used. And remove related work around.
--- migration-rdma.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
migration-rdma.c +6 -6
@@ -322,7 +322,7 @@ typedef struct RDMAContext {char *host;int port; -RDMAWorkRequestData wr_data[RDMA_WRID_MAX +1 ]; +RDMAWorkRequestData wr_data[RDMA_WRID_MAX ];/* * This is used by *_exchange_send() to figure out whether or not
@@ -1397,7 +1397,7 @@ static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf, RDMAControlHeader *head) {int ret =0 ; -RDMAWorkRequestData *wr = &rdma->wr_data[RDMA_WRID_MAX ]; +RDMAWorkRequestData *wr = &rdma->wr_data[RDMA_WRID_CONTROL ];struct ibv_send_wr *bad_wr;struct ibv_sge sge = { .addr = (uint64_t )(wr->control),
@@ -2052,7 +2052,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)g_free (rdma->block); rdma->block =NULL ; -for (idx =0 ; idx <=RDMA_WRID_MAX ; idx++) { +for (idx =0 ; idx <RDMA_WRID_MAX ; idx++) {if (rdma->wr_data[idx].control_mr) { rdma->total_registrations--;ibv_dereg_mr (rdma->wr_data[idx].control_mr);
@@ -2134,7 +2134,7 @@ static int qemu_rdma_source_init(RDMAContext *rdma, Error **errp, bool pin_all) goto err_rdma_source_init; } -for (idx =0 ; idx <=RDMA_WRID_MAX ; idx++) { +for (idx =0 ; idx <RDMA_WRID_MAX ; idx++) { ret =qemu_rdma_reg_control (rdma, idx);if (ret) { ERROR(temp, "rdma migration: error registering %d control!\n",
@@ -2243,7 +2243,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)struct rdma_cm_id *listen_id;char ip[40 ] ="unknown" ; -for (idx =0 ; idx <=RDMA_WRID_MAX ; idx++) { +for (idx =0 ; idx <RDMA_WRID_MAX ; idx++) { rdma->wr_data[idx].control_len =0 ; rdma->wr_data[idx].control_curr =NULL ; }
@@ -2696,7 +2696,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) goto err_rdma_dest_wait; } -for (idx =0 ; idx <=RDMA_WRID_MAX ; idx++) { +for (idx =0 ; idx <RDMA_WRID_MAX ; idx++) { ret =qemu_rdma_reg_control (rdma, idx);if (ret) {fprintf (stderr,"rdma: error registering %d control!\n" , idx);
Signature · 1 line
1.7.10.4
cover rdma fixes and clean ups
Small fixes/clean up to rdma. found through code review.
Isaku Yamahata (3):
rdma: don't use negative index to array
rdma: qemu_rdma_post_send_control uses wrongly RDMA_WRID_MAX
rdma: use RDMA_WRID_READY
migration-rdma.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-)
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 1/3] rdma: don't use negative index to array
In reply to Isaku YamahataQuoted 48 lines · Isaku Yamahata
Cc Michael R. Hines <[email protected]>Signed-off-by Isaku Yamahata <[email protected]>--- migration-rdma.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)migration-rdma.c +15
-8@@ -1931,10 +1931,21 @@ static int qemu_rdma_write_flush(QEMUFile *f, RDMAContext *rdma)static inline int qemu_rdma_buffer_mergable (RDMAContext *rdma,uint64_t offset,uint64_t len) { -RDMALocalBlock *block = - &(rdma->local_ram_blocks.block[rdma->current_index]); -uint8_t *host_addr = block->local_host_addr + (offset - block->offset); -uint8_t *chunk_end =ram_chunk_end (block, rdma->current_chunk); +RDMALocalBlock *block; +uint8_t *host_addr; +uint8_t *chunk_end; + +if (rdma->current_index <0 ) { +return 0 ; + } + +if (rdma->current_chunk <0 ) { +return 0 ; + } + + block = &(rdma->local_ram_blocks.block[rdma->current_index]); + host_addr = block->local_host_addr + (offset - block->offset); + chunk_end =ram_chunk_end (block, rdma->current_chunk);if (rdma->current_length ==0 ) {return 0 ;@@ -1947,10 +1958,6 @@ static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,return 0 ; } -if (rdma->current_index <0 ) { -return 0 ; - } -if (offset < block->offset) {return 0 ; }
migration-rdma.c static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma, · line 1971
Quoted 10 lines
migration-rdma.c +0
-4@@ -1959,10 +1966,6 @@ static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,return 0 ; } -if (rdma->current_chunk <0 ) { -return 0 ; - } -if ((host_addr + len) > chunk_end) {return 0 ; }
Re: [Qemu-devel] [PATCH 3/3] rdma: use RDMA_WRID_READY
In reply to Isaku YamahataQuoted 20 lines · Isaku Yamahata
Cc Michael R. Hines <[email protected]>Signed-off-by Isaku Yamahata <[email protected]>--- migration-rdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)migration-rdma.c +1
-1@@ -2221,7 +2221,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)rdma_ack_cm_event (cm_event); - ret =qemu_rdma_post_recv_control (rdma,0 ); + ret =qemu_rdma_post_recv_control (rdma,RDMA_WRID_READY );if (ret) {ERROR (errp,"posting second control recv!\n" ); goto err_rdma_source_connect;
migration-rdma.c static int qemu_rdma_accept(RDMAContext *rdma) · line 2732
Quoted 8 lines
migration-rdma.c +1
-1@@ -2726,7 +2726,7 @@ static int qemu_rdma_accept(RDMAContext *rdma)rdma_ack_cm_event (cm_event); - ret =qemu_rdma_post_recv_control (rdma,0 ); + ret =qemu_rdma_post_recv_control (rdma,RDMA_WRID_READY );if (ret) {fprintf (stderr,"rdma migration: error posting second control recv!\n" ); goto err_rdma_dest_wait;
Good catch too.
Re: [Qemu-devel] [PATCH 2/3] rdma: qemu_rdma_post_send_control uses wrongly RDMA_WRID_MAX
In reply to Isaku YamahataQuoted 58 lines · Isaku Yamahata
RDMA_WRID_CONTROLshould be used. And remove related work around.Cc Michael R. Hines <[email protected]>Signed-off-by Isaku Yamahata <[email protected]>--- migration-rdma.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)migration-rdma.c +5
-5@@ -322,7 +322,7 @@ typedef struct RDMAContext {char *host;int port; -RDMAWorkRequestData wr_data[RDMA_WRID_MAX +1 ]; +RDMAWorkRequestData wr_data[RDMA_WRID_MAX ];/* * This is used by *_exchange_send() to figure out whether or not @@ -1397,7 +1397,7 @@ static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf, RDMAControlHeader *head) {int ret =0 ; -RDMAWorkRequestData *wr = &rdma->wr_data[RDMA_WRID_MAX ]; +RDMAWorkRequestData *wr = &rdma->wr_data[RDMA_WRID_CONTROL ];struct ibv_send_wr *bad_wr;struct ibv_sge sge = { .addr = (uint64_t )(wr->control),@@ -2052,7 +2052,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)g_free (rdma->block); rdma->block =NULL ; -for (idx =0 ; idx <=RDMA_WRID_MAX ; idx++) { +for (idx =0 ; idx <RDMA_WRID_MAX ; idx++) {if (rdma->wr_data[idx].control_mr) { rdma->total_registrations--;ibv_dereg_mr (rdma->wr_data[idx].control_mr);@@ -2134,7 +2134,7 @@ static int qemu_rdma_source_init(RDMAContext *rdma, Error **errp, bool pin_all) goto err_rdma_source_init; } -for (idx =0 ; idx <=RDMA_WRID_MAX ; idx++) { +for (idx =0 ; idx <RDMA_WRID_MAX ; idx++) { ret =qemu_rdma_reg_control (rdma, idx);if (ret) { ERROR(temp, "rdma migration: error registering %d control!\n",@@ -2243,7 +2243,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)struct rdma_cm_id *listen_id;char ip[40 ] ="unknown" ; -for (idx =0 ; idx <=RDMA_WRID_MAX ; idx++) { +for (idx =0 ; idx <RDMA_WRID_MAX ; idx++) { rdma->wr_data[idx].control_len =0 ; rdma->wr_data[idx].control_curr =NULL ; }
migration-rdma.c static int qemu_rdma_accept(RDMAContext *rdma) · line 2702
Quoted 8 lines
migration-rdma.c +1
-1@@ -2696,7 +2696,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) goto err_rdma_dest_wait; } -for (idx =0 ; idx <=RDMA_WRID_MAX ; idx++) { +for (idx =0 ; idx <RDMA_WRID_MAX ; idx++) { ret =qemu_rdma_reg_control (rdma, idx);if (ret) {fprintf (stderr,"rdma: error registering %d control!\n" , idx);
Good eyes ...... I totally missed that =)
Quoted 10 lines · Isaku Yamahata
Small fixes/clean up to rdma. found through code review.
Isaku Yamahata (3):
rdma: don't use negative index to array
rdma:qemu_rdma_post_send_controluses wronglyRDMA_WRID_MAX
rdma: useRDMA_WRID_READYmigration-rdma.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-)
Would you like me to apply this series to my tree and re-send our bugfixes together to the maintainer for 1.6?
- Michael
Quoted 8 lines · Michael R. Hines
Quoted 7 lines · Isaku Yamahata
Small fixes/clean up to rdma. found through code review.
Isaku Yamahata (3):
rdma: don't use negative index to array
rdma:qemu_rdma_post_send_controluses wronglyRDMA_WRID_MAX
rdma: useRDMA_WRID_READY
Quoted 6 lines
Quoted 3 lines
migration-rdma.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-)Would you like me to apply this series to my tree and re-send our bugfixes together to the maintainer for 1.6?
Yes. With another patch I sent just a moment ago.
Quoted 11 lines · Isaku Yamahata
Quoted 8 lines · Michael R. Hines
Quoted 7 lines · Isaku Yamahata
Small fixes/clean up to rdma. found through code review.
Isaku Yamahata (3):
rdma: don't use negative index to array
rdma:qemu_rdma_post_send_controluses wronglyRDMA_WRID_MAX
rdma: useRDMA_WRID_READY
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
migration-rdma.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-)Would you like me to apply this series to my tree and re-send our bugfixes together to the maintainer for 1.6?
Yes. With another patch I sent just a moment ago.
Thank you - just sent a unified "For-1.6" patch for both of us.
- Michael
Anthony Liguori
AppliedApplied. Thanks.
Regards,
Anthony Liguori