From a1b4a68783206908bd2b760c9f6b64881aacc3e3 Mon Sep 17 00:00:00 2001 From: Seth Zegelstein Date: Tue, 9 Jan 2024 23:53:39 +0000 Subject: [PATCH] prov/efa: Init util_domain with correct lock type Previously, the EFA provider was initializing the util_domain lock to always be an OFI_LOCK_MUTEX. This is no longer required if the threading model is FI_THREAD_DOMAIN_RELAXED. Initialize domain lock to be a NOOP when domain threading model is FI_THREAD_DOMAIN_RELAXED. Signed-off-by: Seth Zegelstein --- prov/efa/src/efa_domain.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/prov/efa/src/efa_domain.c b/prov/efa/src/efa_domain.c index 328fd932d5c..4174a0f20ff 100644 --- a/prov/efa/src/efa_domain.c +++ b/prov/efa/src/efa_domain.c @@ -204,6 +204,7 @@ int efa_domain_open(struct fid_fabric *fabric_fid, struct fi_info *info, { struct efa_domain *efa_domain; int ret = 0, err; + enum ofi_lock_type domain_lock_type; efa_domain = calloc(1, sizeof(struct efa_domain)); if (!efa_domain) @@ -213,15 +214,16 @@ int efa_domain_open(struct fid_fabric *fabric_fid, struct fi_info *info, efa_domain->fabric = container_of(fabric_fid, struct efa_fabric, util_fabric.fabric_fid); - err = ofi_domain_init(fabric_fid, info, &efa_domain->util_domain, - context, OFI_LOCK_MUTEX); + domain_lock_type = info->domain_attr->threading != FI_THREAD_DOMAIN_RELAXED ? + OFI_LOCK_MUTEX : OFI_LOCK_NOOP; + err = ofi_domain_init(fabric_fid, info, &efa_domain->util_domain, context, domain_lock_type); if (err) { ret = err; goto err_free; } err = ofi_genlock_init(&efa_domain->srx_lock, efa_domain->util_domain.threading != FI_THREAD_SAFE ? - OFI_LOCK_NOOP : OFI_LOCK_MUTEX); + OFI_LOCK_NOOP : OFI_LOCK_MUTEX); if (err) { EFA_WARN(FI_LOG_DOMAIN, "srx lock init failed! err: %d\n", err); ret = err;