Skip to content

Add RDMA sysfs topology construction for gVisor sandboxes#13712

Open
ayushr2 wants to merge 1 commit into
google:masterfrom
ayushr2:rdma-sysfs
Open

Add RDMA sysfs topology construction for gVisor sandboxes#13712
ayushr2 wants to merge 1 commit into
google:masterfrom
ayushr2:rdma-sysfs

Conversation

@ayushr2

@ayushr2 ayushr2 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Containers with /dev/infiniband/uverbs* devices need a sysfs surface for
device discovery: libibverbs enumerates /sys/class/infiniband_verbs, and
NCCL builds its hardware topology by resolving /sys/class symlinks with
realpath() and walking the PCI hierarchy.

This adds a --rdmaproxy flag which will gate all RDMA support. For now it
only wires up the sysfs topology: runsc snapshots the host sysfs closure
derived from the spec's uverbs devices (ibdevs, netdevs, PCI ancestor
chains, GPU functions, NUMA nodes) before pivot_root, and the sentry
constructs a path-identical virtual tree: one canonical /sys/devices/pci...
subtree per device, with /sys/class/* and /sys/bus/pci/devices as symlink
farms matching the kernel layout. Per-port dynamic state (RoCE GID tables,
link state, counters) is served live through targeted read-only bind mounts
of the per-ibdev ports subtrees; identity and PCI attributes are a static
snapshot, since the collecting process and the constructed sandbox tree do
not observe the same sysfs mount (the RDMA netdevs move into the sandbox
network namespace only after the sandbox is created).

Each PCI function directory also gets a subsystem symlink into a
synthesized /sys/bus/pci, and every node's bus gets a pci_bus entry: NCCL
classifies a directory as a PCI device by following its subsystem symlink,
and aborts topology discovery without it.

The verbs device proxy that makes RDMA usable end-to-end is not part of
this change; --rdmaproxy is a work in progress and RDMA is not yet
functional.

Co-authored-by: Alessio Ricci Toniolo alessio@modal.com

@ayushr2

ayushr2 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

cc @trantoji @TheCoolDinosuar

This replaces #13297, #13312 and #13318.

@ayushr2

ayushr2 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

AI Usage disclaimer: I did use Claude Code to help me with this patch, but:

  • I have reviewed every line and iterated a whole bunch of times
  • The long comments are actually authored by me, I think they're useful
  • I have tested this (along with rdmaproxy patches) on H200 machines and it works. Now, NCCL is able to discover host device topology in gVisor. Earlier patches were failing to do so and we had been working around it by using INCLUDE_NCCL_TOPO=1 and manually providing the topology XML generated using a runc container. So this patch set should be more correct.

Containers with /dev/infiniband/uverbs* devices need a sysfs surface for
device discovery: libibverbs enumerates /sys/class/infiniband_verbs, and
NCCL builds its hardware topology by resolving /sys/class symlinks with
realpath() and walking the PCI hierarchy.

This adds a --rdmaproxy flag which will gate all RDMA support. For now it
only wires up the sysfs topology: runsc snapshots the host sysfs closure
derived from the spec's uverbs devices (ibdevs, netdevs, PCI ancestor
chains, GPU functions, NUMA nodes) before pivot_root, and the sentry
constructs a path-identical virtual tree: one canonical /sys/devices/pci...
subtree per device, with /sys/class/* and /sys/bus/pci/devices as symlink
farms matching the kernel layout. Per-port dynamic state (RoCE GID tables,
link state, counters) is served live through targeted read-only bind mounts
of the per-ibdev ports subtrees; identity and PCI attributes are a static
snapshot, since the collecting process and the constructed sandbox tree do
not observe the same sysfs mount (the RDMA netdevs move into the sandbox
network namespace only after the sandbox is created).

Each PCI function directory also gets a subsystem symlink into a
synthesized /sys/bus/pci, and every node's bus gets a pci_bus entry: NCCL
classifies a directory as a PCI device by following its subsystem symlink,
and aborts topology discovery without it.

The verbs device proxy that makes RDMA usable end-to-end is not part of
this change; --rdmaproxy is a work in progress and RDMA is not yet
functional.

Co-authored-by: Alessio Ricci Toniolo <alessio@modal.com>
}
if len(rdmaDirs.busPCIDevices) > 0 {
if idata.EnableTPUProxyPaths {
return nil, nil, fmt.Errorf("cannot enable both TPU proxy paths and RDMA sysfs")

@atoniolo76 atoniolo76 Jul 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that TPUProxy must be disabled when RDMAProxy is enabled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants