Skip to content

Commit 478feaf

Browse files
committed
btl/scif: update for mpool/rcache rewrite
This commit brings the scif btl up to date with changes made on master to rework the mpool and rcache frameworks. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent dec23f3 commit 478feaf

File tree

4 files changed

+38
-33
lines changed

4 files changed

+38
-33
lines changed

opal/mca/btl/scif/btl_scif.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
3+
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
44
* reserved.
55
* Copyright (c) 2014 Research Organization for Information Science
66
* and Technology (RIST). All rights reserved.
@@ -16,16 +16,15 @@
1616

1717
#include "opal_config.h"
1818

19-
#include "opal/mca/mpool/mpool.h"
20-
#include "opal/mca/mpool/base/base.h"
21-
#include "opal/mca/mpool/grdma/mpool_grdma.h"
2219
#include "opal/util/output.h"
2320
#include "opal_stdint.h"
2421
#include "opal/util/proc.h"
2522

2623
#include "opal/mca/btl/btl.h"
2724
#include "opal/mca/btl/base/base.h"
2825
#include "opal/mca/btl/base/btl_base_error.h"
26+
#include "opal/mca/rcache/rcache.h"
27+
#include "opal/mca/rcache/base/base.h"
2928

3029
#include <scif.h>
3130
#include <errno.h>
@@ -93,6 +92,8 @@ typedef struct mca_btl_scif_module_t {
9392

9493
volatile bool exiting;
9594
bool listening;
95+
96+
mca_rcache_base_module_t *rcache;
9697
} mca_btl_scif_module_t;
9798

