Skip to content

Commit

Permalink
prov/efa: Init util_domain with correct lock type
Browse files Browse the repository at this point in the history
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 <szegel@amazon.com>
  • Loading branch information
a-szegel committed Jan 12, 2024
1 parent 51ca389 commit a1b4a68
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions prov/efa/src/efa_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit a1b4a68

Please sign in to comment.