Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* Re: [RFC rdma 1/3] RDMA/core: Create a common mmap function
       [not found]               ` <85247f12-1d78-0e66-fadc-d04862511ca7@amazon.com>
@ 2019-07-04 12:35                 ` Jason Gunthorpe
  2019-07-05 15:29                   ` [EXT] " Michal Kalderon
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Gunthorpe @ 2019-07-04 12:35 UTC (permalink / raw)
  To: Gal Pressman
  Cc: Michal Kalderon, dledford@redhat.com, leon@kernel.org,
	sleybo@amazon.com, Ariel Elior, linux-rdma@vger.kernel.org

On Wed, Jul 03, 2019 at 11:19:34AM +0300, Gal Pressman wrote:
> On 03/07/2019 1:31, Jason Gunthorpe wrote:
> >> Seems except Mellanox + hns the mmap flags aren't ABI. 
> >> Also, current Mellanox code seems like it won't benefit from 
> >> mmap cookie helper functions in any case as the mmap function is very specific and the flags used indicate 
> >> the address and not just how to map it.
> > 
> > IMHO, mlx5 has a goofy implementaiton here as it codes all of the object
> > type, handle and cachability flags in one thing.
> 
> Do we need object type flags as well in the generic mmap code?

At the end of the day the driver needs to know what page to map during
the mmap syscall.

mlx5 does this by encoding the page type in the address, and then many
types have seperate lookups based onthe offset for the actual page.

IMHO the single lookup and opaque offset is generally better..

Since the mlx5 scheme is ABI it can't be changed unfortunately.

If you want to do user controlled cachability flags, or not, is a fair
question, but they still become ABI..

I'm wondering if it really makes sense to do that during the mmap, or
if the cachability should be set as part of creating the cookie?

> Another issue is that these flags aren't exposed in an ABI file, so
> a userspace library can't really make use of it in current state.

Woops.

Ah, this is all ABI so you need to dig out of this hole ASAP :)

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXT] Re: [RFC rdma 1/3] RDMA/core: Create a common mmap function
  2019-07-04 12:35                 ` [RFC rdma 1/3] RDMA/core: Create a common mmap function Jason Gunthorpe
@ 2019-07-05 15:29                   ` Michal Kalderon
  2019-07-05 15:32                     ` Jason Gunthorpe
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Kalderon @ 2019-07-05 15:29 UTC (permalink / raw)
  To: Jason Gunthorpe, Gal Pressman
  Cc: dledford@redhat.com, leon@kernel.org, sleybo@amazon.com,
	Ariel Elior, linux-rdma@vger.kernel.org

> From: Jason Gunthorpe <jgg@ziepe.ca>
> Sent: Thursday, July 4, 2019 3:35 PM
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Wed, Jul 03, 2019 at 11:19:34AM +0300, Gal Pressman wrote:
> > On 03/07/2019 1:31, Jason Gunthorpe wrote:
> > >> Seems except Mellanox + hns the mmap flags aren't ABI.
> > >> Also, current Mellanox code seems like it won't benefit from mmap
> > >> cookie helper functions in any case as the mmap function is very
> > >> specific and the flags used indicate the address and not just how to map
> it.
> > >
> > > IMHO, mlx5 has a goofy implementaiton here as it codes all of the
> > > object type, handle and cachability flags in one thing.
> >
> > Do we need object type flags as well in the generic mmap code?
> 
> At the end of the day the driver needs to know what page to map during the
> mmap syscall.
> 
> mlx5 does this by encoding the page type in the address, and then many
> types have seperate lookups based onthe offset for the actual page.
> 
> IMHO the single lookup and opaque offset is generally better..
> 
> Since the mlx5 scheme is ABI it can't be changed unfortunately.
> 
> If you want to do user controlled cachability flags, or not, is a fair question,
> but they still become ABI..
> 
> I'm wondering if it really makes sense to do that during the mmap, or if the
> cachability should be set as part of creating the cookie?
> 
> > Another issue is that these flags aren't exposed in an ABI file, so a
> > userspace library can't really make use of it in current state.
> 
> Woops.
> 
> Ah, this is all ABI so you need to dig out of this hole ASAP :)
>
Jason, I didn't follow - what is all ABI? 
currently EFA implementation encodes the cachability inside the key,
It's not exposed in ABI file and is opaque to user-space. The kernel decides on the cachability
And get's it back in the key when mmap is called. It seems good enough for the current cases.  
Thanks , 
Michal
 
> Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [EXT] Re: [RFC rdma 1/3] RDMA/core: Create a common mmap function
  2019-07-05 15:29                   ` [EXT] " Michal Kalderon
@ 2019-07-05 15:32                     ` Jason Gunthorpe
  2019-07-05 17:24                       ` Michal Kalderon
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Gunthorpe @ 2019-07-05 15:32 UTC (permalink / raw)
  To: Michal Kalderon
  Cc: Gal Pressman, dledford@redhat.com, leon@kernel.org,
	sleybo@amazon.com, Ariel Elior, linux-rdma@vger.kernel.org

On Fri, Jul 05, 2019 at 03:29:03PM +0000, Michal Kalderon wrote:
> > From: Jason Gunthorpe <jgg@ziepe.ca>
> > Sent: Thursday, July 4, 2019 3:35 PM
> > 
> > External Email
> > 
> > On Wed, Jul 03, 2019 at 11:19:34AM +0300, Gal Pressman wrote:
> > > On 03/07/2019 1:31, Jason Gunthorpe wrote:
> > > >> Seems except Mellanox + hns the mmap flags aren't ABI.
> > > >> Also, current Mellanox code seems like it won't benefit from mmap
> > > >> cookie helper functions in any case as the mmap function is very
> > > >> specific and the flags used indicate the address and not just how to map
> > it.
> > > >
> > > > IMHO, mlx5 has a goofy implementaiton here as it codes all of the
> > > > object type, handle and cachability flags in one thing.
> > >
> > > Do we need object type flags as well in the generic mmap code?
> > 
> > At the end of the day the driver needs to know what page to map during the
> > mmap syscall.
> > 
> > mlx5 does this by encoding the page type in the address, and then many
> > types have seperate lookups based onthe offset for the actual page.
> > 
> > IMHO the single lookup and opaque offset is generally better..
> > 
> > Since the mlx5 scheme is ABI it can't be changed unfortunately.
> > 
> > If you want to do user controlled cachability flags, or not, is a fair question,
> > but they still become ABI..
> > 
> > I'm wondering if it really makes sense to do that during the mmap, or if the
> > cachability should be set as part of creating the cookie?
> > 
> > > Another issue is that these flags aren't exposed in an ABI file, so a
> > > userspace library can't really make use of it in current state.
> > 
> > Woops.
> > 
> > Ah, this is all ABI so you need to dig out of this hole ASAP :)
> >
> Jason, I didn't follow - what is all ABI? 
> currently EFA implementation encodes the cachability inside the key,
> It's not exposed in ABI file and is opaque to user-space. The kernel decides on the cachability
> And get's it back in the key when mmap is called. It seems good
> enough for the current cases.

Then the key 'offset' should not include cachability information at
all.

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXT] Re: [RFC rdma 1/3] RDMA/core: Create a common mmap function
  2019-07-05 15:32                     ` Jason Gunthorpe
@ 2019-07-05 17:24                       ` Michal Kalderon
  2019-07-05 17:35                         ` Jason Gunthorpe
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Kalderon @ 2019-07-05 17:24 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Gal Pressman, dledford@redhat.com, leon@kernel.org,
	sleybo@amazon.com, Ariel Elior, linux-rdma@vger.kernel.org

