public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: "Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Oren Duer <oren-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH RFC 1/9] IB/core: Introduce indirect and protected memory regions
Date: Sun, 20 Oct 2013 16:05:57 +0300	[thread overview]
Message-ID: <5263D535.3010409@mellanox.com> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A8237388CE2BE0-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>

On 10/18/2013 1:43 AM, Hefty, Sean wrote:
>> This commit introduces verbs for creating memory regions
>> which will allow new types of memory key operations such
>> as indirect memory registration and protected memory
>> registration.
>>
>> Indirect memory registration is registering several (one
>> of more) pre-registered memory regions in a specific layout.
>> The Indirect region may potentialy describe several regions
>> and some repitition format between them.
> I didn't follow this direct versus indirect difference.  See below.
>   

Hey Sean, thanks for looking into this!

Indirect memory registration feature will be submitted in the future. 
Signature feature is using it "under the hood".
I'll remove it from v2 as it creates a source of confusion and I want to 
concentrate on signature.

Now since you opened this door, briefly,
unlike direct (known) MRs which are associated with a page-list, 
indirect MRs can be associated with other MRs in the form of a list of 
tuples {lkey, addr, len} providing more flexible memory registrations.

>> +struct ib_mr *ib_create_mr(struct ib_pd *pd,
>> +			   struct ib_mr_init_attr *mr_init_attr)
>> +{
>> +	struct ib_mr *mr;
>> +
>> +	if (!pd->device->create_mr)
>> +		return ERR_PTR(-ENOSYS);
>> +
>> +	mr = pd->device->create_mr(pd, mr_init_attr);
>> +
>> +	if (!IS_ERR(mr)) {
>> +		mr->device  = pd->device;
>> +		mr->pd      = pd;
>> +		mr->uobject = NULL;
>> +		atomic_inc(&pd->usecnt);
>> +		atomic_set(&mr->usecnt, 0);
>> +	}
>> +
>> +	return mr;
>> +}
>> +EXPORT_SYMBOL(ib_create_mr);
>> +
>> +int ib_destroy_mr(struct ib_mr *mr)
>> +{
>> +	struct ib_pd *pd;
>> +	int ret;
>> +
>> +	if (atomic_read(&mr->usecnt))
>> +		return -EBUSY;
>> +
>> +	pd = mr->pd;
>> +	ret = mr->device->destroy_mr(mr);
>> +	if (!ret)
>> +		atomic_dec(&pd->usecnt);
>> +
>> +	return ret;
>> +}
>> +EXPORT_SYMBOL(ib_destroy_mr);
>> +
>>   struct ib_mr *ib_alloc_fast_reg_mr(struct ib_pd *pd, int
>> max_page_list_len)
>>   {
>>   	struct ib_mr *mr;
>> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
>> index 645c3ce..65b7e79 100644
>> --- a/include/rdma/ib_verbs.h
>> +++ b/include/rdma/ib_verbs.h
>> @@ -925,6 +925,30 @@ enum ib_mr_rereg_flags {
>>   	IB_MR_REREG_ACCESS	= (1<<2)
>>   };
>>
>> +enum ib_mr_create_flags {
>> +		IB_MR_SIGNATURE_EN = 1,
>> +};
>> +
>> +enum ib_mr_reg_type {
>> +	IB_MR_REG_DIRECT,
>> +	IB_MR_REG_INDIRECT,
>> +};
>> +
>> +/**
>> + * ib_mr_init_attr - Memory region init attributes passed to routine
>> + *	ib_create_mr.
>> + * @reg_type: requested mapping type, this can be direct/indirect
>> + *   registration or repetitive structure registration.
>> + * @max_reg_descriptors: max number of registration units that
>> + *   may be used with UMR work requests.
>> + * @flags: MR creation flags bit mask.
>> + */
>> +struct ib_mr_init_attr {
>> +	enum ib_mr_reg_type	reg_type;
>> +	int			max_reg_descriptors;
>> +	enum ib_mr_create_flags	flags;
>> +};
>> +
>>   /**
>>    * struct ib_mw_bind - Parameters for a type 1 memory window bind
>> operation.
>>    * @wr_id:      Work request id.
>> @@ -1257,6 +1281,9 @@ struct ib_device {
>>   	int                        (*query_mr)(struct ib_mr *mr,
>>   					       struct ib_mr_attr *mr_attr);
>>   	int                        (*dereg_mr)(struct ib_mr *mr);
>> +	int                        (*destroy_mr)(struct ib_mr *mr);
>> +	struct ib_mr *		   (*create_mr)(struct ib_pd *pd,
>> +						struct ib_mr_init_attr *mr_init_attr);
> These create and destroy something called an 'MR', but are not actually associated with any memory buffers.  Is this some sort of conceptual sub-protection domain?  Why is this needed, versus defining new ib_mr_attr fields?

This MR can be perceived as a generalization of fast_reg MR. When using 
fast memory registration the verbs user will call ib_alloc_fast_reg_mr() 
in order to allocate an MR that may be used for fast registration method 
by posting
a fast registration work-request on the send-queue (FRWR). The user does 
not pass any memory buffers to ib_alloc_fast_reg_mr() as the actual 
registration is done via posting WR. This follows the same notation, but 
allows new functionality (such as signature enable).

As things are today, No MR creation method (fast_reg, dma, phys, 
user...) allows passing initialization parameters. signature feature 
requires some internal resources management, and we need some kind of 
indication that signature is requested for this MR. I'm suggesting that 
this verb will cover the general case and later on, it is possible to 
extend this method to cover all existing flavors of MR creation 
(implement the existing ones with it).

Do you agree? or do you prefer to extend other MR allocation methods to 
receive initialization parameters?

> - Sean

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-10-20 13:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15 15:38 [PATCH RFC 0/9] Introduce Signature feature Sagi Grimberg
     [not found] ` <1381851510-17290-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-15 15:38   ` [PATCH RFC 1/9] IB/core: Introduce indirect and protected memory regions Sagi Grimberg
     [not found]     ` <1381851510-17290-2-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-17 22:43       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A8237388CE2BE0-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-10-20 13:05           ` Sagi Grimberg [this message]
     [not found]         ` <5263CC09.6030103@mellanox.com>
     [not found]           ` <5263CC09.6030103-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-21 14:39             ` Hefty, Sean
2013-10-15 15:38   ` [PATCH RFC 2/9] IB/core: Introduce Signature Verbs API Sagi Grimberg
     [not found]     ` <1381851510-17290-3-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-17 22:51       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A8237388CE2BFF-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-10-20 12:55           ` Sagi Grimberg
     [not found]             ` <5263D2DE.8010500-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-21 14:34               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A8237388CEA91E-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-10-21 16:12                   ` Sagi Grimberg
     [not found]                     ` <52655282.1000505-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-22 16:41                       ` Hefty, Sean
     [not found]                         ` <1828884A29C6694DAF28B7E6B8A8237388CEE1C7-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-10-22 17:46                           ` Sagi Grimberg
     [not found]                             ` <5266BA11.6090300-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-22 18:20                               ` Hefty, Sean
     [not found]                                 ` <1828884A29C6694DAF28B7E6B8A8237388CEE286-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-10-23 10:42                                   ` Sagi Grimberg
2013-10-15 15:38   ` [PATCH RFC 3/9] IB/mlx5, mlx5_core: Support for create_mr and destroy_mr Sagi Grimberg
2013-10-15 15:38   ` [PATCH RFC 4/9] IB/mlx5: Initialize mlx5_ib_qp signature related Sagi Grimberg
2013-10-15 15:38   ` [PATCH RFC 5/9] IB/mlx5: Break wqe handling to begin & finish routines Sagi Grimberg
2013-10-15 15:38   ` [PATCH RFC 6/9] IB/mlx5: remove MTT access mode from umr flags helper function Sagi Grimberg
2013-10-15 15:38   ` [PATCH RFC 7/9] IB/mlx5: Support IB_WR_REG_SIG_MR Sagi Grimberg
2013-10-15 15:38   ` [PATCH RFC 8/9] IB/mlx5: Collect signature error completion Sagi Grimberg
2013-10-15 15:38   ` [PATCH RFC 9/9] IB/mlx5: Publish support in signature feature Sagi Grimberg

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=5263D535.3010409@mellanox.com \
    --to=sagig-vpraknaxozvwk0htik3j/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=oren-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox