From nobody Sun Aug 09 00:03:56 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 4hHdR35KJmz6pZYM for ; Sun, 09 Aug 2026 00:04:15 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hHdR304RFz3mRP for ; Sun, 09 Aug 2026 00:04:15 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-6a10d02ff43so1046750a12.0 for ; Sat, 08 Aug 2026 17:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1786233848; cv=none; d=google.com; s=arc-20260327; b=Ae+XD9YTMnbLzc7e609iUh7kKuALtvsXvNDcEdKJaGCc3tCP9nH2VYXom19i4bVFzN raXtzZVIzA3DOaJUSGBKX/s07lsBMjKs5+A3qT13x/+0NOJiYhRj5E4mbcIpv3CKLBom LRJBPv4S3nSXrbnqJYyax73wK12JN9GzX+HKuyZ0/N1NwY+MlGpQ4Ija1yG1JZsMf2sY xhH5ccpuGoN5UGnAJgrr91Va4r6wDK99Abc/rNy12kh8bxx+p76eLaxJoKwhaErgCaPx +Yy/+ap22kJ/tQzQdXOZ7pTWSM7oibP2M8h2yCw30QkAWyH9xQ5LcmK6SHj5sYjL7Nuh pi8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vi5yKlrAOR58Tv+WO0+YYGZztJaOwJHQYk0ouA0M6rg=; fh=1J9EScHdNbcrj9tYChbg87kmeBEtJPYbJNWUjhxlpSA=; b=QZkrmtF2EbfdhjwQ103gJZpu0IXUP3hh0AtFoQ4eGJR59BCijfdeMd+Yi2Uk/oRblc k382NVExXqT4ck0UwwHQNUbi71mgDH34LizKXQ8D+p9CrSR82pnTagZdzZ8ArCCoUR40 YS+a9Uzbw3pXE2R9aVle+nomwXRarAhBwjPSK3J4f5O17wFD0lJboG5HjommUNPXK0k9 1zIViXFdoxJqCy3RykTgCF5L/2RExT5ZdDj5FJIUYXKB2sS19p4HkCMG+mLaifRiepaW tXEqIkvcNQwwt7X7VD7bmr5VxpafqLdqh1ovw+wk9epEtxZxDYBx43AD503JpjTLgl8h BYMw==; darn=freebsd.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786233848; x=1786838648; darn=freebsd.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=vi5yKlrAOR58Tv+WO0+YYGZztJaOwJHQYk0ouA0M6rg=; b=gkQkPfdfqxk7yrKV+9EiS+32bxXBbu4X9lhCH053sxNL2Bb8cnZbPMjA7QciuIc1gv 81CC9Cwre1kxKGCsKpDbCcGPGEQ8e/E9ZIGnqYCkDL8So0bKpKh/bJvrEZz8CA1Dvsrz lzWbLk+YQD5wAIG/XBVLXy6b/HKsD/jkCA0UhXVMAj45Sw86dsvrvT5KuksyP3kpE6I0 ML1GrkYgg9AIpkuubPSFX275ObVZMmoH1nKKqGXqvxPSlFNUPAp+e2kO0G3xP7nr5FkS JnGK2QtOhG3gl2/f8lOlFV0UTXA2OrAB0XMN+URu6hRVZVAHvvTY1IRJnem+OlTj9adm ipAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786233848; x=1786838648; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=vi5yKlrAOR58Tv+WO0+YYGZztJaOwJHQYk0ouA0M6rg=; b=CdHeMkBR4KrqUlh7f9tFoKS4slxj85lMIQ8p8EhapUTjoW507AJoVOsReEiGQZcQwN 88LBxYYQSP79zV5nmKagtS5BsLc0CHxEnqzGcYwbuAiDR6ShBWkhqjr7uG51YSx6DKSK gPu0ILaW1ffhkQLmuSoD4450PA5wHc2GiHEorn7z7a5uSD/A/aV17WZu06Edgvsg03pI BDbiHfzEcMij/B8WqwY5Xj9kAd58cIp5nmWePsN1pVIn1lpf/GqQkU9KvY+34ngc6DWH 9hdZ/q96Jtc6aXe3pojM0xYEl9fVrSGktmmvh3XC2lxtZM4Yq6u+DYsha++mLr3dpXRb hDPQ== X-Gm-Message-State: AOJu0YwHDjFygHVmH42ehpeDganGFRsgIVi0cj5yyBk1Grtf89/eyRxK fORLW9aCCUuLFQMU7dC0ZkYYkqhiFEVRcdfYF55lKTBrcQIp3S6Jkkljm020ge9yJ3aNQ7pW9tO 0XYm/nRwaJLEWq2QLbkpO3RlHNhV0S8ek X-Gm-Gg: AR+sD10Iws0h/CAuhxA3lhgjT/rOuM1AzpC/9xcGNnrsA3TebvGJdA5AlQYewMK35iu ySVpf+yfp7dqc12DPVf4KG8yuNUbfv793AZ3ztLIyYovlY5Mry0yuhCNzh8NxNWzcpO06G03XCn DbNKKch8lO8q2KlsZnGazmckjhGCyKS5iBsD+hpmz/LVbQrxq2d2QaNkKYaeC30KT48lUoLhvIN 9v8GmmnNVVwux2v0BsHK/oJr3uj4VrLMoru9Txc4Yztn55asvwUFG4P0jwflcQUQAB0w5r8E8UB 8K+Sc51O9qeGvcC0ZOtiKG/W0wlUtPb8tZcSks/UnzJ8w16HIrZQnTaQvVtIZ+sYD33hcTfB+L0 LH7Mb5C8snDI= X-Received: by 2002:a05:6402:3908:b0:698:ac8a:9a21 with SMTP id 4fb4d7f45d1cf-6a14f0db241mr15719448a12.8.1786233848313; Sat, 08 Aug 2026 17:04:08 -0700 (PDT) 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 References: In-Reply-To: From: Rick Macklem Date: Sat, 8 Aug 2026 17:03:56 -0700 X-Gm-Features: AUfX_mzf4VoGOyfdGbJwJoDg4LhYHagH6uL_6LAkd5-1UGWflw6y57J4XppsKWM Message-ID: Subject: Re: Fun with RDMA and NFS To: Konstantin Belousov Cc: FreeBSD CURRENT Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4hHdR304RFz3mRP X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Spamd-Bar: ---- On Sat, Aug 8, 2026 at 2:53=E2=80=AFPM Konstantin Belousov wrote: > > 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 !=3D 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+nby= tes). > > 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. Sounds fine to me. No rush, it'll be a while before I get through initial testing and, since that is the server side, I won't be looking at it until after that. > > > > > 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. I'm not worried about O_DIRECT, at least for now. It currently works through the buffer cache by default, and that should work the same as without O_DIRECT (except when the read and write RPCs are done). (To be honest, my current prototype code just refuses to allow RDMA mounts when newnfs_directio_enable (the sysctl variable) when it is set. It is 0 by default. Thanks, rick > > > > > 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. >