From a1d312343b6de1d15e32a8c317e908784a8b1b4c Mon Sep 17 00:00:00 2001 From: Ryan Grant Date: Tue, 1 Jul 2014 17:03:03 +0000 Subject: [PATCH] This commit fixes trac:4681 - ibm c_fence_lock hangs cmr=v1.8.2:reviewer=tkordenbrock:subject=Portals4/MTL hanging fix This commit was SVN r32113. The following Trac tickets were found above: Ticket 4681 --> https://svn.open-mpi.org/trac/ompi/ticket/4681 --- ompi/mca/osc/portals4/osc_portals4.h | 2 ++ .../osc/portals4/osc_portals4_active_target.c | 11 ++++++++ .../mca/osc/portals4/osc_portals4_component.c | 2 ++ .../portals4/osc_portals4_passive_target.c | 28 +++++++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/ompi/mca/osc/portals4/osc_portals4.h b/ompi/mca/osc/portals4/osc_portals4.h index 884e234c7d..ce4b04b7d0 100644 --- a/ompi/mca/osc/portals4/osc_portals4.h +++ b/ompi/mca/osc/portals4/osc_portals4.h @@ -98,6 +98,8 @@ struct ompi_osc_portals4_module_t { ompi_group_t *post_group; opal_list_t outstanding_locks; + bool passive_target_access_epoch; /* True if the access epoch is a passive target access epoch */ + /* things that are remotely accessible */ ompi_osc_portals4_node_state_t state; }; diff --git a/ompi/mca/osc/portals4/osc_portals4_active_target.c b/ompi/mca/osc/portals4/osc_portals4_active_target.c index 19c7939441..83de0f49d3 100644 --- a/ompi/mca/osc/portals4/osc_portals4_active_target.c +++ b/ompi/mca/osc/portals4/osc_portals4_active_target.c @@ -25,10 +25,16 @@ ompi_osc_portals4_fence(int assert, struct ompi_win_t *win) (ompi_osc_portals4_module_t*) win->w_osc_module; int comm_ret, ret; + /* can't enter an active target epoch when in a passive target epoch */ + if (module->passive_target_access_epoch) { + return OMPI_ERR_RMA_SYNC; + } + comm_ret = ompi_osc_portals4_complete_all(module); ret = module->comm->c_coll.coll_barrier(module->comm, module->comm->c_coll.coll_barrier_module); + return (OMPI_SUCCESS == comm_ret) ? ret : comm_ret; } @@ -41,6 +47,11 @@ ompi_osc_portals4_start(struct ompi_group_t *group, ompi_osc_portals4_module_t *module = (ompi_osc_portals4_module_t*) win->w_osc_module; + /* can't enter an active target epoch when in a passive target epoch */ + if (module->passive_target_access_epoch) { + return OMPI_ERR_RMA_SYNC; + } + if (0 == (assert & MPI_MODE_NOCHECK)) { int size; diff --git a/ompi/mca/osc/portals4/osc_portals4_component.c b/ompi/mca/osc/portals4/osc_portals4_component.c index 81a8a958b9..940e6e8530 100644 --- a/ompi/mca/osc/portals4/osc_portals4_component.c +++ b/ompi/mca/osc/portals4/osc_portals4_component.c @@ -600,6 +600,8 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit OBJ_CONSTRUCT(&module->outstanding_locks, opal_list_t); + module->passive_target_access_epoch = false; + #if OPAL_ASSEMBLY_ARCH == OMPI_AMD64 || OPAL_ASSEMBLY_ARCH == IA32 *model = MPI_WIN_UNIFIED; #else diff --git a/ompi/mca/osc/portals4/osc_portals4_passive_target.c b/ompi/mca/osc/portals4/osc_portals4_passive_target.c index 51008637f1..d754f12bd8 100644 --- a/ompi/mca/osc/portals4/osc_portals4_passive_target.c +++ b/ompi/mca/osc/portals4/osc_portals4_passive_target.c @@ -219,6 +219,8 @@ ompi_osc_portals4_lock(int lock_type, ompi_osc_portals4_outstanding_lock_t* lock; int ret; + module->passive_target_access_epoch = true; + lock = OBJ_NEW(ompi_osc_portals4_outstanding_lock_t); lock->target = target; @@ -278,6 +280,8 @@ ompi_osc_portals4_unlock(int target, ret = OMPI_SUCCESS; } + module->passive_target_access_epoch = false; + OBJ_RELEASE(lock); return ret; @@ -293,6 +297,8 @@ ompi_osc_portals4_lock_all(int assert, ompi_osc_portals4_outstanding_lock_t* lock; int ret = OMPI_SUCCESS; + module->passive_target_access_epoch = true; + lock = OBJ_NEW(ompi_osc_portals4_outstanding_lock_t); lock->target = -1; @@ -354,6 +360,8 @@ ompi_osc_portals4_unlock_all(struct ompi_win_t *win) } } + module->passive_target_access_epoch = false; + OBJ_RELEASE(lock); return OMPI_SUCCESS; @@ -378,6 +386,11 @@ ompi_osc_portals4_flush(int target, ompi_osc_portals4_module_t *module = (ompi_osc_portals4_module_t*) win->w_osc_module; + /* flush is only allowed from within a passive target epoch */ + if (!module->passive_target_access_epoch) { + return OMPI_ERR_RMA_SYNC; + } + return ompi_osc_portals4_complete_all(module); } @@ -388,6 +401,11 @@ ompi_osc_portals4_flush_all(struct ompi_win_t *win) ompi_osc_portals4_module_t *module = (ompi_osc_portals4_module_t*) win->w_osc_module; + /* flush is only allowed from within a passive target epoch */ + if (!module->passive_target_access_epoch) { + return OMPI_ERR_RMA_SYNC; + } + return ompi_osc_portals4_complete_all(module); } @@ -399,6 +417,11 @@ ompi_osc_portals4_flush_local(int target, ompi_osc_portals4_module_t *module = (ompi_osc_portals4_module_t*) win->w_osc_module; + /* flush is only allowed from within a passive target epoch */ + if (!module->passive_target_access_epoch) { + return OMPI_ERR_RMA_SYNC; + } + return ompi_osc_portals4_complete_all(module); } @@ -409,5 +432,10 @@ ompi_osc_portals4_flush_local_all(struct ompi_win_t *win) ompi_osc_portals4_module_t *module = (ompi_osc_portals4_module_t*) win->w_osc_module; + /* flush is only allowed from within a passive target epoch */ + if (!module->passive_target_access_epoch) { + return OMPI_ERR_RMA_SYNC; + } + return ompi_osc_portals4_complete_all(module); }