public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Tom Talpey <tom@talpey.com>
Cc: Sagi Grimberg <sagig@dev.mellanox.co.il>,
	Steve Wise <swise@opengridcomputing.com>,
	'Christoph Hellwig' <hch@infradead.org>,
	dledford@redhat.com, sagig@mellanox.com, ogerlitz@mellanox.com,
	roid@mellanox.com, linux-rdma@vger.kernel.org, eli@mellanox.com,
	target-devel@vger.kernel.org, linux-nfs@vger.kernel.org,
	trond.myklebust@primarydata.com, bfields@fieldses.org,
	Oren Duer <oren@mellanox.com>
Subject: Re: [PATCH V3 1/5] RDMA/core: Transport-independent access flags
Date: Wed, 8 Jul 2015 17:36:04 -0600	[thread overview]
Message-ID: <20150708233604.GA20765@obsidianresearch.com> (raw)
In-Reply-To: <559D983D.6000804@talpey.com>

On Wed, Jul 08, 2015 at 05:38:05PM -0400, Tom Talpey wrote:
> On 7/8/2015 3:08 PM, Jason Gunthorpe wrote:
> >The MR stuff was never really designed, the HW people provided some
> >capability and the SW side just raw exposed it, thoughtlessly.
> 
> Jason, I don't disagree that the API can be improved. I have some
> responses to your statements below though.
> 
> >Why is code using iWarp calling ib_get_dma_mr with
> >RDMA_MRR_READ_DEST/IB_ACCESS_REMOTE_WRITE ? That is insecure.
> 
> Because the iWARP protocol requires it, which was very much an
> intentional decision. It actually is not insecure, as discussed
> in detail in RFC5042. However, it is different from Infiniband.

You'll have to point me to the section on that..

ib_get_dma_mr(IB_ACCESS_REMOTE_WRITE) is defined to create a remote
access MR to all of physical memory. That means there exists a packet
the far side can send that will write to any place in physical memory.

Yes, the far side has to guess the key, but there is no way you'll
convince me that is secure, and 6.3.4 supports that position.

   "The ULP must set the base and bounds of the buffer when the
    STag is initialized to expose only the data to be retrieved."

ib_get_dma_mr(IB_ACCESS_REMOTE_WRITE) directly contravenes that
requirement.

I assume you mean when it creates a FRMR it is secure that it uses
IB_ACCESS_REMOTE_WRITE and the invalidates the MR before accessing it
- and I agree with that.

> >Why on earth is NFS using frmr to create RDMA READ lkeys?
> 
> Because NFS desires to have a single code path that works for all
> transports. In addition, using the IB dma_mr as an lkey means that
> large I/O (common with NFS) would require multiple RDMA Read
> operations, when the page list exceeded the local scatter/gather
> limit of the device.

So NFS got overwhelmed by API complexity and used a scheme that
penalizes all hardware, in all cases, rather than fall back on MR only
when absolutely necessary. Not really a ringing endorsement of status
quo....

> >I think when you do that, it quickly becomes clear that iWarp's
> >problem is not a seemingly minor issue with different flag bits, but
> >that iWarp *cannot* use local_dma_lkey as a RDMA READ local buffer.
> >Using ib_get_dma_mr(IB_ACCESS_REMOTE_WRITE) is an insecure work
> >around. So iWarp (and only iWarp) should take the pain of spinning up
> >temporary local MRs for RDMA READ.
> 
> That is entirely the wrong layer to address this. It would prevent
> reuse of MRs, and require upper layers to be aware that this was
> the case - which is exactly the opposite of what you are trying
> to achieve.

How So?

I'd hope for an API that is transparent to the upper layer, that lets
the driver/core do a variety of things.

If a call needs to create a temporary local MR, then the API should be
structured so the driver/core can do that. If the MR type benefits
from re-use then the core/driver should internally pool and re-use the
MRs.

Give me a reason why NFS should care about any of this? All it is
doing is issuing RDMA READ's and expecting that data to land in local
memory.

Concretely, I'd imagine something like

cookie = rdma_post_read(sendq,local_sg,remote_sg,wrid);
[..]
if (wc->wrid == wrid)
  rdma_complete_read(sendq,cookie);

And the core/driver will RDMA READ the remote addresses in remote_sg
list into the local_sg, using the best available strategy, and it
doesn't have limits like only a few SG entries because 'best
available strategy' includes using temporary MRs and multiple SQWEs.

The driver will pick the 'best available strategy' that suits the HW
it is driving, not NFS/iSER/SRP/Lustre.

Same basic story for SEND, WRITE and RECV.

> >This should all be hidden under a common API and it shouldn't be
> >sprinkled all over the place in NFS, iSER, etc.
> 
> Are you arguing that all upper layer storage protocols take a single
> common approach to memory registration? That is a very different
> discussion.

I'm arguing upper layer protocols should never even see local memory
registration, that it is totally irrelevant to them. So yes, you can
call that a common approach to memory registration if you like..

Basically it appears there is nothing that NFS can do to optimize that
process that cannot be done in the driver/core equally effectively and
shared between all ULPs. If you see something otherwise, I'm really
interested to hear about it.

Even your case of the MR trade off for S/G list limitations - that is
a performance point NFS has no buisness choosing. The driver is best
placed to know when to switch between S/G lists, multiple RDMA READs
and MR. The trade off will shift depending on HW limits:
 - Old mthca hardware is probably better to use multiple RDMA READ
 - mlx4 is probably better to use FRMR
 - mlx5 is likely best with indirect MR
 - All of the above are likely best to exhaust the S/G list first
 
The same basic argument is true of WRITE, SEND and RECV. If the S/G
list is exhausted then the API should transparently build a local MR
to linearize the buffer, and the API should be designed so the core
code can do that without the ULP having to be involved in those
details.

Is it possible?

Jason

  reply	other threads:[~2015-07-08 23:36 UTC|newest]

Thread overview: 138+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-05 23:21 [PATCH V3 0/5] Transport-independent MRs Steve Wise
2015-07-05 23:22 ` [PATCH V3 1/5] RDMA/core: Transport-independent access flags Steve Wise
2015-07-06  5:25   ` Christoph Hellwig
2015-07-06 14:23     ` Steve Wise
2015-07-07  8:58       ` 'Christoph Hellwig'
     [not found]   ` <20150705232158.12029.25472.stgit-PBeJgSbIpn97NCTnQtmixQ@public.gmane.org>
2015-07-06  7:09     ` Haggai Eran
     [not found]       ` <559A2991.3040304-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-06 14:29         ` Steve Wise
2015-07-07 14:17       ` Steve Wise
2015-07-07 14:34         ` Haggai Eran
2015-07-07 14:46           ` Steve Wise
2015-07-07 15:07             ` Haggai Eran
2015-07-06  7:53     ` Sagi Grimberg
2015-07-06 14:37       ` Steve Wise
2015-07-06 16:17         ` Sagi Grimberg
2015-07-06 16:55           ` Steve Wise
2015-07-07  9:00           ` Christoph Hellwig
     [not found]             ` <20150707090001.GB11736-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-07  9:14               ` Sagi Grimberg
     [not found]                 ` <559B9891.8060907-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-07 14:05                   ` Steve Wise
2015-07-07 16:17                     ` Jason Gunthorpe
     [not found]                       ` <20150707161751.GA623-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-07 16:27                         ` Sagi Grimberg
     [not found]                           ` <559BFE03.4020709-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-07 21:36                             ` Jason Gunthorpe
2015-07-08  7:29                               ` Sagi Grimberg
     [not found]                                 ` <559CD174.4040901-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-08  8:13                                   ` 'Christoph Hellwig'
     [not found]                                     ` <20150708081320.GB24203-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-08 10:05                                       ` Sagi Grimberg
     [not found]                                         ` <559CF5E8.6080000-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-08 10:20                                           ` 'Christoph Hellwig'
     [not found]                                             ` <20150708102035.GA28421-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-08 11:08                                               ` Sagi Grimberg
     [not found]                                                 ` <559D0498.9050809-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-08 17:14                                                   ` Hefty, Sean
2015-07-09  8:46                                                     ` Sagi Grimberg
2015-07-09 13:52                                                       ` Chuck Lever
2015-07-10 19:34                                                         ` Christoph Hellwig
2015-07-12  7:49                                                           ` Sagi Grimberg
2015-07-13 16:50                                                             ` Jason Gunthorpe
2015-07-14  8:06                                                               ` Sagi Grimberg
     [not found]                                                                 ` <55A4C2FA.9060707-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-14 12:24                                                                   ` Tom Talpey
     [not found]                                                                     ` <55A4FF93.4090406-CLs1Zie5N5HQT0dZR+AlfA@public.gmane.org>
2015-07-14 13:21                                                                       ` Sagi Grimberg
2015-07-23  0:43                                                                       ` Hefty, Sean
2015-07-08 19:08                                 ` Jason Gunthorpe
     [not found]                                   ` <20150708190842.GB11740-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-08 20:32                                     ` 'Christoph Hellwig'
     [not found]                                       ` <20150708203205.GA21847-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-08 20:37                                         ` 'Christoph Hellwig'
2015-07-09  8:47                                         ` Sagi Grimberg
2015-07-09  0:03                                       ` Jason Gunthorpe
     [not found]                                         ` <20150709000337.GE16812-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-09  8:00                                           ` 'Christoph Hellwig'
2015-07-09  8:58                                           ` Sagi Grimberg
2015-07-09 22:18                                           ` Doug Ledford
2015-07-09 22:53                                             ` Jason Gunthorpe
2015-07-10 13:22                                               ` Tom Talpey
     [not found]                                                 ` <559FC710.1050307-CLs1Zie5N5HQT0dZR+AlfA@public.gmane.org>
