From 32e1313e440c9e9ff9b78f71d9141e81fb52cc79 Mon Sep 17 00:00:00 2001 From: Raghu Raja Date: Fri, 9 Oct 2020 21:41:43 +0000 Subject: [PATCH] prov/efa: Fix FI_HMEM capability claims This commit fixes two issues. One, FI_HMEM is a primary capability that should only be enabled if applications request it. Second, FI_HMEM was always being advertised when NULL hints were passed by the application. This was causing issues with applications like Intel MPI that query for providers will NULL hints followed by a subsequent call to fi_getinfo() with specific hints. Signed-off-by: Raghu Raja --- prov/efa/src/rxr/rxr_init.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/prov/efa/src/rxr/rxr_init.c b/prov/efa/src/rxr/rxr_init.c index c886d98bb74..a2230545f0e 100644 --- a/prov/efa/src/rxr/rxr_init.c +++ b/prov/efa/src/rxr/rxr_init.c @@ -343,6 +343,16 @@ static int rxr_info_to_rxr(uint32_t version, const struct fi_info *core_info, info->domain_attr->cq_cnt = core_info->domain_attr->cq_cnt; info->domain_attr->mr_key_size = core_info->domain_attr->mr_key_size; + /* + * Do not advertise FI_HMEM capabilities when the core can not support + * it or when the application passes NULL hints (given this is a primary + * cap). The logic for device-specific checks pertaining to HMEM comes + * further along this path. + */ + if ((core_info && !(core_info->caps & FI_HMEM)) || !hints) { + info->caps &= ~FI_HMEM; + } + /* * Handle user-provided hints and adapt the info object passed back up * based on EFA-specific constraints. @@ -421,6 +431,12 @@ static int rxr_info_to_rxr(uint32_t version, const struct fi_info *core_info, info->domain_attr->mr_mode |= FI_MR_HMEM; + } else { + /* + * FI_HMEM is a primary capability. Providers should + * only enable it if requested by applications. + */ + info->caps &= ~FI_HMEM; } #endif /*