> From: Jason Gunthorpe <jgg@ziepe.ca>
> Sent: Friday, July 5, 2019 6:33 PM
> 
> On Fri, Jul 05, 2019 at 03:29:03PM +0000, Michal Kalderon wrote:
> > > From: Jason Gunthorpe <jgg@ziepe.ca>
> > > Sent: Thursday, July 4, 2019 3:35 PM
> > >
> > > External Email
> > >
> > > On Wed, Jul 03, 2019 at 11:19:34AM +0300, Gal Pressman wrote:
> > > > On 03/07/2019 1:31, Jason Gunthorpe wrote:
> > > > >> Seems except Mellanox + hns the mmap flags aren't ABI.
> > > > >> Also, current Mellanox code seems like it won't benefit from
> > > > >> mmap cookie helper functions in any case as the mmap function
> > > > >> is very specific and the flags used indicate the address and
> > > > >> not just how to map
> > > it.
> > > > >
> > > > > IMHO, mlx5 has a goofy implementaiton here as it codes all of
> > > > > the object type, handle and cachability flags in one thing.
> > > >
> > > > Do we need object type flags as well in the generic mmap code?
> > >
> > > At the end of the day the driver needs to know what page to map
> > > during the mmap syscall.
> > >
> > > mlx5 does this by encoding the page type in the address, and then
> > > many types have seperate lookups based onthe offset for the actual
> page.
> > >
> > > IMHO the single lookup and opaque offset is generally better..
> > >
> > > Since the mlx5 scheme is ABI it can't be changed unfortunately.
> > >
> > > If you want to do user controlled cachability flags, or not, is a
> > > fair question, but they still become ABI..
> > >
> > > I'm wondering if it really makes sense to do that during the mmap,
> > > or if the cachability should be set as part of creating the cookie?
> > >
> > > > Another issue is that these flags aren't exposed in an ABI file,
> > > > so a userspace library can't really make use of it in current state.
> > >
> > > Woops.
> > >
> > > Ah, this is all ABI so you need to dig out of this hole ASAP :)
> > >
> > Jason, I didn't follow - what is all ABI?
> > currently EFA implementation encodes the cachability inside the key,
> > It's not exposed in ABI file and is opaque to user-space. The kernel
> > decides on the cachability And get's it back in the key when mmap is
> > called. It seems good enough for the current cases.
> 
> Then the key 'offset' should not include cachability information at all.
> 
Fair enough, so as you stated above the cachabiliy can be set in the cookie. 
Would we still like to leave some bits for future ABI enhancements, requests, from user ? 
Similar to a page type that mlx has ? 

Thanks,
Michal


> Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [EXT] Re: [RFC rdma 1/3] RDMA/core: Create a common mmap function
  2019-07-05 17:24                       ` Michal Kalderon
@ 2019-07-05 17:35                         ` Jason Gunthorpe
  2019-07-07  6:41                           ` Gal Pressman
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Gunthorpe @ 2019-07-05 17:35 UTC (permalink / raw)
  To: Michal Kalderon
  Cc: Gal Pressman, dledford@redhat.com, leon@kernel.org,
	sleybo@amazon.com, Ariel Elior, linux-rdma@vger.kernel.org

On Fri, Jul 05, 2019 at 05:24:18PM +0000, Michal Kalderon wrote:
> > From: Jason Gunthorpe <jgg@ziepe.ca>
> > Sent: Friday, July 5, 2019 6:33 PM
> > 
> > On Fri, Jul 05, 2019 at 03:29:03PM +0000, Michal Kalderon wrote:
> > > > From: Jason Gunthorpe <jgg@ziepe.ca>
> > > > Sent: Thursday, July 4, 2019 3:35 PM
> > > >
> > > > External Email
> > > >
> > > > On Wed, Jul 03, 2019 at 11:19:34AM +0300, Gal Pressman wrote:
> > > > > On 03/07/2019 1:31, Jason Gunthorpe wrote:
> > > > > >> Seems except Mellanox + hns the mmap flags aren't ABI.
> > > > > >> Also, current Mellanox code seems like it won't benefit from
> > > > > >> mmap cookie helper functions in any case as the mmap function
> > > > > >> is very specific and the flags used indicate the address and
> > > > > >> not just how to map
> > > > it.
> > > > > >
> > > > > > IMHO, mlx5 has a goofy implementaiton here as it codes all of
> > > > > > the object type, handle and cachability flags in one thing.
> > > > >
> > > > > Do we need object type flags as well in the generic mmap code?
> > > >
> > > > At the end of the day the driver needs to know what page to map
> > > > during the mmap syscall.
> > > >
> > > > mlx5 does this by encoding the page type in the address, and then
> > > > many types have seperate lookups based onthe offset for the actual
> > page.
> > > >
> > > > IMHO the single lookup and opaque offset is generally better..
> > > >
> > > > Since the mlx5 scheme is ABI it can't be changed unfortunately.
> > > >
> > > > If you want to do user controlled cachability flags, or not, is a
> > > > fair question, but they still become ABI..
> > > >
> > > > I'm wondering if it really makes sense to do that during the mmap,
> > > > or if the cachability should be set as part of creating the cookie?
> > > >
> > > > > Another issue is that these flags aren't exposed in an ABI file,
> > > > > so a userspace library can't really make use of it in current state.
> > > >
> > > > Woops.
> > > >
> > > > Ah, this is all ABI so you need to dig out of this hole ASAP :)
> > > >
> > > Jason, I didn't follow - what is all ABI?
> > > currently EFA implementation encodes the cachability inside the key,
> > > It's not exposed in ABI file and is opaque to user-space. The kernel
> > > decides on the cachability And get's it back in the key when mmap is
> > > called. It seems good enough for the current cases.
> > 
> > Then the key 'offset' should not include cachability information at all.
> > 
> Fair enough, so as you stated above the cachabiliy can be set in the cookie. 
> Would we still like to leave some bits for future ABI enhancements, requests, from user ? 
> Similar to a page type that mlx has ? 

Doesn't make sense to mix and match, the page_type was just some way
to avoid tracking cookies in some cases. If we are always having a
cookie then the cookie should indicate the type based on how it was
created. Totally opaque

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [EXT] Re: [RFC rdma 1/3] RDMA/core: Create a common mmap function
  2019-07-05 17:35                         ` Jason Gunthorpe
@ 2019-07-07  6:41                           ` Gal Pressman
  2019-07-07 11:30                             ` Michal Kalderon
  0 siblings, 1 reply; 7+ messages in thread
From: Gal Pressman @ 2019-07-07  6:41 UTC (permalink / raw)
  To: Jason Gunthorpe, Michal Kalderon
  Cc: dledford@redhat.com, leon@kernel.org, sleybo@amazon.com,
	Ariel Elior, linux-rdma@vger.kernel.org