2015-07-10 16:11                                                   ` Jason Gunthorpe
2015-07-10 17:56                                                     ` Doug Ledford
2015-07-10 18:34                                                       ` Chuck Lever
2015-07-10 18:42                                                       ` Tom Talpey
     [not found]                                                         ` <55A01225.9000000-CLs1Zie5N5HQT0dZR+AlfA@public.gmane.org>
2015-07-10 19:54                                                           ` Jason Gunthorpe
2015-07-10 20:48                                                             ` Jason Gunthorpe
     [not found]                                                             ` <20150710195420.GA31500-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-10 22:33                                                               ` Doug Ledford
2015-07-11 10:17                                                               ` 'Christoph Hellwig'
     [not found]                                                                 ` <20150711101736.GA14741-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-13 16:57                                                                   ` Jason Gunthorpe
2015-07-14  7:25                                                                     ` 'Christoph Hellwig'
2015-07-14  9:05                                                                       ` Sagi Grimberg
2015-07-14 15:35                                                                         ` 'Christoph Hellwig'
2015-07-14 17:26                                                                         ` Jason Gunthorpe
     [not found]                                                                           ` <20150714172655.GB24403-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-15  7:10                                                                             ` Sagi Grimberg
2015-07-10 22:30                                                           ` Doug Ledford
2015-07-10 20:57                                                       ` Jason Gunthorpe
     [not found]                                                         ` <20150710205706.GA7883-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-10 22:27                                                           ` Doug Ledford
     [not found]                                                             ` <20150710233417.GA8919@obsidianresearch.com>
     [not found]                                                               ` <20150710233417.GA8919-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-11  3:10                                                                 ` Doug Ledford
     [not found]                                                                   ` <55A0891F.4050105-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-07-13 17:18                                                                     ` Jason Gunthorpe
2015-07-13 22:23                                                                       ` Tom Talpey
2015-07-11 16:37                                                     ` Steve Wise
     [not found]                                                       ` <CCB6E837-88FF-4DBB-976D-4CF56396A1A1-/Yg/VP3ZvrM@public.gmane.org>
2015-07-12 10:46                                                         ` Sagi Grimberg
     [not found]                                                           ` <55A24571.60902-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-14 19:25                                                             ` Steve Wise
2015-07-14 19:29                                                               ` Jason Gunthorpe
     [not found]                                                                 ` <20150714192941.GA26292-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-14 19:32                                                                   ` Steve Wise
2015-07-14 19:37                                                                     ` Jason Gunthorpe
2015-07-14 19:55                                                                     ` 'Christoph Hellwig'
2015-07-14 20:10                                                                       ` Steve Wise
     [not found]                                                                       ` <20150714195511.GB7716-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-14 20:29                                                                         ` Jason Gunthorpe
     [not found]                                                                           ` <20150714202943.GB26927-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-14 20:40                                                                             ` Steve Wise
2015-07-14 20:44                                                                               ` Jason Gunthorpe
     [not found]                                                                                 ` <20150714204442.GD26927-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-14 20:54                                                                                   ` Steve Wise
2015-07-14 20:59                                                                                     ` Jason Gunthorpe
2015-07-14 20:50                                                                             ` Tom Talpey
2015-07-15  8:47                                                                             ` Sagi Grimberg
     [not found]                                                                               ` <55A61E38.20201-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-15 12:19                                                                                 ` 'Christoph Hellwig'
     [not found]                                                                                   ` <20150715121926.GB14993-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-15 19:17                                                                                     ` Jason Gunthorpe
2015-07-15  6:50                                                                           ` 'Christoph Hellwig'
     [not found]                                                                             ` <20150715065057.GA22113-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-15 19:12                                                                               ` Jason Gunthorpe
     [not found]                                                                                 ` <20150715191257.GF23588-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-16  6:41                                                                                   ` Jason Gunthorpe
2015-07-16  8:04                                                                                   ` 'Christoph Hellwig'
     [not found]                                                                                     ` <20150716080402.GC9093-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-16 16:13                                                                                       ` Jason Gunthorpe
2015-07-14 20:46                                                                     ` Tom Talpey
2015-07-14 19:45                                                               ` 'Christoph Hellwig'
     [not found]                                                                 ` <20150714194512.GA25887-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-14 19:57                                                                   ` Jason Gunthorpe
2015-07-14 19:58                                                                   ` Steve Wise
2015-07-14 20:41                                                                     ` Jason Gunthorpe
     [not found]                                                                       ` <20150714204145.GC26927-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-14 20:51                                                                         ` Steve Wise
2015-07-14 21:01                                                                           ` Steve Wise
2015-07-14 21:14                                                                             ` Jason Gunthorpe
2015-07-23 18:53                                                                     ` Hefty, Sean
     [not found]                                                                       ` <1828884A29C6694DAF28B7E6B8A82373A901C9A5-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-07-23 19:03                                                                         ` Steve Wise
