All of lore.kernel.org
 help / color / mirror / Atom feed
From: "lizhijian@fujitsu.com" <lizhijian@fujitsu.com>
To: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	"lizhijian@fujitsu.com" <lizhijian@fujitsu.com>
Cc: qemu devel list <qemu-devel@nongnu.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH 2/2] migration/rdma: advise prefetch write for ODP region
Date: Mon, 23 Aug 2021 01:21:04 +0000	[thread overview]
Message-ID: <f5ba3794-a87e-e456-84b9-8211fe6a5e85@fujitsu.com> (raw)
In-Reply-To: <CAC_L=vUXYjyZ6qwg6LoStSVg0sBbZtS_wO9FRLa0Dp4b_rYobA@mail.gmail.com>

Hi Marcel


On 22/08/2021 16:39, Marcel Apfelbaum wrote:
> Hi,
>
> On Sat, Jul 31, 2021 at 5:03 PM Li Zhijian <lizhijian@cn.fujitsu.com> wrote:
>> The responder mr registering with ODP will sent RNR NAK back to
>> the requester in the face of the page fault.
>> ---------
>> ibv_poll_cq wc.status=13 RNR retry counter exceeded!
>> ibv_poll_cq wrid=WRITE RDMA!
>> ---------
>> ibv_advise_mr(3) helps to make pages present before the actual IO is
>> conducted so that the responder does page fault as little as possible.
>>
>> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
>> ---
>>   migration/rdma.c       | 40 ++++++++++++++++++++++++++++++++++++++++
>>   migration/trace-events |  1 +
>>   2 files changed, 41 insertions(+)
>>
>> diff --git a/migration/rdma.c b/migration/rdma.c
>> index 8784b5f22a6..a2ad00d665f 100644
>> --- a/migration/rdma.c
>> +++ b/migration/rdma.c
>> @@ -1117,6 +1117,30 @@ static int qemu_rdma_alloc_qp(RDMAContext *rdma)
>>       return 0;
>>   }
>>
>> +/*
>> + * ibv_advise_mr to avoid RNR NAK error as far as possible.
>> + * The responder mr registering with ODP will sent RNR NAK back to
>> + * the requester in the face of the page fault.
>> + */
>> +static void qemu_rdma_advise_prefetch_write_mr(struct ibv_pd *pd, uint64_t addr,
>> +                                               uint32_t len,  uint32_t lkey,
>> +                                               const char *name, bool wr)
>> +{
>> +    int ret;
>> +    int advice = wr ? IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE :
>> +                 IBV_ADVISE_MR_ADVICE_PREFETCH;
>> +    struct ibv_sge sg_list = {.lkey = lkey, .addr = addr, .length = len};
>> +
>> +    ret = ibv_advise_mr(pd, advice,
>> +                        IB_UVERBS_ADVISE_MR_FLAG_FLUSH, &sg_list, 1);
>> +    /* ignore the error */
> Following https://github.com/linux-rdma/rdma-core/blob/master/libibverbs/man/ibv_advise_mr.3.md
> it looks like it is a best-effort optimization,
> I don't see any down-sides to it.
> However it seems like it is recommended to use
> IBV_ADVISE_MR_FLAG_FLUSH in order to
> increase the optimization chances.
Good catch,  i will update it soon.


Thanks

>
> Anyway
>
> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>
> Thanks,
> Marcel
>
>

  reply	other threads:[~2021-08-23  1:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-31 14:03 [PATCH 0/2] enable fsdax rdma migration Li Zhijian
2021-07-31 14:03 ` [PATCH 1/2] migration/rdma: Try to register On-Demand Paging memory region Li Zhijian
2021-08-22  8:53   ` Marcel Apfelbaum
2021-08-23  1:41     ` lizhijian
2021-08-23  7:03       ` Marcel Apfelbaum
2021-07-31 14:03 ` [PATCH 2/2] migration/rdma: advise prefetch write for ODP region Li Zhijian
2021-08-22  8:39   ` Marcel Apfelbaum
2021-08-23  1:21     ` lizhijian [this message]
2021-08-16  2:10 ` [PATCH 0/2] enable fsdax rdma migration lizhijian

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=f5ba3794-a87e-e456-84b9-8211fe6a5e85@fujitsu.com \
    --to=lizhijian@fujitsu.com \
    --cc=dgilbert@redhat.com \
    --cc=marcel.apfelbaum@gmail.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.