On 05/07/2019 20:35, Jason Gunthorpe wrote:
> On Fri, Jul 05, 2019 at 05:24:18PM +0000, Michal Kalderon wrote:
>>> From: Jason Gunthorpe <jgg@ziepe.ca>
>>> Sent: Friday, July 5, 2019 6:33 PM
>>>
>>> On Fri, Jul 05, 2019 at 03:29:03PM +0000, Michal Kalderon wrote:
>>>>> From: Jason Gunthorpe <jgg@ziepe.ca>
>>>>> Sent: Thursday, July 4, 2019 3:35 PM
>>>>>
>>>>> External Email
>>>>>
>>>>> On Wed, Jul 03, 2019 at 11:19:34AM +0300, Gal Pressman wrote:
>>>>>> On 03/07/2019 1:31, Jason Gunthorpe wrote:
>>>>>>>> Seems except Mellanox + hns the mmap flags aren't ABI.
>>>>>>>> Also, current Mellanox code seems like it won't benefit from
>>>>>>>> mmap cookie helper functions in any case as the mmap function
>>>>>>>> is very specific and the flags used indicate the address and
>>>>>>>> not just how to map
>>>>> it.
>>>>>>>
>>>>>>> IMHO, mlx5 has a goofy implementaiton here as it codes all of
>>>>>>> the object type, handle and cachability flags in one thing.
>>>>>>
>>>>>> Do we need object type flags as well in the generic mmap code?
>>>>>
>>>>> At the end of the day the driver needs to know what page to map
>>>>> during the mmap syscall.
>>>>>
>>>>> mlx5 does this by encoding the page type in the address, and then
>>>>> many types have seperate lookups based onthe offset for the actual
>>> page.
>>>>>
>>>>> IMHO the single lookup and opaque offset is generally better..
>>>>>
>>>>> Since the mlx5 scheme is ABI it can't be changed unfortunately.
>>>>>
>>>>> If you want to do user controlled cachability flags, or not, is a
>>>>> fair question, but they still become ABI..
>>>>>
>>>>> I'm wondering if it really makes sense to do that during the mmap,
>>>>> or if the cachability should be set as part of creating the cookie?
>>>>>
>>>>>> Another issue is that these flags aren't exposed in an ABI file,
>>>>>> so a userspace library can't really make use of it in current state.
>>>>>
>>>>> Woops.
>>>>>
>>>>> Ah, this is all ABI so you need to dig out of this hole ASAP :)
>>>>>
>>>> Jason, I didn't follow - what is all ABI?
>>>> currently EFA implementation encodes the cachability inside the key,
>>>> It's not exposed in ABI file and is opaque to user-space. The kernel
>>>> decides on the cachability And get's it back in the key when mmap is
>>>> called. It seems good enough for the current cases.
>>>
>>> Then the key 'offset' should not include cachability information at all.
>>>
>> Fair enough, so as you stated above the cachabiliy can be set in the cookie. 
>> Would we still like to leave some bits for future ABI enhancements, requests, from user ? 
>> Similar to a page type that mlx has ? 
> 
> Doesn't make sense to mix and match, the page_type was just some way
> to avoid tracking cookies in some cases. If we are always having a
> cookie then the cookie should indicate the type based on how it was
> created. Totally opaque

I'm fine with removing the cachability flags from the ABI, but I don't see how
the page types can be added without exposing them in the key.

If we want to mmap something that's not a QP/CQ/... how can we do that? I guess
only by returning some key in alloc_ucontext?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXT] Re: [RFC rdma 1/3] RDMA/core: Create a common mmap function
  2019-07-07  6:41                           ` Gal Pressman
@ 2019-07-07 11:30                             ` Michal Kalderon
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Kalderon @ 2019-07-07 11:30 UTC (permalink / raw)
  To: Gal Pressman, Jason Gunthorpe
  Cc: dledford@redhat.com, leon@kernel.org, sleybo@amazon.com,
	Ariel Elior, linux-rdma@vger.kernel.org