2015-07-23 23:30                                                                           ` Hefty, Sean
     [not found]                                                                             ` <1828884A29C6694DAF28B7E6B8A82373A901DB80-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-07-23 23:53                                                                               ` Jason Gunthorpe
     [not found]                                                                                 ` <20150723235310.GA20537-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-24  0:18                                                                                   ` Hefty, Sean
2015-07-24  4:46                                                                                     ` Jason Gunthorpe
2015-07-08 21:38                                   ` Tom Talpey
2015-07-08 23:36                                     ` Jason Gunthorpe [this message]
2015-07-09 11:02                                       ` Sagi Grimberg
     [not found]                                         ` <559E54AB.2010905-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-09 17:01                                           ` Jason Gunthorpe
2015-07-09 20:00                                             ` Tom Talpey
2015-07-09 21:16                                               ` Jason Gunthorpe
     [not found]                                             ` <20150709170142.GA21921-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-10  8:55                                               ` kernel memory registration (was: RDMA/core: Transport-independent access flags) Sagi Grimberg
     [not found]                                                 ` <559F8881.7070308-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-10 16:35                                                   ` Jason Gunthorpe
2015-07-11 10:31                                                   ` 'Christoph Hellwig'
     [not found]                                                     ` <20150711103153.GC14741-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-13 16:46                                                       ` Jason Gunthorpe
     [not found]                                                         ` <20150713164652.GC23832-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-14  8:24                                                           ` kernel memory registration Sagi Grimberg
     [not found]                                                             ` <55A4C73A.7080001-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-14 17:24                                                               ` Jason Gunthorpe
2015-07-11 10:25                                             ` [PATCH V3 1/5] RDMA/core: Transport-independent access flags 'Christoph Hellwig'
2015-07-13 16:35                                               ` Jason Gunthorpe
2015-07-13 19:36                                               ` Tom Talpey
2015-07-13 20:15                                                 ` Jason Gunthorpe
     [not found]                                                   ` <20150713201538.GA11681-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-14  9:10                                                     ` Sagi Grimberg
     [not found]                                                       ` <55A4D20C.2000904-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-14 15:36                                                         ` 'Christoph Hellwig'
     [not found]                                                           ` <20150714153619.GC11026-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-14 15:47                                                             ` Tom Talpey
2015-07-14 16:22                                                             ` Jason Gunthorpe
2015-07-14  7:37                                                 ` 'Christoph Hellwig'
2015-07-14  9:22                                                   ` Sagi Grimberg
     [not found]                                                     ` <55A4D4C6.6040907-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-14 12:12                                                       ` Tom Talpey
2015-07-14 13:23                                                         ` Sagi Grimberg
2015-07-14 14:45                                                       ` Steve Wise
2015-07-14 15:40                                                       ` 'Christoph Hellwig'
2015-07-08  8:11                     ` 'Christoph Hellwig'
2015-07-06  7:58     ` Sagi Grimberg
     [not found]       ` <559A3536.3020807-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-06 14:39         ` Steve Wise
2015-07-05 23:22 ` [PATCH V3 2/5] RDMA/iser: Use transport independent MR allocation Steve Wise
     [not found] ` <20150705231831.12029.80307.stgit-PBeJgSbIpn97NCTnQtmixQ@public.gmane.org>
2015-07-05 23:22   ` [PATCH V3 3/5] RDMA/isert: " Steve Wise
2015-07-05 23:22   ` [PATCH V3 4/5] svcrdma: " Steve Wise
2015-07-05 23:22   ` [PATCH V3 5/5] xprtrdma: " Steve Wise
2015-07-06  5:25   ` [PATCH V3 0/5] Transport-independent MRs Christoph Hellwig
     [not found]     ` <20150706052542.GB1109-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-06 14:24       ` Steve Wise
2015-07-07  9:01         ` 'Christoph Hellwig'

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=20150708233604.GA20765@obsidianresearch.com \
    --to=jgunthorpe@obsidianresearch.com \
    --cc=bfields@fieldses.org \
    --cc=dledford@redhat.com \
    --cc=eli@mellanox.com \
    --cc=hch@infradead.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=oren@mellanox.com \
    --cc=roid@mellanox.com \
    --cc=sagig@dev.mellanox.co.il \
    --cc=sagig@mellanox.com \
    --cc=swise@opengridcomputing.com \
    --cc=target-devel@vger.kernel.org \
    --cc=tom@talpey.com \
    --cc=trond.myklebust@primarydata.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox