Skip to content

Commit f81fc3e

Browse files
committed
Properly initialize mca_rcache_base_module_t members
All but the udreg rcache module did not properly initialize the `lock` member in the mca_rcache_base_module_t parent, which triggers an assert on Mac OSX when trying to take that lock. Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
1 parent 6ab6775 commit f81fc3e

File tree

6 files changed

+33
-8
lines changed

6 files changed

+33
-8
lines changed

opal/mca/rcache/base/base.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2006 The University of Tennessee and The University
6+
* Copyright (c) 2004-2024 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -73,6 +73,10 @@ extern int mca_rcache_base_used_mem_hooks;
7373
*/
7474
OPAL_DECLSPEC extern opal_list_t mca_rcache_base_modules;
7575

76+
OPAL_DECLSPEC void mca_rcache_base_module_init(mca_rcache_base_module_t *rcache);
77+
78+
OPAL_DECLSPEC void mca_rcache_base_module_fini(mca_rcache_base_module_t *rcache);
79+
7680
END_C_DECLS
7781

7882
#endif /* MCA_RCACHE_BASE_H */

opal/mca/rcache/base/rcache_base_frame.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* Copyright (c) 2004-2024 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -136,3 +136,12 @@ static int mca_rcache_base_register_mca_variables(mca_base_register_flag_t flags
136136
MCA_BASE_FRAMEWORK_DECLARE(opal, rcache, "OPAL Registration Cache",
137137
mca_rcache_base_register_mca_variables, mca_rcache_base_open,
138138
mca_rcache_base_close, mca_rcache_base_static_components, 0);
139+
140+
141+
void mca_rcache_base_module_init(mca_rcache_base_module_t *rcache) {
142+
OBJ_CONSTRUCT(&rcache->lock, opal_mutex_t);
143+
}
144+
145+
void mca_rcache_base_module_fini(mca_rcache_base_module_t *rcache) {
146+
OBJ_DESTRUCT(&rcache->lock);
147+
}

opal/mca/rcache/gpusm/rcache_gpusm_module.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2013 The University of Tennessee and The University
6+
* Copyright (c) 2004-2024 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -81,6 +81,8 @@ OBJ_CLASS_INSTANCE(mca_rcache_gpusm_registration_t, mca_rcache_base_registration
8181
*/
8282
void mca_rcache_gpusm_module_init(mca_rcache_gpusm_module_t *rcache)
8383
{
84+
mca_rcache_base_module_init(&rcache->super);
85+
8486
rcache->super.rcache_component = &mca_rcache_gpusm_component.super;
8587
rcache->super.rcache_register = mca_rcache_gpusm_register;
8688
rcache->super.rcache_find = mca_rcache_gpusm_find;
@@ -240,5 +242,8 @@ void mca_rcache_gpusm_finalize(struct mca_rcache_base_module_t *rcache)
240242
}
241243

242244
OBJ_DESTRUCT(&rcache_gpusm->reg_list);
245+
246+
mca_rcache_base_module_fini(rcache);
247+
243248
return;
244249
}

opal/mca/rcache/grdma/rcache_grdma_module.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2013 The University of Tennessee and The University
6+
* Copyright (c) 2004-2024 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -111,6 +111,8 @@ void mca_rcache_grdma_module_init(mca_rcache_grdma_module_t *rcache,
111111
OBJ_RETAIN(cache);
112112
rcache->cache = cache;
113113

114+
mca_rcache_base_module_init(&rcache->super);
115+
114116
rcache->super.rcache_component = &mca_rcache_grdma_component.super;
115117
rcache->super.rcache_register = mca_rcache_grdma_register;
116118
rcache->super.rcache_find = mca_rcache_grdma_find;
@@ -602,6 +604,8 @@ static void mca_rcache_grdma_finalize(mca_rcache_base_module_t *rcache)
602604

603605
OBJ_DESTRUCT(&rcache_grdma->reg_list);
604606

607+
mca_rcache_base_module_fini(rcache);
608+
605609
/* this rcache was allocated by grdma_init in rcache_grdma_component.c */
606610
free(rcache);
607611
}

opal/mca/rcache/rgpusm/rcache_rgpusm_module.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2013 The University of Tennessee and The University
6+
* Copyright (c) 2004-2024 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -187,6 +187,7 @@ static inline bool mca_rcache_rgpusm_deregister_lru(mca_rcache_base_module_t *rc
187187
*/
188188
void mca_rcache_rgpusm_module_init(mca_rcache_rgpusm_module_t *rcache)
189189
{
190+
mca_rcache_base_module_init(&rcache->super);
190191
rcache->super.rcache_component = &mca_rcache_rgpusm_component.super;
191192
rcache->super.rcache_register = mca_rcache_rgpusm_register;
192193
rcache->super.rcache_find = mca_rcache_rgpusm_find;
@@ -669,4 +670,5 @@ void mca_rcache_rgpusm_finalize(struct mca_rcache_base_module_t *rcache)
669670
OBJ_DESTRUCT(&rcache_rgpusm->lru_list);
670671
OBJ_DESTRUCT(&rcache_rgpusm->reg_list);
671672
OPAL_THREAD_UNLOCK(&rcache->lock);
673+
mca_rcache_base_module_fini(rcache);
672674
}

opal/mca/rcache/udreg/rcache_udreg_module.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2013 The University of Tennessee and The University
6+
* Copyright (c) 2004-2024 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -66,6 +66,8 @@ int mca_rcache_udreg_module_init(mca_rcache_udreg_module_t *rcache)
6666
struct udreg_cache_attr cache_attr;
6767
int urc;
6868

69+
mca_rcache_base_module_init(&rcache->super);
70+
6971
rcache->super.rcache_component = &mca_rcache_udreg_component.super;
7072
rcache->super.rcache_register = mca_rcache_udreg_register;
7173
rcache->super.rcache_find = mca_rcache_udreg_find;
@@ -89,8 +91,6 @@ int mca_rcache_udreg_module_init(mca_rcache_udreg_module_t *rcache)
8991
cache_attr.modes |= UDREG_CC_MODE_USE_LAZY_DEREG;
9092
}
9193

92-
OBJ_CONSTRUCT(&rcache->lock, opal_mutex_t);
93-
9494
opal_string_copy(cache_attr.cache_name, rcache->resources.base.cache_name,
9595
UDREG_MAX_CACHENAME_LEN);
9696
cache_attr.max_entries = rcache->resources.max_entries;
@@ -363,4 +363,5 @@ static void mca_rcache_udreg_finalize(mca_rcache_base_module_t *rcache)
363363
UDREG_CacheRelease(rcache_udreg->udreg_handle);
364364
OBJ_DESTRUCT(&rcache_udreg->reg_list);
365365
OBJ_DESTRUCT(&rcache_udreg->lock);
366+
mca_rcache_base_module_fini(rcache);
366367
}

0 commit comments

Comments
 (0)