Repository navigation
[TENT] Prefer the LAG-effective port speed from ibv_query_port_speed - #3777
Conversation
abed82c to
e9ea1bd
Compare
catyans
left a comment
There was a problem hiding this comment.
The implementation matches the upstream verbs contract: ibv_query_port_speed() uses the expected (context, uint32_t port, uint64_t*) ABI and reports 100 Mb/s units, so dividing by 10 produces Gbps. Resolving it with dlsym keeps older libibverbs versions compatible, while a missing, failed, or zero result falls back to the existing encoded speed path.
The runtime integration is also covered well: initial device open and port refresh update the effective value, stale effective data is cleared on query failure, and the event-chain test verifies that a real speed change reseeds the selector while an unchanged rate preserves learned EWMA state. CI is green. Approved.
Non-blocking follow-up suggestion: expose a counter or rate-limited warning for effective-speed query failures/fallbacks, since a transient failure on a degraded LAG can temporarily restore the higher encoded rate and would otherwise be difficult to diagnose.
| // From ibv_query_port_speed(), 100 Mb/s units; 0 = unavailable. | ||
| std::atomic<uint64_t> effective_speed_100mbps_{0}; |
There was a problem hiding this comment.
What's the difference between this one and active_speed_? Additionally we'd prefer to store values as mbps.
There was a problem hiding this comment.
Done in 5fb0da4: the context now stores plain Mb/s (effective_speed_mbps_, x100 at the store since the verb reports 100 Mb/s granularity), and ibPortSpeedGbps() takes effective_mbps (/1000). The fake verb in the tests still returns 100 Mb/s units like the real one, so EffectiveSpeedPreferredWhenVerbReportsIt (2000 -> 200.0 Gbps) covers the conversion end to end.
There was a problem hiding this comment.
To expand on the difference, with the upstream references:
active_speed_ vs effective_speed_mbps_. active_speed_ caches ibv_port_attr::active_speed from ibv_query_port() - an encoding of the per-lane signalling class (1/2/4/.../256 = SDR...XDR), which only becomes a rate after multiplying by the lane count from active_width (ibLinkSpeedGbps()). effective_speed_mbps_ caches what ibv_query_port_speed() returns: the port's actual effective bandwidth as a number (the verb reports 100 Mb/s granularity; we store Mb/s since 5fb0da4).
Why a second verb at all. From the rdma-core commit that introduced it (linux-rdma/rdma-core#1674, commit 8504597, first released in v62.0): "This is useful for VF LAG and multiport LAG configurations, since ibv_query_port does not report the combined bandwidth of all aggregated ports." Three concrete gaps in ibv_query_port that the new verb closes:
- For a VF/port over LAG,
ibv_query_portreports a single parent port's speed x width;ibv_query_port_speedreports the aggregate of the active bond members. - When a bond member fails, the VF's bandwidth drops (e.g. halves) while its port stays ACTIVE with the same encoding/width - invisible to
ibv_query_port; the effective speed changes, and the pairedIBV_EVENT_DEVICE_SPEED_CHANGEasync event fires (we already consume that event to re-seed the selector). - Aggregated rates (e.g. 2x200G) have no speed-x-width encoding; the kernel series notes it supports "speeds not expressible as IB speed * width", which is why the verb returns a plain number instead of an encoding.
Kernel side: "[PATCH rdma-next 00/10] Support effective VF bandwidth query in LAG mode" adds ib_query_port_speed() and the speed-change event, with mlx5 propagating the aggregated LAG speed to attached vports and updating it on member link changes.
That is also why linkSpeedGbps() prefers the effective value and falls back to active_speed_ x active_width_ only when the verb is absent (< rdma-core 62, resolved as an optional symbol) or reports 0.
e9ea1bd to
7f56809
Compare
|
Addressed the non-blocking follow-up in cc09885, in this PR:
Covered hardware-free via the fake-verbs fixture: |
catyans
left a comment
There was a problem hiding this comment.
LGTM. The update safely preserves the last known effective speed on transient query failures and adds useful observability and regression coverage. All checks are green.
Description
RdmaContext::linkSpeedGbps()decodesactive_speed × active_width, the physical link's encoded rate. For a VF over VF LAG / multiport LAG, a PF dropping out of the bond halves the VF's bandwidth while its port staysACTIVEat the same encoding, so the re-read onIBV_EVENT_DEVICE_SPEED_CHANGE(#3644) saw no change and never re-seeded the selector. rdma-core v62 addedibv_query_port_speed()alongside that event to report the effective speed (100 Mb/s units, LAG-aware).ibPortSpeedGbps()inib_link_speed.h: effective speed wins when > 0, the encodings decide otherwise.IbvLoaderresolvesibv_query_port_speedas an optional symbol (nullptron older libraries; never disables RDMA).RdmaContextqueries it after everyibv_query_port(open and refresh), caches it, andlinkSpeedGbps()prefers it. A present-but-failing verb records 0 so the fallback applies.RdmaContext::verbs_becomes a per-context copy of the loader's table so tests can substitute entries (RdmaContextTestPeer), covering the effective-speed and refresh paths without an RNIC.No public API or config changes. Refs #3750 (follow-up section).
Module
mooncake-transfer-engine)mooncake-common)Type of Change
How Has This Been Tested?
Test commands: