From nobody Sat Aug 08 21:52:03 2026 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hHZVr3xNGz6pKnq for ; Sat, 08 Aug 2026 21:52:20 +0000 (UTC) (envelope-from kib@freebsd.org) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4hHZVq2m3vz3T7J for ; Sat, 08 Aug 2026 21:52:19 +0000 (UTC) (envelope-from kib@freebsd.org) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=freebsd.org (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kib@freebsd.org) smtp.mailfrom=kib@freebsd.org Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 678Lq35l077975; Sun, 9 Aug 2026 00:52:06 +0300 (EEST) (envelope-from kib@freebsd.org) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 678Lq35l077975 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 678Lq3O9077974; Sun, 9 Aug 2026 00:52:03 +0300 (EEST) (envelope-from kib@freebsd.org) X-Authentication-Warning: tom.home: kostik set sender to kib@freebsd.org using -f Date: Sun, 9 Aug 2026 00:52:03 +0300 From: Konstantin Belousov To: Rick Macklem Cc: FreeBSD CURRENT Subject: Re: Fun with RDMA and NFS Message-ID: References: List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on tom.home X-Spamd-Result: default: False [-2.97 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.97)[-0.975]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : No valid SPF, No valid DKIM,none]; MIME_GOOD(-0.10)[text/plain]; TAGGED_RCPT(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[kib]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; HAS_XAW(0.00)[]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; R_SPF_SOFTFAIL(0.00)[~all:c]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Queue-Id: 4hHZVq2m3vz3T7J X-Spamd-Bar: -- On Sat, Aug 08, 2026 at 01:15:00PM -0700, Rick Macklem wrote: > Hi, > > As you all no doubt remember, in around 1986, Kirk proposed > something like this: > #ifdef notdef > /* Not Yet.. */ > if (uiop->uio_iov->iov_op != NULL) > (*(uiop->uio_iov->iov_op))(mbufcp, uiocp, xfer); > else > #endif > The idea was that iov_op would "copy" data without > actually doing a memory->memory copying. It never > happened, afaik. > > Well, after only 40years, it looks like NFS might be > able to do that. > > For example, with RDMA a Read will look something like: > - NFS VOP_READ() allocates a buffer cache block and > passes the pages (in b_pages[]) to the RPC code. > - The RPC code will map the pages into bus dma space > and make the RPC call (referring to the memory region > for these pages). (What ofed calls FRWR.) > On the NFS server... > - The server will allocate pages for the read reply data and > map those into bus address space. > It will make a VOP_READ() call to copy the data into these > pages. > The RPC code will get the NIC to copy the data from the pages > to the pages on the NFS client (the buffer cache block in the client > using that FRWR stuff) and then send a small RPC reply noting > the Read has completed. > A write would be similar, except the data is copied into the NFS > server's pages before the VOP_WRITE(). > > So, at this point, there is still a memory->memory copy done > in the exported file system's VOP_READ()/VOP_WRITE(). > > I think that it should be possible to implement a couple of > new VOP_xxx() calls to avoid this memory->memory copy. > VOP_PAGEIO() - Would return an array of pages with the > read data in them or where the data can be written into > them (it could just return a "struct iovec iov[]" > with the vm_page_t for each page in the iov_base entries). > Presumably the pages would be buffer cache or ARC or ?? > for the server file system. > VOP_DONE_PAGEIO() - Would be called once the transfer > is done to release the pages. > > Does this sound feasible? Yes, I think it is reasonable. Perhaps the following signature would be ok: int VOP_PAGEIO(struct vnode *vp, foff_t offset, size_t nbytes, enum uio_rw dir, vm_page_t ma[], int max_ma_len, int *ma_len); The VOP would return the ma array filled with the busied pages, which provide the file content from trunc_page(offset) to round_page(offset+nbytes). The twist there is that ma_len returns the number of pages that are actually filled into the ma array. For instance, for UFS, it is not feasible to fill more than a single buffer in time. From the first look, this is quite easy for UFS and tmpfs. If you want I can write the prototype. > > On the NFS client end, it should also be possible for O_DIRECT > to have the process's buffer mapped in, so that there is no > need for a buffer cache block. (This is more overhead than > the FRWR that can be used for kernel pages, but still might > be worth the effort.) But then we loose the cache coherency. Otherwise yes, vm_fault_quick_hold_pages() would provide the ma array for the user io buffer. The easiest example is probably kern/kern_physio.c. > > So, after years of procrastinating on this, I finally got prodded > to do this, thanks to Vinicius's NFS-over-RDMA server work. > > And, thanks to the Netperf folk, I now have a way of testing > NFS-over-RDMA code. (mike@sentex.net, bz@, pho@ > and others) > > Things that I thought others might be able to provide help with are: > - Creation of the above VOP_xxx() calls { call them whatever > you like } and implementation of them for UFS, ZFS, etc. > > - If you have servers with RDMA capable hardware, you could > "ibv_devinfo -v" and email me what it dumps out. (If it doesn't > find any configured IB devices, it might just need a driver loaded. > For example, Mellanox requires mlx5ib to be loaded. Not so sure > about Chelsio or Intel?) > This info is useful to me, since it tells me what capabilities I can > count on from the NIC, such as how many scatter/gather entries > it supports. > > Vinicius has done the server side of NFS-over-RDMA: > https://github.com/viniciusferrao/freebsd-src/pull/1 > and I am working on client side code. > - Testing. Although I haven't talked to Vinicius yet, I hope he can > set up a fork/branch of freebsd-src that has what he thinks others > should use for testing and keep that branch relatively up-to-date > with FreeBSD's main. > Once I get the NFS client code I am now testing working ok, I > plan on committing it to main. > --> Then Vinicius's fork/branch will pick it up and provide a place > where others can download sources for testing. > > Vinicius's code was created with AI usage, so it will be months > before I know if it can be pulled into main. If not, maybe it can > become a module in ports or ?? > (But please, please do not make this email thread an AI discussion;-) > > Just thought some of you might find this interesting and wanted > to thank those that have already provided assistance, rick > ps: Please let me know if you get working on the new VOP_xxx() > calls.