All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Lidong Chen <jemmy858585@gmail.com>
Cc: quintela@redhat.com, qemu-devel@nongnu.org, galsha@mellanox.com,
	aviadye@mellanox.com, adido@mellanox.com,
	Lidong Chen <lidongchen@tencent.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] migration: update index field when delete or qsort RDMALocalBlock
Date: Tue, 8 May 2018 18:19:42 +0100	[thread overview]
Message-ID: <20180508171942.GS2500@work-vm> (raw)
In-Reply-To: <1525618499-1560-1-git-send-email-lidongchen@tencent.com>

* Lidong Chen (jemmy858585@gmail.com) wrote:
> rdma_delete_block function deletes RDMALocalBlock base on index field,
> but not update the index field. So when next time invoke rdma_delete_block,
> it will not work correctly.
> 
> If start and cancel migration repeatedly, some RDMALocalBlock not invoke
> ibv_dereg_mr to decrease kernel mm_struct vmpin. When vmpin is large than
> max locked memory limitation, ibv_reg_mr will failed, and migration can not
> start successfully again.
> 
> Signed-off-by: Lidong Chen <lidongchen@tencent.com>
> ---
>  migration/rdma.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/migration/rdma.c b/migration/rdma.c
> index ed9cfb1..0dd4033 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -713,6 +713,9 @@ static int rdma_delete_block(RDMAContext *rdma, RDMALocalBlock *block)
>              memcpy(local->block + block->index, old + (block->index + 1),
>                  sizeof(RDMALocalBlock) *
>                      (local->nb_blocks - (block->index + 1)));
> +            for (x = block->index; x < local->nb_blocks - 1; x++) {
> +                local->block[x].index--;
> +            }

Yes; is that equivalent to   local->blocks[x].index = x;   ?

>          }
>      } else {
>          assert(block == local->block);
> @@ -3398,6 +3401,10 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
>              qsort(rdma->local_ram_blocks.block,
>                    rdma->local_ram_blocks.nb_blocks,
>                    sizeof(RDMALocalBlock), dest_ram_sort_func);
> +            for (i = 0; i < local->nb_blocks; i++) {
> +                local->block[i].index = i;
> +            }
> +

Which is basically the way that one does it;

OK, it's a while since I looked at this but I think it fixes my 3 year
old 03fcab38617 patch, so



Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

>              if (rdma->pin_all) {
>                  ret = qemu_rdma_reg_whole_ram_blocks(rdma);
>                  if (ret) {
> -- 
> 1.8.3.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  parent reply	other threads:[~2018-05-08 17:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-06 14:54 [Qemu-devel] [PATCH 1/2] migration: update index field when delete or qsort RDMALocalBlock Lidong Chen
2018-05-06 14:54 ` [Qemu-devel] [PATCH 2/2] migration: not wait RDMA_CM_EVENT_DISCONNECTED event after rdma_disconnect Lidong Chen
2018-05-08 18:40   ` Dr. David Alan Gilbert
2018-05-09  3:43     ` 858585 jemmy
2018-05-11 18:03       ` Dr. David Alan Gilbert
2018-05-14  7:32         ` 858585 jemmy
2018-05-14 19:27           ` Dr. David Alan Gilbert
2018-05-16  8:31             ` 858585 jemmy
2018-05-16  9:39               ` Dr. David Alan Gilbert
2018-05-16  9:45                 ` 858585 jemmy
2018-05-16  9:53                   ` Dr. David Alan Gilbert
2018-05-16 12:48                     ` 858585 jemmy
2018-05-16 13:13                       ` Dr. David Alan Gilbert
     [not found]                         ` <AM6PR05MB4360C1A885C2B052583F47C7C2920@AM6PR05MB4360.eurprd05.prod.outlook.com>
     [not found]                           ` <be4b48b2-22b3-9a69-92ed-dbc9ae59b4e6@dev.mellanox.co.il>
     [not found]                             ` <CAOGPPbenO1P9VbdpDVD5_SNJeoF4eHxkLg=rF7LM9HpbyoR0uw@mail.gmail.com>
2018-05-17  7:31                               ` [Qemu-devel] FW: " Aviad Yehezkel
2018-05-17  7:41                                 ` 858585 jemmy
2018-05-17  7:46                                   ` Aviad Yehezkel
2018-05-22 10:12                         ` [Qemu-devel] " 858585 jemmy
2018-05-08 17:19 ` Dr. David Alan Gilbert [this message]
2018-05-09  1:39   ` [Qemu-devel] [PATCH 1/2] migration: update index field when delete or qsort RDMALocalBlock 858585 jemmy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180508171942.GS2500@work-vm \
    --to=dgilbert@redhat.com \
    --cc=adido@mellanox.com \
    --cc=aviadye@mellanox.com \
    --cc=galsha@mellanox.com \
    --cc=jemmy858585@gmail.com \
    --cc=lidongchen@tencent.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.