From d42a78c40800f170d6e1f5a0074175363c406333 Mon Sep 17 00:00:00 2001 From: Alexia Ingerson Date: Mon, 9 Dec 2024 11:41:24 -0800 Subject: [PATCH] prov/rxm: fix rxm multi recv setopt segfault 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 --- prov/rxm/src/rxm.h | 1 + prov/rxm/src/rxm_ep.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/prov/rxm/src/rxm.h b/prov/rxm/src/rxm.h index 93e08624fc1..fa570b455a4 100644 --- a/prov/rxm/src/rxm.h +++ b/prov/rxm/src/rxm.h @@ -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; diff --git a/prov/rxm/src/rxm_ep.c b/prov/rxm/src/rxm_ep.c index b967643c0c5..de375cc010d 100644 --- a/prov/rxm/src/rxm_ep.c +++ b/prov/rxm/src/rxm_ep.c @@ -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, @@ -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); @@ -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)