Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
80e5234
docs(rocm-ernic): plan round 3, the two golden flakes and a one-way s…
randomizedcoder Nov 27, 2026
484ea3f
fix(golden): idle sockets use a 1 h keepalive, so no probe is in flig…
randomizedcoder Nov 27, 2026
ebb1851
test(tools): tcp_server -discard and tcp_client -bulkOneWay (red)
randomizedcoder Nov 27, 2026
d89b25b
feat(tools): tcp_server -discard and tcp_client -bulkOneWay, a one-wa…
randomizedcoder Nov 27, 2026
df24381
test(goldenrec): the sequence flow's namespaces are compared (red)
randomizedcoder Nov 27, 2026
74f6ff8
fix(goldenrec): compare the sequence flow's rows, now that it is one-way
randomizedcoder Nov 27, 2026
c138d24
feat(golden): the sequence flow is one-way, so its retransmits equal …
randomizedcoder Nov 27, 2026
e3aebc4
test(golden): netem rows compare xtcp2's retransmits with the kernel'…
randomizedcoder Nov 27, 2026
835d459
docs: golden keepalive, netem kernel rows and the one-way sequence flow
randomizedcoder Nov 27, 2026
a34d2e1
fix(golden): netem_kernel_agrees joins both sides with commas, as q s…
randomizedcoder Nov 27, 2026
db02741
test(goldenrec): a narrow exemption for the sequence flow's rwnd_limi…
randomizedcoder Nov 27, 2026
99662fa
fix(goldenrec): exempt only rwnd_limited in the sequence flow's rows
randomizedcoder Nov 27, 2026
338815a
test(golden): recapture the fixture: idle sockets no longer count kee…
randomizedcoder Nov 27, 2026
918a5fa
docs(rocm-ernic): round 3 status
randomizedcoder Nov 27, 2026
ba1a1eb
docs(rocm-ernic): round 3 status counts the first capture's formattin…
randomizedcoder Nov 27, 2026
48846ef
refactor(goldenrec): name the rwnd_limited column (goconst)
randomizedcoder Nov 27, 2026
8321e89
docs(rocm-ernic): round 3 status notes the checks that fail on main too
randomizedcoder Nov 27, 2026
eae0479
fix(golden): keep dctcp's ECN through a lost SYN; more netem detail
randomizedcoder Nov 27, 2026
b8c2030
docs(ernic): round 3 status after the 20-capture netem hunt
randomizedcoder Nov 27, 2026
be62c63
docs(ernic): round 3 does not close loss_seen; how to make the next o…
randomizedcoder Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- **Socket options on the traffic tools.** `tcp_client` and `tcp_server` take `-cong`, `-tos`, `-priority`, `-rcvbuf`, `-freebind`, `-transparent` and `-bindNoPort`, and `tcp_client` takes `-bulk`, `-close` and `-halfclose` (`tcp_server -holdEOF` holds the other end), so a test workload can give the collector sockets with a chosen congestion algorithm, TOS, class_id, window scale, sockopt bits and TCP state. The OCI image passes `TCP_CLIENT_ARGS` / `TCP_SERVER_ARGS` through ([integration testing](docs/integration-testing.md#tcp_server--tcp_client--socket-population)).
- **Golden records cover the fleet's columns.** The capture workload adds four netns pairs: one connection per congestion algorithm the kernel offers (IPv4 and IPv6; every `tcp_*` module is loaded), bulk transfers over netem loss and reordering, TOS/traffic class, priority, the sockopt bits and three window scales, and TIME_WAIT, SYN_SENT, FIN_WAIT2 and CLOSE_WAIT sockets in exact numbers. Three MTUs give three pmtu/MSS pairs. `coverage.json` requires the per-algorithm info structs, the loss counters, the new states and values, and every algorithm in the capture's `cong_available`. `ROW` lines on the VM console check each pair ([Golden records](nix/README.md#golden-records)).
- **Golden records cover NICs, locality and ASN.** The capture VM gains a second uplink (an emulated e1000e) and a 10000 Mb/s virtio NIC, and the collector enriches locality and ASN against an artifact built from documentation prefixes. A netns trio gives one connection per locality (self, subnet, remote over IPv4 and IPv6). `coverage.json` requires the uplink 2 columns, the NIC speeds, localities 1–3, the ASN, owner and egress columns, and the bound interface name.
- **Golden records: no flaky keepalive probe, exact loss rows, a one-way sequence flow.** Idle golden sockets use `-keepalive 1h`, so a poll no longer catches a probe in flight. New rows `netem_retrans_a`/`_b` require xtcp2's sum of `total_retrans` to equal each netem namespace's `TcpRetransSegs`, and `netem_kernel_agrees` each bulk client's to equal `ss`'s; the bulk clients wait 30 s to connect, so a dropped SYN no longer closes a socket, and golden-bulk-a turns off the ECN fallback, so a dropped SYN no longer turns dctcp into dctcp-reno (new row `bulk_dctcp_ecn`). The sequence flow is one-way (new `tcp_server -discard` and `tcp_client -bulkOneWay`), so its retransmits must equal the 12 drops, and `xtcp2-golden diff` now compares its rows ([design](docs/design-rocm-ernic-tests.md#round-3-close-the-two-golden-flakes-strict-diff-on-the-sequence-flow)).
- **Golden records check the emulated NICs against xtcp2.** After a capture, the runner stops the rocm-ernic servers cleanly and `ernic-oracle` (`checks.ernic-oracle`) compares their own fault counts with the guest's NIC counters. It also compares the frames each NIC sent or delivered with the `tcp_info_segs_out` and `segs_in` xtcp2 recorded, which must be exactly equal. A third and fourth ionic NIC carry one cubic flow through a fixed drop sequence (12 drops). The ernic transfers turn TCP keepalive off (new `-keepalive` flag on `tcp_client` and `tcp_server`), and the emulator's bridges turn multicast snooping off, so no frame outside the transfers reaches the counters. `ernic-run-many --pcap IFNAME` records a fabric interface ([design](docs/design-rocm-ernic-tests.md)).
- **Golden records on an emulated ionic NIC.** The capture VM's uplink 1 is now an AMD Pensando ionic NIC emulated by [rocm-ernic](https://github.com/ROCm/rocm-ernic) over vfio-user (PCI 1dd8:1002, 100000 Mb/s, firmware from an xtcp2 NIC profile); e1000e stays uplink 2 and virtio is kept for management. The `rocm-ernic` input now pins upstream `ROCm/rocm-ernic` by rev and narHash, recorded in `nix/upstream-pins.json` and checked by `checks.ernic-pin` and `checks.upstream-pins`. `nix/ernic/` describes NICs as data (`checks.ernic-nics`) and runs one server per NIC with `ernic-run-many` (`checks.ernic-run-many`). A second ionic NIC in netns `golden-ernic-b` carries one 4 MiB transfer per bulk algorithm with the emulator's deterministic drops (every 50th frame); `ROW` lines check the drop count exactly, and `xtcp2-golden diff` treats those rows like the netem pair's (`Options.FaultNetns`, `FaultEgress`). Listener drops, `rqueue` and receive memory are no longer compared on lossy rows ([design](docs/design-rocm-ernic-nics.md)).
- **Vulnerability check.** `checks.govulncheck` runs govulncheck against a pinned snapshot of the Go vulnerability database, with no tags and with every flavor tag, and fails on a reachable finding not in its accepted list. One is accepted: GO-2026-6859 in `net/http`, fixed in go1.27.4, until the toolchain moves. `nix run .#govulncheck-fresh` checks against the live database and runs `go mod verify`; `nix build .#sbom-<binary>` writes a CycloneDX SBOM for any binary package.
Expand Down
41 changes: 41 additions & 0 deletions docs/design-rocm-ernic-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,44 @@ Any column that comes out exactly equal also gets a goldenrec unit row (`pkg/gol
- **Keepalive probe in flight (diff flake, TODO):** in one of five captures, `xtcp2-golden diff` reported an idle `golden-cc-a` connection with `inet_diag_msg_retrans` 1 and `tcp_info_probes` 1, but `total_retrans` 0 and nothing unacked. The poll caught Go's default 15 s keepalive probe before its ACK: the probe sets `icsk_probes_out` (net/ipv4/tcp_timer.c:844), `tcp_ack` clears it (net/ipv4/tcp_input.c:4430), and inet_diag reports it as `idiag_retrans` while the keepalive timer is pending (net/ipv4/inet_diag.c:295). This predates this work. A fix is `-keepalive 1h` on the idle workloads: the keepalive timer still shows (`inet_diag_msg_timer` 2), but no probe is sent during a capture.
- **Captures:** five, all 47 rows PASS on each (one at host load 18.6), with the oracle exact on all four NICs every time. `xtcp2-golden diff` is clean between captures 1, 3, 4 and 5; capture 2 differs only by the keepalive probe above. The sequence flow sent about 3100 frames with 12 drops, retransmitted 11 or 12 times (an 11 means one drop was a pure ACK), and never had an RTO, so `seq_no_rto` is asserted.
- **After the SYN fix:** eight more captures with a pcap on tap-ionic0. In seven, every row passed and the oracle was exact on all four NICs. The eighth failed only `loss_seen`, the netem TODO above, and aborted before the oracle ran.

# Round 3: close the two golden flakes, strict diff on the sequence flow

Status: done (2026-11-27). Round 2 left three TODOs (Status, above). This round closes the keepalive flake, adds exact netem rows that tell an xtcp2 bug from a flow that saw no loss, fixes a dctcp ECN fallback the hunt found, and makes the sequence flow exact. The netem `loss_seen` flake is not closed: it recurred once in 20 captures with the kernel agreeing, cause unknown (Round 3 status, TODO). The uplink TODO stays open.

## Phase 0: kernel findings

- **Retransmit counters agree per socket and per namespace.** `__tcp_retransmit_skb`'s caller adds the same `segs` to `TCP_MIB_RETRANSSEGS` and `tp->total_retrans` (net/ipv4/tcp_output.c:3710, :3713), and a TLP probe goes through the same path (net/ipv4/tcp_output.c:3279). A SYN-ACK retransmit counts `TCP_MIB_RETRANSSEGS` and `req->num_retrans` (net/ipv4/tcp_output.c:4722), and the child socket starts with `total_retrans = req->num_retrans` (net/ipv4/tcp_minisocks.c:591). So in a fresh netns, `TcpRetransSegs` equals the sum of `tcp_info_total_retrans`, as long as no socket was closed before the poll.
- **`TCP_MIB_OUTSEGS` leaves out retransmits:** it counts a segment only if it ends past `snd_nxt` or carries no data (net/ipv4/tcp_output.c:1754).
- **netem drops ECT packets too.** Without the `ecn` option a loss event drops the packet whatever its ECN bits (net/sched/sch_netem.c:481-487). So ECN doesn't explain the dctcp flow with 0 retransmits.

## Phase 1: keepalive 1h on every idle golden workload

Every tcp_client and tcp_server in `golden-workload.sh` that doesn't already pass `-keepalive -1s` gets `-keepalive 1h`, the containers through `TCP_CLIENT_ARGS`/`TCP_SERVER_ARGS`. The keepalive timer still shows (`inet_diag_msg_timer` 2), but no probe goes out during a capture, so the fixture should not change.

## Phase 2: netem `loss_seen`

- The bulk clients get `-dialTimeout 30s`. A netem-dropped SYN plus the 1 s dial timeout closes a socket, and its counters go with it.
- `loss_seen`'s detail adds the kernel's per-socket `retrans`/`segs_out` and ECN flags (`ss -tin`), and `nstat -az TcpRetransSegs TcpOutSegs` per namespace.
- New rows: `netem_retrans_a` and `netem_retrans_b` (xtcp2's sum of `total_retrans` == the namespace's `TcpRetransSegs`), and `netem_kernel_agrees` (xtcp2 == `ss` per client).
- Hunt with up to 20 captures. If the kernel shows retransmits and xtcp2 doesn't, it's an xtcp2 bug (red unit test, then fix). If both show 0, the flow saw no loss: fix the workload. If nothing fails, the TODO stays with the new evidence.

## Phase 3: one-way sequence flow

- tcp_server `-discard` reads and drops; tcp_client `-bulkOneWay` writes the `-bulk` bytes, then waits for the peer to close. With nothing coming back, every dropped frame is a data segment.
- `seq_retrans` becomes exact (`total_retrans` == 12), and a new row `seq_server_no_retrans` checks the server's is 0.
- golden-ernic-c/d leave `DefaultFaultNetns`, so the diff compares them. Any column that still varies over five captures goes in a narrower `DefaultSeqNetns` exemption, with its cause.

Tests (table-driven, red first): tcp_server discard (discard reads all, echo default, empty, with `-holdEOF`, flag parse); tcp_client one-way (writes n, peer close, echo default, needs `-bulk`, one byte, peer reset); `pkg/goldenrec` diff (c and d compared, b still exempt, explicit `FaultNetns`, ionic0 egress exempt).

## Round 3 status

- **Keepalive (phase 1):** fixed. Every idle golden socket uses `-keepalive 1h`. That also explained a fixture oddity: 120 idle rows had nonzero `sk_mem_info_drops`. A keepalive probe carries `snd_una - 1` (net/ipv4/tcp_output.c:4610), the peer's `tcp_sequence` calls it an old sequence (net/ipv4/tcp_input.c:4890), and the discard path adds it to `sk_drops` (`tcp_drop_reason`, net/ipv4/tcp_input.c:5345). Without probes those rows read 0. The coverage requirement still holds: 9 or 10 rows per capture keep nonzero drops from the netem listeners' SYN-ACK path.
- **netem (phase 2):** xtcp2 agrees with the kernel exactly. In all 20 hunt captures (5, then 15 more), xtcp2's sum of `total_retrans` equaled each namespace's `TcpRetransSegs` (for example 201 and 280), and each client's equaled `ss`'s.
- **netem `loss_seen`, recurred once in 20 (TODO):** in capture 14 the cubic client had 0 retransmits over 3779 segments while bbr, dctcp and vegas, on the same path, had 67 to 137. The netem rows passed and `ss` showed 0 as well, so xtcp2 reported the kernel correctly: the flow saw no loss. netem's drops were low on both sides (80 and 103, against 129 to 159 and 149 to 218 in the passing captures), short by about 2 % of one flow's segments each way, as if the cubic flow's packets in both directions skipped netem. The cause is not found; that capture kept no records. The row now also prints each client's and server's RTT (10 ms or more through netem's 5 ms each way; 10.0 to 10.9 for clients, about 15.5 for servers in a passing capture) and netem's sent count beside the namespace's OutSegs + RetransSegs. In a passing capture, sent + dropped was about 120 below OutSegs + RetransSegs on each side (15027 against 15151, 14443 against 14563), so that baseline does not close either; the next failure's numbers compare against it. TODO: make the next one investigable. The guest stops at the first failing row, before it dumps records, so a failed capture keeps none; on a `loss_seen` failure it should still dump them, with `tc -s qdisc`, `ip -s link` and the full `ss -tie` lines of golden-bulk-a/b. A packet trace (headers only, golden-bulk-a's veth0) would settle whether the flow crossed netem, but at about 30000 packets it is too large for the console and needs another way out of the guest.
- **dctcp fell back to dctcp-reno, once in 20 (fixed):** `xtcp2-golden diff` flagged capture 19's dctcp bulk pair as `dctcp-reno` with no ECN. A SYN netem drops is resent without ECE/CWR when `tcp_ecn_fallback` is set (net/ipv4/tcp_output.c:3698-3705, `tcp_ecn_clear_syn` in include/net/tcp_ecn.h), and dctcp without ECN falls back to dctcp-reno (net/ipv4/tcp_dctcp.c:112-115). golden-bulk-a now sets `net.ipv4.tcp_ecn_fallback=0` (per netns, net/ipv4/tcp_ipv4.c:3449). A lost SYN-ACK is covered too: the listener's first resend still sets ECE, because `tcp_rtx_synack` runs before `num_timeout++` (net/ipv4/inet_connection_sock.c:1120-1125, `tcp_ecn_make_synack`); only two lost in a row would still fall back (about 0.04 % of captures; not a guarantee). New row `bulk_dctcp_ecn` fails the capture if it does.
- **One-way sequence flow (phase 3):** exact. `total_retrans` was 12 for 12 drops in all five captures, with no RTO, and the server's was 0. ionic2's eligible frames equaled the client's `segs_out` (2913 to 2915).
- **Strict diff:** golden-ernic-c/d are compared. Only `tcp_info_rwnd_limited` differed, on the client in two of four captures: the discarding server reads as fast as it is scheduled, so whether its window ever held the sender back depends on host load. It is the one column in `goldenrec.seqColumns`. With it, `xtcp2-golden diff` was clean on all six pairs of the four full captures.
- **Captures:** five. In four, all 52 guest rows passed and the oracle was exact on all four NICs, at host load 7 to 24. The first failed only `netem_kernel_agrees`, on formatting (the query helper strips spaces, so the lists now use commas); its values agreed. A sixth timed out at host load 61 (`GOLDEN_DONE not seen within 600 s`) and is not counted. The fixture is recaptured. Then 15 more for the netem hunt, at host load 5 to 19: 14 passed all 52 rows, capture 14 failed `loss_seen` only (above), and `xtcp2-golden diff` against the fixture was clean for 13 of the 14 that kept records, capture 19 being the dctcp fallback. One more with the ECN fix and the new detail passed all 53 rows.
- **Uplinks:** unchanged, still TODO (round 2 Status).
- **Checks:** the list passes but for three failures this branch does not cause. `deadnix` (unused bindings in nix/ernic/oracle.nix and run-many.nix) and `go-sec` (tools/ipfeed-fixture) fail on main 7e1e4c3f9 too (TODO). `test-go-race` failed once in `TestOnDemandRace/ttl-edge` (pkg/linkmonitor) at host load near 120; it passed three of three with `-race` afterwards.
Loading