All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzahi Oved <tzahio.lists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
Cc: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH V4 8/9] IB/core: Add RoCE IP based addressing extensions for rdma_ucm
Date: Sun, 27 Oct 2013 17:29:08 +0200	[thread overview]
Message-ID: <526D3144.7040901@gmail.com> (raw)
In-Reply-To: <523E9D06.8050804-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On 22/09/2013 10:32, Matan Barak wrote:
> On 18/9/2013 1:07 PM, Yann Droneaud wrote:
>> Hi,
>>
>> Le 18.09.2013 10:40, Matan Barak a écrit :
>>> On 17/9/2013 6:43 PM, Yann Droneaud wrote:
>>>> Le 17.09.2013 17:13, Matan Barak a écrit :
>>>>> On 17/9/2013 1:25 PM, Yann Droneaud wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Le 17.09.2013 12:02, Matan Barak a écrit :
>>>>>>>
>>>>>>> That's right - we're not checking anything here.
>>>>>>> struct ib_uverbs_qp_attr_ex contains 2 user pointers:
>>>>>>> +       /* represents: struct ib_uverbs_ah_attr_ex * __user */
>>>>>>> +       void __user *ah_attr_ex;
>>>>>>> +       /* represents: struct ib_uverbs_ah_attr_ex * __user */
>>>>>>> +       void __user *alt_ah_attr_ex;
>>>>>>>
>>>>>>> Those pointers should be given to rdma_init_qp_attr in order to
>>>>>>> initialize them.
>>>>>>>
>>>>>>> We are using pointers here in order to maintain future 
>>>>>>> extendability
>>>>>>> of the address handle structures.
>>>>>>>
>>>>>>
>>>>>> First: you can't put pointer asis in public data structure. Look to
>>>>>> all
>>>>>> others "command" structures
>>>>>> declared in include/uapi/rdma/ib_user_verbs.h
>>>>>
>>>>> Thanks for the review. Looking at other commands, I see that pointers
>>>>> (such a the response) are passed as __u64 at the command structure.
>>>>
>>>> Indeed. So that 32bits and 64bits binaries use the same layout.
>>>>
>>>>> Is that what you mean ? I think it's a bit odd to pass those
>>>>> pointers as
>>>>> a part of the command, as they are output only attributes. Though,
>>>>> I'll change the code to use __u64 instead of the actual __user
>>>>> pointers.
>>>>>
>>>>
>>>> How can those pointers be output parameters ? Does kernel allocate 
>>>> some
>>>> pages
>>>> and putting the addresses of those in the ah_attr_ex and 
>>>> alt_ah_attr_ex
>>>> pointers ?
>>>
>>> No, the user allocates them and passes the addresses to the kernel.
>>> The kernel fills the user-allocated space. It works the exact same way
>>> as the response structure.
>>>
>>
>> So it's not "odd to pass those pointers as part of the command" :)
>> The commands structure hold all the information needed to process it.
>>
>> I've seen that the proposed command has pointers to others user memory
>> buffers
>> not part of the write() operations ... just like some ucma commands :(
>>
>> This make the kernel do userspace pointer chasing ... it's not good
>> from maintainability point of view: it's adding complexity.
>>
>
> The response/cmd buffer are already userspace pointers, thus the 
> kernel is already doing some userspace pointer chasing. Though, it 
> might be better to use "iovec like" behavior by putting several output 
> buffers in the command. What do you think about moving the 
> ah_attr_ex/alt_ah_attr_ex into the command ?
>

We'd like to move forward here with submitting the extended kernel 
commands scheme, and would like to refrain from over-complicating it. In 
this singular case we need one extra level of indirection in the 
commands thus would hate to build a whole new scheme to
nested pointers commands. As Matan suggested, future pointer usage can 
be flattened to the main command struct itself and thus further nesting 
can be avoided.
The use of pointers in commands is dealt per command basis and doesn't 
impact the infrastructure itself, and as u said, this is not the first 
time it is used.

>>>>
>>>> I don't buy the "maintain future extendability" argument for such
>>>> specific cruft.
>>>> It's not enough generic to fall in the extensible pattern.
>>>
>>> I don't see why.
>>> struct inner1 {
>>> ... some fields ...
>>> };
>>> struct inner2 {
>>> ... some fields ...
>>> };
>>> struct outer {
>>> ... some fields ...
>>> struct inner1 in1;
>>> struct inner2 in2;
>>> ... some fields ...
>>> };
>>>
>>> Now lets say we need to extend inner1 with a new field in its bottom.
>>> If inner1 was inlined, outer memory layout would be changed and we'll
>>> get problems with new user <-> old kernel. That's a general problem
>>> that can be solved easily by using:
>>> struct outer {
>>> ... some fields ...
>>> struct inner1 *in1;
>>> struct inner2 *in2;
>>> ... some fields ...
>>> };
>>>
>>> Since we're using __u64 to pass pointers, instead of struct
>>> inner[1-2]* we could use __u64. That's ok.
>>> In our case the only usage of in[1-2] is as output parameters. The
>>> user allocates space only to let the kernel fills it for him.
>>> That's why I think putting it as a part of the response is more
>>> appropriate.
>>>
>>
>> [ Currently "response" is write only. It's cleaner that way ]
>>
>> The scheme presented, as I read here, is starting to look like a forest
>> of pointers,
>> a recursive octopus... and I don't like those.
>>
>> I think of something like NETLINK and IOVEC as a better scheme (quite
>> like a TLV things)
>> But using such scheme would introduce a new ABI ... and came with its
>> own set of complexity problems.
>>
>
> Currently, we only have 2 levels of indirections. I don't think other 
> commands will require the usage of pointers. Anyway, moving those 
> pointers into the command buffer will flatten this tree into one level.
> I don't think that using other methods, which currently aren't used in 
> uverbs, is something we should introduce without carefully examining 
> the possible implications.
>
>>>>>>
>>>>>> Same apply to struct ib_uverbs_modify_qp_ex, but struct
>>>>>> ib_uverbs_modify_qp_ex has the comp_mask as first field 
>>>>>> (introducing a
>>>>>> hole).
>>>>>
>>>>> We'll add a reserved field to fix this hole. Thanks for that catch!
>>>>>
>>>>
>>>> Why not putting that field after the struct ib_uverbs_modify_qp 
>>>> field ?
>>>> (even if I don't like the comp_mask things, I waiting for a real world
>>>> example).
>>>
>>> Since every struct starts with u32 comp_mask, I suggest putting
>>> required reserved field right after this comp_mask. I've reviewed this
>>> case again and I don't think a reserved field is needed here. The
>>> largest field in struct ib_uverbs_qp_dest is u32. Hence, the struct
>>> will be 32bit aligned. Since struct ib_uverbs_qp_dest shouldn't be
>>> changed anymore, as it'll change the memory layout, there's no reason
>>> to force struct ib_uverbs_qp_dest to be 64bit aligned.
>>
>> Yes you're right.
>>
>> Perhaps I was thinkig of ib_uverbs_create_ah_ex ?
>>
>
> create_ah_ex will be removed in the next version if ip based 
> addressing patchset :-)
>
>> Regards.
>>
> Regards
>
> -- 
> 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

--
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-27 15:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 14:41 [PATCH V4 0/9] IP based RoCE GID Addressing Or Gerlitz
     [not found] ` <1378824099-22150-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-10 14:41   ` [PATCH V4 1/9] IB/core: Ethernet L2 attributes in verbs/cm structures Or Gerlitz
2013-09-10 14:41   ` [PATCH V4 2/9] IB/CMA: RoCE IP based GID addressing Or Gerlitz
2013-09-10 14:41   ` [PATCH V4 3/9] IB/mlx4: Use RoCE IP based GIDs in the port GID table Or Gerlitz
2013-09-10 14:41   ` [PATCH V4 4/9] IB/mlx4: Handle Ethernet L2 parameters for IP based GID addressing Or Gerlitz
2013-09-10 14:41   ` [PATCH V4 5/9] IB/ocrdma: Populate GID table with IP based gids Or Gerlitz
2013-09-10 14:41   ` [PATCH V4 6/9] IB/ocrdma: Handle Ethernet L2 parameters for IP based GID addressing Or Gerlitz
2013-09-10 14:41   ` [PATCH V4 7/9] IB/core: Add RoCE IP based addressing extensions for uverbs Or Gerlitz
     [not found]     ` <1378824099-22150-8-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-11 10:06       ` meuh-zgzEX58YAwA
     [not found]         ` <6d494aa8d403e0c50b16f09fbd2c3ab6-zgzEX58YAwA@public.gmane.org>
2013-09-11 11:38           ` Or Gerlitz
     [not found]             ` <52305632.1030604-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-11 12:42               ` Yann Droneaud
2013-09-10 14:41   ` [PATCH V4 8/9] IB/core: Add RoCE IP based addressing extensions for rdma_ucm Or Gerlitz
     [not found]     ` <1378824099-22150-9-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-11  9:52       ` Yann Droneaud
     [not found]         ` <26c47667e463e65dd79caaa4bddc437b-zgzEX58YAwA@public.gmane.org>
2013-09-11 11:32           ` Or Gerlitz
     [not found]             ` <523054BA.2040608-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-11 12:36               ` Yann Droneaud
     [not found]                 ` <97104d76028c356b458509ce95b08c92-zgzEX58YAwA@public.gmane.org>
2013-09-17 10:02                   ` Matan Barak
     [not found]                     ` <5238289D.40608-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-17 10:25                       ` Yann Droneaud
     [not found]                         ` <bcec9d3a9a72ed1d612a4dd49b670800-zgzEX58YAwA@public.gmane.org>
2013-09-17 15:13                           ` Matan Barak
     [not found]                             ` <523871A2.8010109-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-17 15:43                               ` Yann Droneaud
     [not found]                                 ` <8bb85d86eca247afa5786b7c7e4c737a-zgzEX58YAwA@public.gmane.org>
2013-09-18  8:40                                   ` Matan Barak
     [not found]                                     ` <52396719.4050809-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-18 10:07                                       ` Yann Droneaud
     [not found]                                         ` <698ad99050d7ece7bac8a591e4318f45-zgzEX58YAwA@public.gmane.org>
2013-09-22  7:32                                           ` Matan Barak
     [not found]                                             ` <523E9D06.8050804-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-27 15:29                                               ` Tzahi Oved [this message]
2013-09-10 14:41   ` [PATCH V4 9/9] IB/mlx4: Enable mlx4_ib support for MODIFY_QP_EX Or Gerlitz
     [not found]     ` <1378824099-22150-10-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-12  5:26       ` Devesh Sharma
     [not found]         ` <CAGgPuS1tAiyA3TZ5_fpua3ue6JrZ9ruS+O+QU-7t28i0dZ7cUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-12 10:45           ` Or Gerlitz
     [not found]             ` <52319B38.5070807-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-12 11:31               ` Devesh Sharma
2013-09-12 12:24                 ` Or Gerlitz
     [not found]                   ` <5231B28E.4090605-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-09-12 17:22                     ` Jason Gunthorpe
     [not found]                       ` <20130912172252.GA4611-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-09-17 17:50                         ` Roland Dreier
2013-09-12 11:46               ` Devesh Sharma

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=526D3144.7040901@gmail.com \
    --to=tzahio.lists-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@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 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.