> From: Gal Pressman <galpress@amazon.com>
> Sent: Sunday, July 7, 2019 9:41 AM
> 
> On 05/07/2019 20:35, Jason Gunthorpe wrote:
> > On Fri, Jul 05, 2019 at 05:24:18PM +0000, Michal Kalderon wrote:
> >>> From: Jason Gunthorpe <jgg@ziepe.ca>
> >>> Sent: Friday, July 5, 2019 6:33 PM
> >>>
> >>> On Fri, Jul 05, 2019 at 03:29:03PM +0000, Michal Kalderon wrote:
> >>>>> From: Jason Gunthorpe <jgg@ziepe.ca>
> >>>>> Sent: Thursday, July 4, 2019 3:35 PM
> >>>>>
> >>>>> External Email
> >>>>>
> >>>>> On Wed, Jul 03, 2019 at 11:19:34AM +0300, Gal Pressman wrote:
> >>>>>> On 03/07/2019 1:31, Jason Gunthorpe wrote:
> >>>>>>>> Seems except Mellanox + hns the mmap flags aren't ABI.
> >>>>>>>> Also, current Mellanox code seems like it won't benefit from
> >>>>>>>> mmap cookie helper functions in any case as the mmap function
> >>>>>>>> is very specific and the flags used indicate the address and
> >>>>>>>> not just how to map
> >>>>> it.
> >>>>>>>
> >>>>>>> IMHO, mlx5 has a goofy implementaiton here as it codes all of
> >>>>>>> the object type, handle and cachability flags in one thing.
> >>>>>>
> >>>>>> Do we need object type flags as well in the generic mmap code?
> >>>>>
> >>>>> At the end of the day the driver needs to know what page to map
> >>>>> during the mmap syscall.
> >>>>>
> >>>>> mlx5 does this by encoding the page type in the address, and then
> >>>>> many types have seperate lookups based onthe offset for the actual
> >>> page.
> >>>>>
> >>>>> IMHO the single lookup and opaque offset is generally better..
> >>>>>
> >>>>> Since the mlx5 scheme is ABI it can't be changed unfortunately.
> >>>>>
> >>>>> If you want to do user controlled cachability flags, or not, is a
> >>>>> fair question, but they still become ABI..
> >>>>>
> >>>>> I'm wondering if it really makes sense to do that during the mmap,
> >>>>> or if the cachability should be set as part of creating the cookie?
> >>>>>
> >>>>>> Another issue is that these flags aren't exposed in an ABI file,
> >>>>>> so a userspace library can't really make use of it in current state.
> >>>>>
> >>>>> Woops.
> >>>>>
> >>>>> Ah, this is all ABI so you need to dig out of this hole ASAP :)
> >>>>>
> >>>> Jason, I didn't follow - what is all ABI?
> >>>> currently EFA implementation encodes the cachability inside the
> >>>> key, It's not exposed in ABI file and is opaque to user-space. The
> >>>> kernel decides on the cachability And get's it back in the key when
> >>>> mmap is called. It seems good enough for the current cases.
> >>>
> >>> Then the key 'offset' should not include cachability information at all.
> >>>
> >> Fair enough, so as you stated above the cachabiliy can be set in the
> cookie.
> >> Would we still like to leave some bits for future ABI enhancements,
> requests, from user ?
> >> Similar to a page type that mlx has ?
> >
> > Doesn't make sense to mix and match, the page_type was just some way
> > to avoid tracking cookies in some cases. If we are always having a
> > cookie then the cookie should indicate the type based on how it was
> > created. Totally opaque
> 
> I'm fine with removing the cachability flags from the ABI, but I don't see how
> the page types can be added without exposing them in the key.
> 
> If we want to mmap something that's not a QP/CQ/... how can we do that? I
> guess only by returning some key in alloc_ucontext?

Right. Every call to mmap should be backed up by a cookie in the driver.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-07 11:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190627135825.4924-1-michal.kalderon@marvell.com>
     [not found] ` <20190627135825.4924-2-michal.kalderon@marvell.com>
     [not found]   ` <d6e9bc3b-215b-c6ea-11d2-01ae8f956bfa@amazon.com>
     [not found]     ` <20190627155219.GA9568@ziepe.ca>
     [not found]       ` <14e60be7-ae3a-8e86-c377-3bf126a215f0@amazon.com>
     [not found]         ` <MN2PR18MB318228F0D3DA5EA03A56573DA1FC0@MN2PR18MB3182.namprd18.prod.outlook.com>
     [not found]           ` <MN2PR18MB3182EC9EA3E330E0751836FDA1F80@MN2PR18MB3182.namprd18.prod.outlook.com>
     [not found]             ` <20190702223126.GA11860@ziepe.ca>
     [not found]               ` <85247f12-1d78-0e66-fadc-d04862511ca7@amazon.com>
2019-07-04 12:35                 ` [RFC rdma 1/3] RDMA/core: Create a common mmap function Jason Gunthorpe
2019-07-05 15:29                   ` [EXT] " Michal Kalderon
2019-07-05 15:32                     ` Jason Gunthorpe
2019-07-05 17:24                       ` Michal Kalderon
2019-07-05 17:35                         ` Jason Gunthorpe
2019-07-07  6:41                           ` Gal Pressman
2019-07-07 11:30                             ` Michal Kalderon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox