Appendix B: remote memory across hosts
What one-sided RDMA writes deliver in principle when the deadline crosses a physical host boundary, and a soft-RoCE lab that proves the verbs flow moves bytes correctly without claiming anything about its latency.
Learning objectives
By the end of this appendix you can:
- Name the four verbs calls a one-sided RDMA write chains together, and say which side’s CPU each one touches.
- Explain why SR-IOV passthrough is the only way to keep that one-sided property inside a virtualized guest, and why paravirtual networking or software RoCE both break it.
- Place RoCEv2, InfiniBand, PFC, and ETS on a diagram of what a real fabric needs to carry a lossless, prioritized RDMA flow next to ordinary traffic.
- Pick between raw verbs, libfabric or UCX, and SMC-R based on how much of an existing socket codebase you are willing to rewrite.
- Say exactly what a soft-RoCE demo proves, correctness of the verbs flow, and exactly what it cannot prove, anything about latency.
Diagram
Why this matters
“sharing memory between virtual machines” measured three ways for two guests on one host to hand a record to each other, and found a thousand-fold gap between the fastest and slowest. That gap existed because all three paths still shared one resource every distributed system must pay for: a single host’s own memory bus. Split the scanner and the decide service across two physical machines, the way a sortation line’s control plane often ends up split between a rack running the belt hardware and a rack running everything else, and shared memory stops being an option at any price. What the two sides share now is a wire.
RDMA is the answer a wire has to this problem: a NIC that can write
directly into a remote host’s pinned memory without asking that host’s
CPU to do anything at all. Properly deployed, it is the closest a
cross-host handoff gets to the zero-involvement property a shared-memory
ring gave two guests on one host. The catch is in that word “properly.”
The host rule this project holds everywhere else, no kernel change, no
sysctl, no sudo, no host hardware substitution, rules out every piece
RDMA actually needs: a physical RDMA-capable NIC, a second physical host,
SR-IOV virtual functions bound at the hypervisor, and a top-of-rack
switch configured for lossless, prioritized Ethernet. None of that exists
here, and none of it is a config file this project could carry even if
it did. This appendix explains what the RDMA hardware path delivers in
principle, and draws a hard line between that and the one thing actually
runnable here, a software verbs demo that proves correctness and says
nothing about speed.
One-sided verbs: the four calls that matter
RDMA’s verbs API exposes a small set of operations, and four of them carry the whole one-sided write.
ibv_reg_mrpins a range of a process’s memory pages so the kernel can never swap or move them, then hands back two things: anrkey, a token the far side will present to prove it is allowed to touch this region, and the region’s virtual address. Pinning matters because a NIC’s DMA engine writes bytes at a fixed physical address; a page that moved mid-transfer would corrupt the write or crash the process.- Rkey and address exchange happens once, at setup, over whatever side channel the two peers already have, a small TCP handshake, a connection manager session, or an out-of-band control message. After this exchange each side knows exactly where in the other side’s memory it is allowed to write or read.
ibv_post_sendwithIBV_WR_RDMA_WRITEqueues a work request on a queue pair telling the local NIC to push a buffer of bytes straight into the remoterkeyand address it was handed.IBV_WR_RDMA_READis the same operation in reverse, pulling bytes out of a remote buffer instead of pushing them in.- Completion polling on the initiating side’s completion queue is the only CPU involvement the whole operation needs, and it happens on the side that asked for the transfer, not the side that received it.
The remote side’s CPU never runs a single instruction for any of this. No interrupt fires, no context switch happens, and the kernel on that side is never scheduled in response to the write landing. That absence is the entire reason RDMA exists: every other way to move bytes between two hosts, a socket, an RPC call, a message queue, has to wake something up on the far side to receive them. A one-sided write removes that wakeup from the deadline path entirely, the same way a shared-memory ring removed the kernel from the data path between two guests on one host. What stayed deterministic there by avoiding a doorbell interrupt stays deterministic here by avoiding the remote CPU altogether.
Passthrough: why the guest has to drive the NIC directly
None of the one-sided property above survives being virtualized the
ordinary way. A guest talking to a NIC through paravirtual virtio-net
is talking to a software switch running on the host, which means every
packet crosses a hypervisor-mediated path with its own queueing, its own
scheduling, and its own CPU involvement on both ends. That path is fine
for a management connection; it defeats the entire point of RDMA for a
deadline the project’s conveyor-speed budget would actually enforce.
The fix is SR-IOV: the physical NIC exposes a set of Virtual Functions,
each a lightweight, nearly-complete copy of the device’s own register
set and queue pairs. A Virtual Function gets bound to vfio-pci on the
host and handed directly to one guest as a PCI passthrough device. From
inside that guest, the NIC driver, mlx5_core for a Mellanox-class
card, talks straight to its assigned queue pairs with no hypervisor
software in between. The guest’s ibv_post_send call reaches real NIC
hardware in one hop, the same as on bare metal.
Software RoCE, the rxe kernel module, takes the opposite approach: it
emulates the verbs API entirely in software, answering ibv_reg_mr and
ibv_post_send calls over an ordinary Ethernet NIC with no RDMA
hardware underneath. That emulation is useful for testing that a
verbs-based application’s logic is correct without RDMA hardware on
hand, which is why this appendix’s own demo uses it. It is also, by the
project’s own documentation, never the right choice for a real-time
path: every operation it answers runs through the normal kernel network
stack on an ordinary CPU, the same scheduling and interrupt exposure
RDMA exists to remove. Reaching for rxe in production because it is
easier to stand up than real hardware throws away the property that
made reaching for RDMA worth it.
Transport and priority QoS: what the fabric has to be configured to do
RDMA needs somewhere to run, and the two common choices carry the traffic differently. InfiniBand is a purpose-built fabric where losslessness and prioritization are native to the wire protocol. RoCEv2 is the far more common case in practice: it carries the same verbs semantics as ordinary UDP/IP packets over an Ethernet fabric a datacenter likely already owns, which is why most RDMA deployments outside dedicated HPC clusters choose it.
Carrying RDMA over Ethernet means Ethernet has to start behaving like a fabric that does not drop packets, because the verbs layer above it assumes it won’t. A few pieces make that true:
A Service Level or traffic class assigned to the RDMA flow maps onto an 802.1p priority code point in the Ethernet frame’s VLAN tag, or a DSCP value in the IP header, so every switch and NIC along the path can tell this traffic apart from everything else on the link. Priority-based Flow Control, IEEE 802.1Qbb, pauses only that one priority when a switch’s buffer for it fills, instead of pausing the whole link the way classic Ethernet flow control does, so other priority classes keep moving while the RDMA priority is briefly held back. Enhanced Transmission Selection, IEEE 802.1Qaz, guarantees each priority class a minimum share of a shared link’s bandwidth, so an RDMA class holds its lane even under saturation. On the NIC side, a deployment typically carves out a dedicated, high-priority queue pair for the real-time transfer and a separate bulk queue pair for anything deprioritized, and a hypervisor hosting several tenants on one port can rate-limit each Virtual Function so one guest cannot starve another.
Every one of these is a configuration change to a physical NIC and a physical top-of-rack switch, not a file this project’s software touches. None of it is attempted here, named for what a real deployment needs and left there.
Software tiers: picking the right altitude
Three layers sit between an application and the verbs calls above, and each trades control for ease of adoption.
libibverbs and librdmacm are the lowest tier and the one this appendix’s demo calls directly: the raw verbs API with nothing added, the lowest latency available and the most code an application has to own itself, queue pair setup, memory registration, completion polling, all of it.
libfabric (the OpenFabrics Interfaces) and UCX sit a layer above: both abstract several transports, verbs among them, but also TCP, shared memory, and vendor fabrics, behind one portable API. MPI implementations and HPC frameworks reach for this tier so the same code runs over whatever fabric a given cluster offers, at a small cost in control compared to driving verbs by hand.
SMC-R (RFC 7609) sits highest and asks the least of an application:
it intercepts ordinary AF_INET socket calls at the kernel level and
transparently moves the data over RDMA when both ends support it,
falling back to plain TCP when they don’t. An existing socket-based
service gets some of RDMA’s benefit with no code change at all, at a
real cost in how much control the application keeps over the transfer.
Reach for raw verbs when a service is purpose-built around a deadline. Reach for libfabric or UCX when the same code has to run over more than one kind of fabric across different deployments. Reach for SMC-R to retrofit an existing socket-heavy service for some of RDMA’s benefit without rewriting it.
The soft-RoCE demo
What actually runs in this lab is rxe, software RoCE, bound to an
ordinary virtio network link between two throwaway KVM guests. Each
guest registers a memory region, the two exchange rkeys and addresses
over a short TCP handshake, and the sender posts an IBV_WR_RDMA_WRITE
work request carrying a known payload into the receiver’s pinned buffer.
The receiver’s own process then reads that buffer back and compares it
against the payload the sender meant to send.
What this proves: the verbs flow is correct end to end. Memory registration, rkey exchange, the write itself, and completion polling all ran and landed the right bytes at the right address, with the receiving guest’s CPU never issuing a receive call for the transfer itself, only checking the result afterward.
What this does not prove: anything about how fast real RDMA is. rxe
answers every verbs call by walking an ordinary kernel network stack on
an ordinary CPU; whatever round trip this demo reports is a software
emulation artifact, not a NIC’s DMA engine at work, and treating it as a
stand-in for hardware RDMA latency would be a worse mistake than not
measuring latency at all. The implementation lives at
examples/13-rdma-remote-memory.
Build, run, observe
This demo runs on the two-guest KVM lab; the
Lab setup page has the prerequisites
and one-time steps. No RDMA hardware and no host packages are needed: each
guest installs rdma-core, the RDMA development libraries, gcc-c++, and
the rxe module itself at first boot, and the one-sided write program is
C++23, compiled inside the guests.
cd examples/13-rdma-remote-memory && ./demo.sh provision && ./demo.sh run
provision boots the two guests and loads rxe on each; run compiles
the C++ program in each guest, then performs the memory registration, the
rkey exchange, the write, and the byte-for-byte comparison, printing a
single confirmation that the bytes the receiver read back matched what the
sender wrote. That bytes-matched line is the only result worth reading
here: no latency figure accompanies it, because none would mean anything
about the hardware path this appendix describes. The pure fill-and-verify
pattern the two sides agree on has its own host test, run with no VM:
ctest --preset default -R RdmaPattern.
Trade-offs and where this goes next
Reach for the real hardware path, SR-IOV passthrough into a guest, a RoCEv2 or InfiniBand fabric, PFC and ETS configured end to end, when a deadline crosses two physical hosts and the CPU-uninvolved property that mattered inside one host’s shared memory still has to hold once that memory bus is gone. That path needs hardware and fabric configuration this unprivileged, single-host project cannot carry, which is why it is described here rather than built.
The same SR-IOV passthrough architecture maps directly onto OpenShift Virtualization and KubeVirt, where a virtual machine running as a cluster workload can still claim a Virtual Function through a device plugin and keep the same one-sided path a bare KVM guest gets here; that mapping belongs to a later appendix, named and not built in this one.
Past RDMA sits one more path to name: DPDK’s vhost-user transport over shared hugepages, which hands a guest or process a user-space packet ring straight to a poll-mode NIC driver, bypassing the kernel network stack on both ends for raw packet throughput rather than the sub-microsecond latency one-sided RDMA targets. It solves a different problem than the one this appendix describes and is named here for contrast, not measured.
What you learned
- A one-sided RDMA write chains
ibv_reg_mr, an rkey and address exchange,ibv_post_sendwithIBV_WR_RDMA_WRITEorIBV_WR_RDMA_READ, and completion polling, and the remote CPU never runs an instruction for any of it. - SR-IOV Virtual Functions bound to
vfio-pciand passed through to a guest are what let that guest drive a NIC’s queue pairs directly; paravirtual networking and software RoCE both reintroduce a CPU-and-kernel hop the one-sided design exists to remove. - RoCEv2 over Ethernet needs real fabric work to stay lossless and prioritized: an 802.1p or DSCP marking, PFC (802.1Qbb) to pause only the RDMA priority under congestion, and ETS (802.1Qaz) to guarantee that priority a bandwidth share, none of it attempted in this lab.
- Raw verbs, libfabric or UCX, and SMC-R sit at three different altitudes, trading control for how much of an existing codebase has to change to use them.
- A soft-RoCE demo proves a verbs flow transfers bytes correctly with
the remote CPU uninvolved; it proves nothing about latency, because
rxeanswers every call in kernel software, not on RDMA hardware.
For deeper coverage
- “libibverbs” man pages (
ibv_reg_mr(3),ibv_post_send(3), rdma-core project): the verbs calls the one-sided write and the demo both build on. - InfiniBand Trade Association, RoCEv2 specification: the Ethernet encapsulation of RDMA verbs named as the common transport choice.
- RFC 7609, SMC-R: the socket-transparent RDMA protocol named as the highest software tier in the survey.
Full citations, with links, are in the bibliography.