All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yanjun Zhu <yanjun.zhu@linux.dev>
To: "Saleem, Shiraz" <shiraz.saleem@intel.com>,
	"Zhu, Yanjun" <yanjun.zhu@intel.com>,
	"Ismail, Mustafa" <mustafa.ismail@intel.com>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>,
	"leon@kernel.org" <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: Re: [PATCHv2 1/1] RDMA/irdma: Add support for dmabuf pin memory regions
Date: Wed, 4 Jan 2023 21:18:27 +0800	[thread overview]
Message-ID: <ea2a9e6c-e046-fbde-d834-1417f1113403@linux.dev> (raw)
In-Reply-To: <MWHPR11MB0029214136E67C609CA87C61E9F59@MWHPR11MB0029.namprd11.prod.outlook.com>


在 2023/1/4 8:21, Saleem, Shiraz 写道:
>> Subject: RE: [PATCHv2 1/1] RDMA/irdma: Add support for dmabuf pin memory
>> regions
>>
> [......]
>
>>> +
>>> +	switch (req.reg_type) {
>>> +	case IRDMA_MEMREG_TYPE_QP:
>>> +		total = req.sq_pages + req.rq_pages + shadow_pgcnt;
>>> +		if (total > iwmr->page_cnt) {
>>> +			err = -EINVAL;
>>> +			goto error;
>>> +		}
>>> +		total = req.sq_pages + req.rq_pages;
>>> +		use_pbles = (total > 2);
>>> +		err = irdma_handle_q_mem(iwdev, &req, iwpbl, use_pbles);
>>> +		if (err)
>>> +			goto error;
>>> +
>>> +		ucontext = rdma_udata_to_drv_context(udata, struct
>>> irdma_ucontext,
>>> +						     ibucontext);
>>> +		spin_lock_irqsave(&ucontext->qp_reg_mem_list_lock, flags);
>>> +		list_add_tail(&iwpbl->list, &ucontext->qp_reg_mem_list);
>>> +		iwpbl->on_list = true;
>>> +		spin_unlock_irqrestore(&ucontext->qp_reg_mem_list_lock, flags);
>>> +		break;
>>> +	case IRDMA_MEMREG_TYPE_CQ:
>>> +		if (iwdev->rf->sc_dev.hw_attrs.uk_attrs.feature_flags &
>>> IRDMA_FEATURE_CQ_RESIZE)
>>> +			shadow_pgcnt = 0;
>>> +		total = req.cq_pages + shadow_pgcnt;
>>> +		if (total > iwmr->page_cnt) {
>>> +			err = -EINVAL;
>>> +			goto error;
>>> +		}
>>> +
>>> +		use_pbles = (req.cq_pages > 1);
>>> +		err = irdma_handle_q_mem(iwdev, &req, iwpbl, use_pbles);
>>> +		if (err)
>>> +			goto error;
>>> +
>>> +		ucontext = rdma_udata_to_drv_context(udata, struct
>>> irdma_ucontext,
>>> +						     ibucontext);
>>> +		spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags);
>>> +		list_add_tail(&iwpbl->list, &ucontext->cq_reg_mem_list);
>>> +		iwpbl->on_list = true;
>>> +		spin_unlock_irqrestore(&ucontext->cq_reg_mem_list_lock, flags);
>>> +		break;
>> I don't think we want to do this for user QP, CQ pinned memory. In fact, it will just
>> be dead-code.
>>
>> The irdma provider implementation of the ibv_reg_dmabuf_mr will just default to
>> IRDMA_MEMREG_TYPE_MEM type similar to how irdma_ureg_mr is implemented.
>>
>> https://github.com/linux-rdma/rdma-
>> core/blob/master/providers/irdma/uverbs.c#L128
>>
>> It should simplify this function a lot.
>>
>>
> Actually I don't see a need even to use the irdma_mem_reg_req ABI struct to pass any info from user-space like reg_type.

In the latest commit, the irdma_mem_reg_req ABI struct is removed.

I will send out it very soon.

Zhu Yanjun

>
> Shiraz
>

  reply	other threads:[~2023-01-04 13:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03  6:08 [PATCHv2 1/1] RDMA/irdma: Add support for dmabuf pin memory regions Zhu Yanjun
2023-01-03 23:35 ` Saleem, Shiraz
2023-01-04  0:21   ` Saleem, Shiraz
2023-01-04 13:18     ` Yanjun Zhu [this message]
2023-01-04 12:59   ` Yanjun Zhu
2023-01-04 13:08   ` Yanjun Zhu

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=ea2a9e6c-e046-fbde-d834-1417f1113403@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mustafa.ismail@intel.com \
    --cc=shiraz.saleem@intel.com \
    --cc=yanjun.zhu@intel.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.