Skip to content

Commit ecdac95

Browse files
committed
btl/uct: module md_name to mca_btl_uct_md_t
More cleanup preparing to separate connection-only tls from their module. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 16140a3 commit ecdac95

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

opal/mca/btl/uct/btl_uct.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ struct mca_btl_uct_module_t {
9898
/** registration cache */
9999
mca_rcache_base_module_t *rcache;
100100

101-
/** name of the memory domain backing this module */
102-
char *md_name;
103-
104101
/** am and rdma share endpoints */
105102
bool shared_endpoints;
106103

opal/mca/btl/uct/btl_uct_component.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static size_t mca_btl_uct_tl_modex_size(mca_btl_uct_tl_t *tl)
258258

259259
static size_t mca_btl_uct_module_modex_size(mca_btl_uct_module_t *module)
260260
{
261-
size_t modex_size = 4 + strlen(module->md_name) + 1;
261+
size_t modex_size = 4 + strlen(module->md->md_name) + 1;
262262

263263
if (module->rdma_tl) {
264264
modex_size += mca_btl_uct_tl_modex_size(module->rdma_tl);
@@ -307,14 +307,14 @@ static size_t mca_btl_uct_tl_modex_pack(mca_btl_uct_module_t *module, mca_btl_uc
307307

308308
static uint8_t *mca_btl_uct_modex_pack(mca_btl_uct_module_t *module, uint8_t *modex_data)
309309
{
310-
size_t name_len = strlen(module->md_name);
310+
size_t name_len = strlen(module->md->md_name);
311311

312312
/* pack the size */
313313
*((uint32_t *) modex_data) = (uint32_t) mca_btl_uct_module_modex_size(module);
314314

315315
modex_data += 4;
316316

317-
strcpy((char *) modex_data, module->md_name);
317+
strcpy((char *) modex_data, module->md->md_name);
318318
modex_data += name_len + 1;
319319

320320
if (module->rdma_tl) {
@@ -366,7 +366,7 @@ static int mca_btl_uct_modex_send(void)
366366
return rc;
367367
}
368368

369-
static mca_btl_uct_module_t *mca_btl_uct_alloc_module(const char *md_name, mca_btl_uct_md_t *md,
369+
static mca_btl_uct_module_t *mca_btl_uct_alloc_module(mca_btl_uct_md_t *md,
370370
size_t registration_size)
371371
{
372372
mca_btl_uct_module_t *module;
@@ -389,7 +389,6 @@ static mca_btl_uct_module_t *mca_btl_uct_alloc_module(const char *md_name, mca_b
389389
OBJ_CONSTRUCT(&module->lock, opal_recursive_mutex_t);
390390

391391
module->md = md;
392-
module->md_name = strdup(md_name);
393392
module->super.btl_registration_handle_size = registration_size;
394393

395394
return module;
@@ -463,25 +462,26 @@ static int mca_btl_uct_component_process_uct_md(uct_md_resource_desc_t *md_desc)
463462
}
464463

465464
md = OBJ_NEW(mca_btl_uct_md_t);
465+
md->md_name = strdup(md_desc->md_name);
466466

467467
#if UCT_API >= UCT_VERSION(1, 7)
468468
ucs_status = uct_md_config_read(component, NULL, NULL, &uct_config);
469469
if (UCS_OK != ucs_status) {
470470
BTL_VERBOSE(("uct_md_config_read failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
471471
return OPAL_ERR_NOT_AVAILABLE;
472472
}
473-
ucs_status = uct_md_open(component, md_desc->md_name, uct_config, &md->uct_md);
473+
ucs_status = uct_md_open(component, md->md_name, uct_config, &md->uct_md);
474474
if (UCS_OK != ucs_status) {
475475
BTL_VERBOSE(("uct_md_open failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
476476
return OPAL_ERR_NOT_AVAILABLE;
477477
}
478478
#else
479-
ucs_status = uct_md_config_read(md_desc->md_name, NULL, NULL, &uct_config);
479+
ucs_status = uct_md_config_read(md->md_name, NULL, NULL, &uct_config);
480480
if (UCS_OK != ucs_status) {
481481
BTL_VERBOSE(("uct_md_config_read failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
482482
return OPAL_ERR_NOT_AVAILABLE;
483483
}
484-
ucs_status = uct_md_open(md_desc->md_name, uct_config, &md->uct_md);
484+
ucs_status = uct_md_open(md->md_name, uct_config, &md->uct_md);
485485
if (UCS_OK != ucs_status) {
486486
BTL_VERBOSE(("uct_md_open failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
487487
return OPAL_ERR_NOT_AVAILABLE;
@@ -500,7 +500,7 @@ static int mca_btl_uct_component_process_uct_md(uct_md_resource_desc_t *md_desc)
500500
return OPAL_ERR_NOT_AVAILABLE;
501501
}
502502

503-
module = mca_btl_uct_alloc_module(md_desc->md_name, md, md_attr.rkey_packed_size);
503+
module = mca_btl_uct_alloc_module(md, md_attr.rkey_packed_size);
504504
if (NULL == module) {
505505
uct_release_tl_resource_list(tl_desc);
506506
return OPAL_ERR_OUT_OF_RESOURCE;
@@ -517,7 +517,7 @@ static int mca_btl_uct_component_process_uct_md(uct_md_resource_desc_t *md_desc)
517517
OBJ_RELEASE(md);
518518

519519
if (NULL == module->am_tl && NULL == module->rdma_tl && (NULL == module->conn_tl || !consider_for_connection_module)) {
520-
BTL_VERBOSE(("uct memory domain %s does not have any appropriate tls", md_desc->md_name));
520+
BTL_VERBOSE(("uct memory domain %s does not have any appropriate tls", md->md_name));
521521
mca_btl_uct_finalize(&module->super);
522522
return OPAL_ERR_NOT_AVAILABLE;
523523
}
@@ -534,7 +534,7 @@ static int mca_btl_uct_component_process_uct_md(uct_md_resource_desc_t *md_desc)
534534
/* NTH: a registration cache shouldn't be necessary when using UCT but there are measurable
535535
* performance benefits to using rcache/grdma instead of assuming UCT will do the right
536536
* thing. */
537-
(void) opal_asprintf(&tmp, "uct.%s", module->md_name);
537+
(void) opal_asprintf(&tmp, "uct.%s", md->md_name);
538538

539539
rcache_resources.cache_name = tmp;
540540
rcache_resources.reg_data = (void *) module;
@@ -553,7 +553,7 @@ static int mca_btl_uct_component_process_uct_md(uct_md_resource_desc_t *md_desc)
553553
}
554554
} else {
555555
if (NULL == mca_btl_uct_component.conn_module) {
556-
BTL_VERBOSE(("memory domain %s may be used for connections", md_desc->md_name));
556+
BTL_VERBOSE(("memory domain %s may be used for connections", md->md_name));
557557
mca_btl_uct_component.conn_module = module;
558558
} else {
559559
mca_btl_uct_finalize(&module->super);
@@ -635,7 +635,7 @@ static void mca_btl_uct_component_validate_modules(void) {
635635
&& NULL == module->conn_tl) {
636636
/* module can not be used */
637637
BTL_VERBOSE(("module for memory domain %s can not be used due to missing connection transport",
638-
module->md_name));
638+
module->md->md_name));
639639
mca_btl_uct_finalize (&mca_btl_uct_component.modules[i]->super);
640640
mca_btl_uct_component.modules[i] = NULL;
641641
}

opal/mca/btl/uct/btl_uct_endpoint.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,11 @@ static int mca_btl_uct_find_modex(mca_btl_uct_module_t *uct_btl, mca_btl_uct_mod
410410
for (int i = 0; i < modex->module_count; ++i) {
411411
uint32_t modex_size = *((uint32_t *) modex_data);
412412

413-
BTL_VERBOSE(("found modex for md %s, searching for %s", modex_data + 4, uct_btl->md_name));
413+
BTL_VERBOSE(("found modex for md %s, searching for %s", modex_data + 4, uct_btl->md->md_name));
414414

415415
modex_data += 4;
416416

417-
if (0 != strcmp((char *) modex_data, uct_btl->md_name)) {
417+
if (0 != strcmp((char *) modex_data, uct_btl->md->md_name)) {
418418
/* modex belongs to a different module, skip it and continue */
419419
modex_data += modex_size - 4;
420420
continue;
@@ -427,12 +427,12 @@ static int mca_btl_uct_find_modex(mca_btl_uct_module_t *uct_btl, mca_btl_uct_mod
427427
*remote_module_index = i;
428428
}
429429

430-
BTL_VERBOSE(("finished processing modex for %s", uct_btl->md_name));
430+
BTL_VERBOSE(("finished processing modex for %s", uct_btl->md->md_name));
431431

432432
return OPAL_SUCCESS;
433433
}
434434

435-
BTL_ERROR(("could not find modex for %s", uct_btl->md_name));
435+
BTL_ERROR(("could not find modex for %s", uct_btl->md->md_name));
436436

437437
return OPAL_ERR_NOT_FOUND;
438438
}

opal/mca/btl/uct/btl_uct_module.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ int mca_btl_uct_finalize(mca_btl_base_module_t *btl)
303303

304304
OBJ_DESTRUCT(&uct_module->endpoint_lock);
305305

306-
free(uct_module->md_name);
307306
free(uct_module);
308307

309308
return OPAL_SUCCESS;
@@ -357,10 +356,12 @@ OBJ_CLASS_INSTANCE(mca_btl_uct_reg_t, opal_free_list_item_t, NULL, NULL);
357356
static void mca_btl_uct_md_construct(mca_btl_uct_md_t *md)
358357
{
359358
md->uct_md = NULL;
359+
md->md_name = NULL;
360360
}
361361

362362
static void mca_btl_uct_md_destruct(mca_btl_uct_md_t *md)
363363
{
364+
free(md->md_name);
364365
if (md->uct_md) {
365366
uct_md_close(md->uct_md);
366367
md->uct_md = NULL;

opal/mca/btl/uct/btl_uct_tl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static mca_btl_uct_tl_t *mca_btl_uct_create_tl(mca_btl_uct_module_t *module, mca
457457
return NULL;
458458
}
459459

460-
BTL_VERBOSE(("Interface CAPS for tl %s::%s: 0x%lx", module->md_name, tl_desc->tl_name,
460+
BTL_VERBOSE(("Interface CAPS for tl %s::%s: 0x%lx", module->md->md_name, tl_desc->tl_name,
461461
(unsigned long) tl->uct_iface_attr.cap.flags));
462462

463463
return tl;

opal/mca/btl/uct/btl_uct_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ struct mca_btl_uct_md_t {
6767
/** make this an opal object */
6868
opal_object_t super;
6969

70+
/** name of the memory domain backing this module */
71+
char *md_name;
72+
7073
/** UCT memory domain handle */
7174
uct_md_h uct_md;
7275
};

0 commit comments

Comments
 (0)