Repository navigation
UCP/PROTO: Update EP config on SPEED_CHANGE events - #11056
Conversation
bd347ae to
46b2b15
Compare
de34887 to
de4ba58
Compare
de4ba58 to
11a8850
Compare
2b5ddb9 to
86439b9
Compare
evgeny-leksikov
left a comment
There was a problem hiding this comment.
LGTM besides couple minor comments
| wiface->flags |= UCP_WORKER_IFACE_FLAG_PENDING_UPDATE; | ||
| if (worker->dflow_cb_id == UCS_CALLBACKQ_ID_NULL) { | ||
| uct_worker_progress_register_safe( | ||
| worker->uct, ucp_worker_iface_handle_port_speed_progress, worker, 0, |
There was a problem hiding this comment.
can we provide wiface as a parameter instead of a worker? You would not need to check every iface then
There was a problem hiding this comment.
The comment above explains the rationale.
I intentionally want to handle all affected ifaces at once to avoid creating "intermediate ep configs/rkey configs". Otherwise we could just handle this event per iface right here, without calling async callback
There was a problem hiding this comment.
imo it is overkill. I'd handle just one iface
There was a problem hiding this comment.
Ok, I can do that.
There is just a small risk that we may create intermediate ep_config/rkey config that will be wasted
There was a problem hiding this comment.
redesigned to handle this event synchronously
| if (status != UCS_OK) { | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
maybe return ucs_status to indicate error? or check if result is 0 after returning to caller context
There was a problem hiding this comment.
@evgeny-leksikov what will be the behavior if 0 is returned? Is it desired?
There was a problem hiding this comment.
good question - AFAIU all lanes from this iface will be disqualified from protocol by perf, not by failure. And the only correct way to recover them later is new perf event on the iface. IMO better dont do this and allow lanes to fail if iface is not working. In this case, lanes will be marker as failed by failover flow and recoverable when iface is back to working state.
There was a problem hiding this comment.
so I keep it as is for now
There was a problem hiding this comment.
ok, could you pls add TODO summarized my comment above
| cfg_key.lanes[lane].port_speed = wiface->port_speed; | ||
| } | ||
|
|
||
| if (ucp_ep_config_is_equal(&cfg_key, &ucp_ep_config(ep)->key)) { |
There was a problem hiding this comment.
Can we have some tests for that?
There was a problem hiding this comment.
Ok, I can add another test (in addition to #11109) to cover a use case when config remains the same after update (if that was your suggestion)
| * Incremented after major connectivity changes (e.g. lane failure, port | ||
| * speed change). A matching epoch is stored in @ref ucp_proto_select_t. | ||
| * If epochs differ, the cached config is stale and must be updated. */ | ||
| uint64_t epoch; |
There was a problem hiding this comment.
Maybe put these 2 in a dedicated struct? Like in similar places above..
There was a problem hiding this comment.
the epoch also will be used for FT... btw, I would avoid "dflow/DF/etc" usage in code, it's something too generic for handling of "speed change" event.
There was a problem hiding this comment.
I agree, "DF" semantics is weird in this context..
There was a problem hiding this comment.
so what's the final proposal on this?
There was a problem hiding this comment.
I removed dflow_cb_id entirely
There was a problem hiding this comment.
I guess, without scheduling handler on async progress async block assertion will fail for UD since it has ASYNC_CB capability
There was a problem hiding this comment.
This shouldn't be the case, because we propagate PORT_SPEED event from the UCT level via progress queue, for any IB ifaces:
static void
uct_ib_device_async_event_schedule_callback(uct_ib_device_t *dev,
uct_ib_async_event_wait_t *wait_ctx)
{
ucs_assert(ucs_spinlock_is_held(&dev->async_event_lock));
ucs_assert(wait_ctx->cb_id == UCS_CALLBACKQ_ID_NULL);
wait_ctx->cb_id = ucs_callbackq_add_safe(wait_ctx->cbq, wait_ctx->cb,
wait_ctx);
}
| ++progress_count; | ||
| } | ||
| wiface_iter = worker->ifaces[iface_id]; | ||
| if (wiface_iter->rsc_index != wiface->rsc_index) { |
There was a problem hiding this comment.
i think the intent was to check dev_index, as rsc_index represents iface, so different ifaces created on the same device will have different rsc_idx
There was a problem hiding this comment.
ok, let me fix that
| key->lanes[i].dst_sys_dev = UCS_SYS_DEVICE_ID_UNKNOWN; | ||
| key->lanes[i].path_index = 0; | ||
| key->lanes[i].lane_types = 0; | ||
| key->lanes[i].port_speed = 0; |
There was a problem hiding this comment.
port_speed name is too HW-specific
| } | ||
| } | ||
|
|
||
| static ucs_status_t ucp_rkey_update_config(ucp_rkey_h rkey, ucp_ep_h ep) |
| } | ||
|
|
||
| /* Now rkey config is up to date with worker epoch */ | ||
| rkey_cfg = ucp_rkey_config(worker, rkey); |
|
|
||
| /* Now rkey config is up to date with worker epoch */ | ||
| rkey_cfg = ucp_rkey_config(worker, rkey); | ||
| rkey_cfg->proto_select.worker_epoch = worker->epoch; |
There was a problem hiding this comment.
is worker->epoch is for ep configurations?
so rename it to worker->ep_config_epoch or worker->ep_config_sn
| return status; | ||
| } | ||
|
|
||
| if (old_cfg_index != ep->cfg_index) { |
There was a problem hiding this comment.
seems better not have ucp_rkey_update_config as separate function and just put its code here
the names "ucp_rkey_update_config" and "ucp_ep_update_rkey_config" very similar and confusing
| ratio = perf_attr.bandwidth.shared / wiface->attr.bandwidth.shared; | ||
| ratio = ucs_min(ucs_max(ratio, 0.0), 0.99); | ||
| /* 4 bits range [0, 15] */ | ||
| return (uint8_t)(ratio * 16.0); |
There was a problem hiding this comment.
- need to document in the field declaration how BW is represented
- can simplify the calculation?
- why counting only "shared" and not "dedicated" ?
| return (uint8_t)(ratio * 16.0); | ||
| } | ||
|
|
||
| static void ucp_worker_iface_handle_port_speed_event(ucp_worker_iface_t *wiface) |
| UCP_WIFACE_ARG(wiface_iter), wiface_iter->port_speed, | ||
| port_speed); | ||
| wiface_iter->port_speed = port_speed; | ||
| ++progress_count; |
There was a problem hiding this comment.
rename progress_count -> bw_changed / is_changed
| ucs_status_t status; | ||
|
|
||
| proto_select = &ucp_rkey_config(worker, rkey)->proto_select; | ||
| if (ucs_unlikely(proto_select->worker_epoch != worker->epoch)) { |
There was a problem hiding this comment.
- why only for RMA?
- can we do this from slow path of protocol selection - in the part that does hash lookup?
| } | ||
|
|
||
| ucp_proto_select_cache_reset(proto_select); | ||
| proto_select->worker_epoch = epoch; |
There was a problem hiding this comment.
in all places rename "epoch" to "ep_config_epoch" / ep_config_sn or similar. to show the epoch / sn are of the ep configuration
What?
UCP part of the Load Balancer based on PORT_SPEED IB events.
The central ideas of the load balancing:
Unit tests will be added in the subsequent PR