Skip to content

feat(nix): rocm-ernic pinned upstream, nix/ernic layer, ionic NICs in the golden VM - #335

Merged
randomizedcoder merged 25 commits into
mainfrom
feat/rocm-ernic-nics
Nov 25, 2026
Merged

randomizedcoder merged 25 commits into
mainfrom
feat/rocm-ernic-nics

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

Implements docs/design-rocm-ernic-nics.md phases 0–4: rocm-ernic pinned to upstream, a modular nix/ernic/ layer, and the golden-record VM carrying ionic NICs beside its virtio and e1000e NICs.

Pin

  • rocm-ernic now pins upstream ROCm/rocm-ernic@bd902345 (develop, #600) by rev and narHash; every fork feature xtcp2 used is upstream.
  • nix/upstream-pins.json records it; checks.ernic-pin (table test) and checks.upstream-pins require manifest, flake.nix and flake.lock to agree.
  • vm-linkmonitor-ionic, -ionic-faults and rdma pass unchanged on the upstream pin.

nix/ernic/

  • default.nix: one attrset (server, run, runMany, guestModule, profiles, nics) imported once in nix/default.nix.
  • nics.nix: NICs as data → QEMU vfio-user-pci args (relative sockets), server args, guest .link/.network (no IPv6 RA, LLDP, LLMNR or mDNS). checks.ernic-nics.
  • run-many.nix → ernic-run-many: one server per NIC, TAPs and a bridge in an unprivileged user + net namespace; the command stays in the caller's namespace. checks.ernic-run-many with a fake server.
  • profiles/golden-uplink.ini: 100000 Mb/s, fw xtcp2-golden-1.0, 2 eth queues.

Golden VM (phase 3)

  • ionic0 is uplink 1 (metric 512), e1000e stays uplink 2 (2048), virtio keeps SLiRP at 4096 and leaves the uplink columns.
  • coverage.json requires uplink1 ionic 7640/4098, 100000 Mb/s and fw populated; 7_3_1 recaptured.

Deterministic loss over ionic (phase 4)

  • ionic1 in netns golden-ernic-b; one 4 MiB echo per bulk algorithm over ionic0, whose emulator drops every 50th transmitted frame (ionic1 every 64th received).
  • ROWs: ernic_loss, ernic_egress, fault_count (drops = (tx_packets + tx_dropped) / 50, exact in every capture), no_noise.
  • Measurement (five captures): drops are exact per frame, TCP counters are not (data/ACK interleaving varies), so no column left lossyColumns; ionic rows are fault rows in xtcp2-golden diff (Options.FaultNetns/FaultEgress).
  • Noise removed from the fault counters: LLMNR IGMP reports, timesyncd NTP polls via ionic0's default route.

Also

  • lossyColumns gains listener drops (SYN retransmitted after netem drops the SYN-ACK; net/ipv4/tcp_ipv4.c discard_and_relse), rqueue and receive memory.
  • golden-loc-a pings each hop before dialing (a SYN waiting on neighbor discovery was retransmitted in one capture).

Red first

  • checks.ernic-pin, ernic-nics, ernic-run-many: failed to evaluate before their implementations; the LLMNR row: attribute 'LLMNR' missing.
  • Phase 3 capture before the NIC change: uplink1_ionic FAIL ens4,virtio_net,6900,1, virtio_not_uplink FAIL 170 rows, nic_speed FAIL 10000,1000, fw_from_profile FAIL (empty); other 24 PASS.
  • Phase 4 capture before the workload: ernic_loss FAIL 0 of 4, ernic_egress FAIL 0:, fault_count FAIL tx_dropped 0, no_noise FAIL missing; other 28 PASS.
  • TestLossyColumns/TestFaultColumns/TestDiff fault rows: failed to compile before diff.go.

Verification

  • Final tree: three golden captures, 32 ROWs PASS each, pairwise xtcp2-golden diff exit 0; xtcp2-golden check passes.
  • go test ./...; checks gofmt, go-vet, nix-fmt, lint-baseline, golangci ×3, redteam-lint, golden-records, test-fuzz-all, ernic-pin, ernic-nics, ernic-run-many, upstream-pins: all pass.

Open (in the doc's Status)

  • netem pair: in some captures one bulk direction shows almost no loss (0–10 retransmits of ~3500 segments), so loss_seen occasionally fails; seen before any ernic workload. loss_seen now prints per-client state/segments/bytes to chase it.
  • One capture in five saw one frame reach ionic1 from the fabric before the transfers (source unknown); no_noise reports it but requires only ionic0's transmit site.

🤖 Generated with Claude Code

randomizedcoder and others added 25 commits November 24, 2026 23:35
How xtcp2 uses the emulated ionic NIC today, the plan to pin
ROCm/rocm-ernic by rev and narHash, a data-driven nix layer for ernic
NICs, and VMs carrying virtio, e1000e and ionic NICs together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows over the real files and edited copies: the input must be
ROCm/rocm-ernic with one rev and one narHash in flake.nix, flake.lock
and nix/upstream-pins.json. Red: nix/lib/ernic-pin.nix does not exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- flake.nix declares github:ROCm/rocm-ernic at bd902345 with its narHash
  (was the fork's xtcp2-integration branch; every feature it carried is
  now upstream)
- nix/ernic: one attrset (server, run, rdmaErrors, guestModule,
  profiles); the ionic checks take it instead of reaching into the input
- nix/lib/ernic-pin.nix: flake.nix, flake.lock and upstream-pins.json
  must agree on rev and narHash and name ROCm/rocm-ernic; used by
  checks.ernic-pin and checks.upstream-pins
- upstream-pins.json: rocm-ernic on develop, for check-upstream-pins

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows for nix/ernic/nics.nix: the JSON vfio-user-pci device with a
relative socket, server args in order, guest .link/.network by MAC,
unique names/slots/MACs, ifname rules, empty and unmanaged NICs, and
bridges. Red: nics.nix does not exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
problems, qemuArgs (JSON vfio-user-pci with a relative socket, since
microvm.nix escapes extraArgs), serverArgs, bridges and guestConfig
(ionic driver, .link by permanent MAC, .network with no link-local,
DHCP or LLDP so fault counters see only the workload). checks.ernic-nics
is green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows: every socket before the command, exit status and cwd, early and
late server exits, a stale socket, no NICs, TERM cleanup, and the
command staying in the caller's netns. Red: run-many.nix does not exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- run-many.nix: one rocm-ernic server per NIC around a command, in an
  unprivileged user+net namespace with TAPs, bridges and permanent
  neighbors when any NIC has a TAP; the command (QEMU) stays in the
  caller's namespace and runs in --dir, where the relative sockets are
- fails on a server exit before its socket or during the command, and
  stops everything on EXIT/INT/TERM
- profiles/golden-uplink.ini: fixed fw_version and 100G, 2 eth queues
- nix/ernic exports nics, runMany and ownProfiles
- the T2 fake now parses relative sockets, and its rows tolerate errexit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A NIC with network = null must get an Unmanaged .network, or NixOS's
99-ethernet-default-dhcp runs DHCP on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
checks.ernic-nics is green again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
uplink1_ionic (ionic0, ionic, 1dd8:1002, bus set), virtio_not_uplink,
nic_speed now 100000/1000, and fw_from_profile. Red until the golden VM
carries the rocm-ernic NIC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A SYN retransmitted after netem drops the SYN-ACK reaches the pending
request socket; tcp_check_req resends the SYN-ACK and the segment is
counted as a drop on the listener (net/ipv4/tcp_ipv4.c tcp_v4_rcv,
discard_and_relse). One of two captures showed it on golden-bulk-b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One capture saw 3 of 4 bulk clients with retransmits; the row now names
each client's algorithm and count so a repeat shows which one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ionic0 (golden-uplink.ini: 100000 Mb/s, fw xtcp2-golden-1.0) is uplink 1
  at route metric 512; e1000e stays uplink 2 at 2048; virtio keeps SLiRP
  for management at 4096, so it is no longer an uplink.
- ionic1 shares br-ernic with ionic0 in ernic-run-many's user + network
  namespace (unmanaged for now); QEMU stays in the caller's namespace.
- The golden runner starts microvm-run under ernic-run-many-golden in
  $STAGE/ernic, so the relative vfio-user socket paths resolve there.
- coverage.json: uplink1 ionic, 7640/4098, 100000 Mb/s, fw populated
  (scrubbed as host identity; the guest's fw_from_profile row checks the
  value). 7_3_1 recaptured; two captures diff clean, 28 ROWs PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ernic_loss, ernic_egress, fault_count and no_noise check a 4 MiB echo
per BULK_CC algorithm from the root namespace to golden-ernic-b over
ionic0, whose emulator drops every 50th transmitted frame (ionic1 every
64th received). The faults are in golden-ernic.nix; the workload is not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The golden capture saw ionic0 send 5 IGMP reports before any transfer:
systemd-resolved joins 224.0.0.252 (LLMNR) on every link with an address,
and the reports land on the emulator's fault counters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ionic1 moves into golden-ernic-b (10.0.4.16-17); one 4 MiB echo per
  BULK_CC algorithm runs from the root namespace over ionic0, whose
  emulator drops every 50th transmitted frame (ionic1 every 64th received).
- Static neighbors, IPv6 off and segmentation offloads off on both ends,
  and IPv6 off in ernic-run-many's fabric namespace, so each drop is one
  MTU frame and nothing but the transfers reaches the fault counters.
- ROW fixes: root rows are netns 'default'; the emulator's tx events are
  tx_packets + tx_dropped (290 of 14512 = every 50th, exactly);
  golden-ernic-b has an nsid since ionic1 moved there from the root.
- The workload logs ionic0's counters and groups before it touches it
  (GOLDEN_ERNIC_BEFORE), which found the LLMNR IGMP reports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows in golden-ernic-b, or out of ionic0, carry rocm-ernic's injected
drops. Five captures show their retransmit and recovery counters flip
between runs, as netem's do, plus the servers' retransmits (the drops
are of ACKs, so a server retransmits only on an RTO). rqueue also moved
on a netem and an ionic row: echoed bytes still unread at the poll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows in golden-ernic-b or out of ionic0 skip the lossyColumns plus the
servers' retransmit counters (Options.FaultNetns/FaultEgress); rqueue and
receive memory join lossyColumns. Captures 3-5 of five then diff clean
pairwise; capture 2 differs only on a netem flow that saw no loss.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- timesyncd off in the golden VM with ernic: the default route is
  ionic0's, and its NTP polls (with the gateway ARP) landed on the fault
  counters in 3 of 5 captures.
- no_noise requires ionic0's transmit site at 0 and reports ionic1's
  receive count: one capture in five saw one frame reach ionic1 from the
  fabric before the transfers.
- golden-loc-a pings each hop before dialing: a SYN waiting on neighbor
  discovery at golden-loc-b was retransmitted in one capture.
- loss_seen prints each client's state, segs_out and bytes_acked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three captures of the final tree: 32 ROWs PASS each, pairwise diff clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@randomizedcoder
randomizedcoder merged commit 25bbd36 into main Nov 25, 2026
1 check passed
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.

1 participant