Skip to content

Commit

Permalink
prov/rxm: fix rxm multi recv setopt segfault
Browse files Browse the repository at this point in the history
rxm uses the util srx and sets the minimum multi receive size through
the srx. However, the srx code doesn't get initialized until the endpoint
gets enabled. So if the application calls setopt (before FI_ENABLE), this
will segfault because the srx has not been initialized. Instead, we need
to save the multi recv size in the rxm endpoint to be valid during setopt
and then pass that into the util_srx creation to set the multi recv size

Signed-off-by: Alexia Ingerson <[email protected]>
  • Loading branch information
aingerson authored and shijin-aws committed Dec 10, 2024
1 parent 5eff15c commit 95a7e84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions prov/rxm/src/rxm.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ struct rxm_ep {
size_t eager_limit;
size_t sar_limit;
size_t tx_credit;
size_t min_multi_recv_size;

struct ofi_bufpool *rx_pool;
struct ofi_bufpool *tx_pool;
Expand Down
7 changes: 4 additions & 3 deletions prov/rxm/src/rxm_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ static int rxm_ep_setopt(fid_t fid, int level, int optname,

switch (optname) {
case FI_OPT_MIN_MULTI_RECV:
return rxm_ep->srx->ep_fid.ops->setopt(&rxm_ep->srx->ep_fid.fid,
level, optname, optval, optlen);
rxm_ep->min_multi_recv_size = *(size_t *)optval;
return ret;
case FI_OPT_BUFFERED_MIN:
if (rxm_ep->rx_pool) {
FI_WARN(&rxm_prov, FI_LOG_EP_DATA,
Expand Down Expand Up @@ -1144,6 +1144,7 @@ static void rxm_ep_settings_init(struct rxm_ep *rxm_ep)

assert(!rxm_ep->buffered_limit);
rxm_ep->buffered_limit = rxm_buffer_size;
rxm_ep->min_multi_recv_size = rxm_buffer_size;

rxm_config_direct_send(rxm_ep);
rxm_ep_init_proto(rxm_ep);
Expand Down Expand Up @@ -1364,7 +1365,7 @@ static int rxm_ep_ctrl(struct fid *fid, int command, void *arg)
util_domain.domain_fid);
ret = util_ep_srx_context(&domain->util_domain,
ep->rxm_info->rx_attr->size,
RXM_IOV_LIMIT, rxm_buffer_size,
RXM_IOV_LIMIT, ep->min_multi_recv_size,
&rxm_update, &ep->util_ep.lock,
&srx);
if (ret)
Expand Down

0 comments on commit 95a7e84

Please sign in to comment.