9899
typedef struct mca_btl_scif_component_t {
@@ -235,7 +236,7 @@ struct mca_btl_scif_registration_handle_t {
235236
typedef struct mca_btl_scif_registration_handle_t mca_btl_scif_registration_handle_t;
236237

237238
typedef struct mca_btl_scif_reg_t {
238-
mca_mpool_base_registration_t base;
239+
mca_rcache_base_registration_t base;
239240
/** per-endpoint btl handles for this registration */
240241
mca_btl_scif_registration_handle_t *handles;
241242
} mca_btl_scif_reg_t;

opal/mca/btl/scif/btl_scif_add_procs.c

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
3+
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
44
* reserved.
55
* Copyright (c) 2014 Research Organization for Information Science
66
* and Technology (RIST). All rights reserved.
@@ -17,8 +17,7 @@
1717
#include "btl_scif.h"
1818
#include "btl_scif_frag.h"
1919

20-
static int
21-
mca_btl_scif_setup_mpools (mca_btl_scif_module_t *scif_module);
20+
static int mca_btl_scif_setup_rcache (mca_btl_scif_module_t *scif_module);
2221
static void *mca_btl_scif_connect_accept (void *arg);
2322

2423
int mca_btl_scif_add_procs(struct mca_btl_base_module_t* btl,
@@ -48,16 +47,16 @@ int mca_btl_scif_add_procs(struct mca_btl_base_module_t* btl,
4847
procs_on_board++;
4948
}
5049

51-
/* allocate space for the detected peers and setup the mpool */
50+
/* allocate space for the detected peers and setup the rcache */
5251
if (NULL == scif_module->endpoints) {
5352
scif_module->endpoints = calloc (procs_on_board, sizeof (mca_btl_base_endpoint_t));
5453
if (OPAL_UNLIKELY(NULL == scif_module->endpoints)) {
5554
return OPAL_ERR_OUT_OF_RESOURCE;
5655
}
5756

58-
rc = mca_btl_scif_setup_mpools (scif_module);
57+
rc = mca_btl_scif_setup_rcache (scif_module);
5958
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
60-
BTL_ERROR(("btl/scif error setting up mpools/free lists"));
59+
BTL_ERROR(("btl/scif error setting up rcache or free lists"));
6160
return rc;
6261
}
6362
}
@@ -178,15 +177,15 @@ static int scif_dereg_mem (void *reg_data, mca_mpool_base_registration_t *reg)
178177
}
179178

180179
static int scif_reg_mem (void *reg_data, void *base, size_t size,
181-
mca_mpool_base_registration_t *reg)
180+
mca_rcache_base_registration_t *reg)
182181
{
183182
mca_btl_scif_reg_t *scif_reg = (mca_btl_scif_reg_t *)reg;
184183
int rc = OPAL_SUCCESS;
185184
unsigned int i;
186185

187186
scif_reg->handles = calloc (mca_btl_scif_module.endpoint_count, sizeof (scif_reg->handles[0]));
188187

189-
/* intialize all scif offsets to -1 and initialize the pointer back to the mpool registration */
188+
/* intialize all scif offsets to -1 and initialize the pointer back to the rcache registration */
190189
for (i = 0 ; i < mca_btl_scif_module.endpoint_count ; ++i) {
191190
scif_reg->handles[i].btl_handle.scif_offset = -1;
192191
scif_reg->handles[i].btl_handle.scif_base = (intptr_t) base;
@@ -211,22 +210,20 @@ static int scif_reg_mem (void *reg_data, void *base, size_t size,
211210
return rc;
212211
}
213212

214-
static int
215-
mca_btl_scif_setup_mpools (mca_btl_scif_module_t *scif_module)
213+
static int mca_btl_scif_setup_rcache (mca_btl_scif_module_t *scif_module)
216214
{
217-
struct mca_mpool_base_resources_t mpool_resources;
215+
mca_rcache_base_resources_t rcache_resources;
218216
int rc;
219217

220-
/* initialize the grdma mpool */
221-
mpool_resources.pool_name = "scif";
222-
mpool_resources.reg_data = (void *) scif_module;
223-
mpool_resources.sizeof_reg = sizeof (mca_btl_scif_reg_t);
224-
mpool_resources.register_mem = scif_reg_mem;
225-
mpool_resources.deregister_mem = scif_dereg_mem;
226-
scif_module->super.btl_mpool =
227-
mca_mpool_base_module_create("grdma", scif_module, &mpool_resources);
228-
if (NULL == scif_module->super.btl_mpool) {
229-
BTL_ERROR(("error creating grdma mpool"));
218+
/* initialize the grdma rcache */
219+
rcache_resources.cache_name = "scif";
220+
rcache_resources.reg_data = (void *) scif_module;
221+
rcache_resources.sizeof_reg = sizeof (mca_btl_scif_reg_t);
222+
rcache_resources.register_mem = scif_reg_mem;
223+
rcache_resources.deregister_mem = scif_dereg_mem;
224+
scif_module->rcache = mca_rcache_base_module_create ("grdma", scif_module, &rcache_resources);
225+
if (NULL == scif_module->rcache) {
226+
BTL_ERROR(("error creating grdma rcache"));
230227
return OPAL_ERROR;
231228
}
232229

opal/mca/btl/scif/btl_scif_frag.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ static inline int mca_btl_scif_frag_alloc (mca_btl_base_endpoint_t *ep,
6060
static inline int mca_btl_scif_frag_return (mca_btl_scif_base_frag_t *frag)
6161
{
6262
if (frag->registration) {
63-
frag->endpoint->btl->super.btl_mpool->mpool_deregister(frag->endpoint->btl->super.btl_mpool,
64-
&frag->registration->base);
63+
frag->endpoint->btl->rcache->rcache_deregister (frag->endpoint->btl->rcache,
64+
&frag->registration->base);
6565
frag->registration = NULL;
6666
}
6767

opal/mca/btl/scif/btl_scif_module.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
3+
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
44
* reserved.
55
* Copyright (c) 2014 Research Organization for Information Science
66
* and Technology (RIST). All rights reserved.
@@ -123,6 +123,11 @@ mca_btl_scif_module_finalize (struct mca_btl_base_module_t *btl)
123123
scif_module->endpoints = NULL;
124124
}
125125

126+
if (NULL != scif_module->rcache) {
127+
mca_rcache_base_module_destroy (scif_module->rcache);
128+
scif_module->rcache = NULL;
129+
}
130+
126131
/* close the listening endpoint */
127132
if (mca_btl_scif_module.listening && -1 != mca_btl_scif_module.scif_fd) {
128133
/* wake up the scif thread */
@@ -180,6 +185,7 @@ static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca
180185
mca_btl_base_endpoint_t *endpoint,
181186
void *base, size_t size, uint32_t flags)
182187
{
188+
mca_btl_scif_module_t *scif_module = &mca_btl_scif_module;
183189
mca_btl_scif_reg_t *scif_reg;
184190
int access_flags = flags & MCA_BTL_REG_FLAG_ACCESS_ANY;
185191
int rc;
@@ -200,8 +206,8 @@ static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca
200206
}
201207
}
202208

203-
rc = btl->btl_mpool->mpool_register(btl->btl_mpool, base, size, 0, access_flags,
204-
(mca_mpool_base_registration_t **) &scif_reg);
209+
rc = scif_module->rcache->rcache_register (scif_module->rcache, base, size, 0, access_flags,
210+
(mca_rcache_base_registration_t **) &scif_reg);
205211
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
206212
return NULL;
207213
}
@@ -210,7 +216,7 @@ static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca
210216
if ((off_t) -1 == scif_reg->handles[endpoint->id].btl_handle.scif_offset) {
211217
size_t seg_size = (size_t)((uintptr_t) scif_reg->base.bound - (uintptr_t) scif_reg->base.base) + 1;
212218

213-
/* NTH: until we determine a way to pass permissions to the mpool just make all segments
219+
/* NTH: until we determine a way to pass permissions to the rcache just make all segments
214220
* read/write */
215221
scif_reg->handles[endpoint->id].btl_handle.scif_offset =
216222
scif_register (endpoint->scif_epd, scif_reg->base.base, seg_size, 0, SCIF_PROT_READ |
@@ -225,9 +231,10 @@ static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca
225231
static int mca_btl_scif_deregister_mem (struct mca_btl_base_module_t *btl, mca_btl_base_registration_handle_t *handle)
226232
{
227233
mca_btl_scif_registration_handle_t *scif_handle = (mca_btl_scif_registration_handle_t *) handle;
234+
mca_btl_scif_module_t *scif_module = &mca_btl_scif_module;
228235
mca_btl_scif_reg_t *scif_reg = scif_handle->reg;
229236

230-
btl->btl_mpool->mpool_deregister (btl->btl_mpool, &scif_reg->base);
237+
scif_module->rcache->rcache_deregister (scif_module->rcache, &scif_reg->base);
231238

232239
return OPAL_SUCCESS;
233240
}

0 commit comments

Comments
 (0)